From 16f40db6ecc4b6ac1fea9444254bc4ace7b8fe78 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Fri, 4 Jun 2021 14:40:37 -0400 Subject: [PATCH] Partial #1052, Module test cases --- .../osloader-test/ut_osloader_module_test.c | 2 ++ .../osloader-test/ut_osloader_symtable_test.c | 17 +++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/unit-tests/osloader-test/ut_osloader_module_test.c b/src/unit-tests/osloader-test/ut_osloader_module_test.c index aca22eefa..27697ac3e 100644 --- a/src/unit-tests/osloader-test/ut_osloader_module_test.c +++ b/src/unit-tests/osloader-test/ut_osloader_module_test.c @@ -185,6 +185,7 @@ void UT_os_module_unload_test() /* #1 Invalid-ID-arg */ UT_RETVAL(OS_ModuleUnload(UT_OBJID_INCORRECT), OS_ERR_INVALID_ID); + UT_RETVAL(OS_ModuleUnload(OS_OBJECT_ID_UNDEFINED), OS_ERR_INVALID_ID); /*-----------------------------------------------------*/ /* #2 OS-call-failure */ @@ -224,6 +225,7 @@ void UT_os_module_info_test() /* #2 Invalid-ID-arg */ UT_RETVAL(OS_ModuleInfo(UT_OBJID_INCORRECT, &module_info), OS_ERR_INVALID_ID); + UT_RETVAL(OS_ModuleInfo(OS_OBJECT_ID_UNDEFINED, &module_info), OS_ERR_INVALID_ID); /*-----------------------------------------------------*/ /* #3 Nominal */ diff --git a/src/unit-tests/osloader-test/ut_osloader_symtable_test.c b/src/unit-tests/osloader-test/ut_osloader_symtable_test.c index b9dcad61d..204d0cd35 100644 --- a/src/unit-tests/osloader-test/ut_osloader_symtable_test.c +++ b/src/unit-tests/osloader-test/ut_osloader_symtable_test.c @@ -129,22 +129,23 @@ void UT_os_module_symbol_lookup_test() } /*-----------------------------------------------------*/ - /* #1 Invalid-pointer-arg-1 */ - - UT_RETVAL(OS_ModuleSymbolLookup(OS_OBJECT_ID_UNDEFINED, 0, "Sym"), OS_INVALID_POINTER); - - /*-----------------------------------------------------*/ - /* #2 Invalid-pointer-arg-2 */ + /* Invalid object ID */ - UT_RETVAL(OS_ModuleSymbolLookup(OS_OBJECT_ID_UNDEFINED, &symbol_addr, 0), OS_INVALID_POINTER); + UT_RETVAL(OS_ModuleSymbolLookup(OS_OBJECT_ID_UNDEFINED, &symbol_addr, "Sym"), OS_ERR_INVALID_ID); + UT_RETVAL(OS_ModuleSymbolLookup(UT_OBJID_INCORRECT, &symbol_addr, "Sym"), OS_ERR_INVALID_ID); /*-----------------------------------------------------*/ /* Setup for remainder of tests */ if (UT_SETUP(OS_ModuleLoad(&module_id, "Mod1", UT_OS_GENERIC_MODULE_NAME2, OS_MODULE_FLAG_LOCAL_SYMBOLS))) { /*-----------------------------------------------------*/ - /* #3 Symbol-not-found */ + /* #1 Invalid-pointer-arg */ + + UT_RETVAL(OS_ModuleSymbolLookup(module_id, NULL, "Sym"), OS_INVALID_POINTER); + UT_RETVAL(OS_ModuleSymbolLookup(module_id, &symbol_addr, NULL), OS_INVALID_POINTER); + /*-----------------------------------------------------*/ + /* #3 Symbol-not-found */ UT_RETVAL(OS_ModuleSymbolLookup(module_id, &symbol_addr, "NotFound"), OS_ERROR); /*-----------------------------------------------------*/