From 2431feee7e1c6cb30837efa8f93e2db6c88f6106 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Thu, 12 Dec 2019 15:31:49 -0500 Subject: [PATCH] Fix #313: Use UT assert for OSAL unit tests Modify the "unit-tests" (extended/functional tests) for OSAL to use the UT assert library for test case reporting and platform support. Reduce or eliminate the use of macros for platform abstraction wherever possible. This removes most platform-specific logic from the test cases, leaving that to the OSAL/BSP abstraction. --- src/unit-tests/CMakeLists.txt | 66 +- .../ut_os_support.h} | 103 ++- src/unit-tests/oscore-test/CMakeLists.txt | 8 +- .../oscore-test/ut_oscore_binsem_test.c | 275 +++---- .../oscore-test/ut_oscore_binsem_test.h | 2 +- .../oscore-test/ut_oscore_countsem_test.c | 263 +++---- .../oscore-test/ut_oscore_countsem_test.h | 2 +- .../oscore-test/ut_oscore_exception_test.c | 72 +- .../oscore-test/ut_oscore_exception_test.h | 2 +- .../oscore-test/ut_oscore_interrupt_test.c | 134 ++-- .../oscore-test/ut_oscore_interrupt_test.h | 2 +- .../oscore-test/ut_oscore_misc_test.c | 244 +++--- .../oscore-test/ut_oscore_misc_test.h | 2 +- .../oscore-test/ut_oscore_mutex_test.c | 225 +++--- .../oscore-test/ut_oscore_mutex_test.h | 2 +- .../oscore-test/ut_oscore_queue_test.c | 281 ++++--- .../oscore-test/ut_oscore_queue_test.h | 2 +- .../oscore-test/ut_oscore_task_test.c | 432 +++++------ .../oscore-test/ut_oscore_task_test.h | 2 +- src/unit-tests/oscore-test/ut_oscore_test.c | 209 +++--- src/unit-tests/oscore-test/ut_oscore_test.h | 6 +- .../oscore-test/ut_oscore_test_arinc653.c | 299 -------- .../oscore-test/ut_oscore_test_platforms.h | 105 --- .../oscore-test/ut_oscore_test_vxworks.c | 285 ------- src/unit-tests/osfile-test/CMakeLists.txt | 3 +- .../osfile-test/ut_osfile_dirio_test.c | 223 +++--- .../osfile-test/ut_osfile_dirio_test.h | 2 +- .../osfile-test/ut_osfile_fileio_test.c | 696 ++++++++---------- .../osfile-test/ut_osfile_fileio_test.h | 2 +- src/unit-tests/osfile-test/ut_osfile_test.c | 90 +-- src/unit-tests/osfile-test/ut_osfile_test.h | 8 +- .../osfile-test/ut_osfile_test_arinc653.c | 200 ----- .../osfile-test/ut_osfile_test_platforms.h | 100 --- src/unit-tests/osfilesys-test/CMakeLists.txt | 3 +- .../osfilesys-test/ut_osfilesys_diskio_test.c | 452 +++++------- .../osfilesys-test/ut_osfilesys_diskio_test.h | 2 +- .../osfilesys-test/ut_osfilesys_test.c | 66 +- .../osfilesys-test/ut_osfilesys_test.h | 4 +- .../ut_osfilesys_test_arinc653.c | 149 ---- .../ut_osfilesys_test_vxworks.c | 147 ---- src/unit-tests/osloader-test/CMakeLists.txt | 3 +- src/unit-tests/osloader-test/ut_module.c | 1 + .../osloader-test/ut_osloader_module_test.c | 130 ++-- .../osloader-test/ut_osloader_module_test.h | 2 +- .../osloader-test/ut_osloader_symtable_test.c | 85 +-- .../osloader-test/ut_osloader_symtable_test.h | 2 +- .../osloader-test/ut_osloader_test.c | 28 +- .../osloader-test/ut_osloader_test.h | 8 +- .../osloader-test/ut_osloader_test_arinc653.c | 7 - .../ut_osloader_test_platforms.h | 45 +- src/unit-tests/osnetwork-test/CMakeLists.txt | 3 +- .../osnetwork-test/ut_osnetwork_misc_test.c | 94 +-- .../osnetwork-test/ut_osnetwork_misc_test.h | 2 +- .../osnetwork-test/ut_osnetwork_test.c | 22 +- .../osnetwork-test/ut_osnetwork_test.h | 8 +- .../ut_osnetwork_test_arinc653.c | 3 - src/unit-tests/ostimer-test/CMakeLists.txt | 3 +- src/unit-tests/ostimer-test/ut_ostimer_test.c | 104 +-- src/unit-tests/ostimer-test/ut_ostimer_test.h | 4 +- .../ostimer-test/ut_ostimer_test_arinc653.c | 217 ------ .../ostimer-test/ut_ostimer_test_platforms.h | 263 ------- .../ostimer-test/ut_ostimer_timerio_test.c | 324 ++++---- .../ostimer-test/ut_ostimer_timerio_test.h | 2 +- src/unit-tests/shared/shared.mak | 25 - src/unit-tests/shared/ut_os_stubs.c | 344 --------- src/unit-tests/shared/ut_os_stubs.h | 187 ----- src/unit-tests/shared/ut_oscore_stubs.c | 48 -- src/unit-tests/shared/ut_osfile_stubs.c | 223 ------ src/unit-tests/shared/ut_osfilesys_stubs.c | 113 --- src/unit-tests/shared/ut_osnetwork_stubs.c | 54 -- src/unit-tests/shared/ut_ostimer_stubs.c | 108 --- src/unit-tests/shared/ut_psp_voltab_stubs.c | 69 -- .../shared/ut_psp_voltab_stubs_arinc653.c | 62 -- .../shared/ut_psp_voltab_stubs_vxworks.c | 68 -- 74 files changed, 2037 insertions(+), 5794 deletions(-) rename src/unit-tests/{shared/ut_osloader_stubs.c => inc/ut_os_support.h} (59%) delete mode 100644 src/unit-tests/oscore-test/ut_oscore_test_arinc653.c delete mode 100644 src/unit-tests/oscore-test/ut_oscore_test_platforms.h delete mode 100644 src/unit-tests/oscore-test/ut_oscore_test_vxworks.c delete mode 100644 src/unit-tests/osfile-test/ut_osfile_test_arinc653.c delete mode 100644 src/unit-tests/osfile-test/ut_osfile_test_platforms.h delete mode 100644 src/unit-tests/osfilesys-test/ut_osfilesys_test_arinc653.c delete mode 100644 src/unit-tests/osfilesys-test/ut_osfilesys_test_vxworks.c delete mode 100644 src/unit-tests/osloader-test/ut_osloader_test_arinc653.c delete mode 100644 src/unit-tests/osnetwork-test/ut_osnetwork_test_arinc653.c delete mode 100644 src/unit-tests/ostimer-test/ut_ostimer_test_arinc653.c delete mode 100644 src/unit-tests/ostimer-test/ut_ostimer_test_platforms.h delete mode 100644 src/unit-tests/shared/shared.mak delete mode 100644 src/unit-tests/shared/ut_os_stubs.c delete mode 100644 src/unit-tests/shared/ut_os_stubs.h delete mode 100644 src/unit-tests/shared/ut_oscore_stubs.c delete mode 100644 src/unit-tests/shared/ut_osfile_stubs.c delete mode 100644 src/unit-tests/shared/ut_osfilesys_stubs.c delete mode 100644 src/unit-tests/shared/ut_osnetwork_stubs.c delete mode 100644 src/unit-tests/shared/ut_ostimer_stubs.c delete mode 100644 src/unit-tests/shared/ut_psp_voltab_stubs.c delete mode 100644 src/unit-tests/shared/ut_psp_voltab_stubs_arinc653.c delete mode 100644 src/unit-tests/shared/ut_psp_voltab_stubs_vxworks.c diff --git a/src/unit-tests/CMakeLists.txt b/src/unit-tests/CMakeLists.txt index aeb917a10..26770023a 100644 --- a/src/unit-tests/CMakeLists.txt +++ b/src/unit-tests/CMakeLists.txt @@ -11,67 +11,21 @@ # not necessary and other OS's like RTEMS should work. # - -# This first routine checks for overlap between -# the set of supported OS type macro definitions -# and the set of macros defined in CMAKE_C_FLAGS. -# -# If no match is found then it means these tests do not -# contain support for that platform and attempting compilation -# will fail. -set(TEST_SUPPORTED_COMPILEDEF_LIST - -D_LINUX_OS_ - -D_VXWORKS_OS_ - -DOSP_ARINC653) - -string(REGEX MATCHALL "-D([A-Z_]+)" ALL_COMPILEDEFS "${CMAKE_C_FLAGS}") -set(OSTYPE_INDEX -1) -foreach(DEF ${ALL_COMPILEDEFS}) - list(FIND TEST_SUPPORTED_COMPILEDEF_LIST "${DEF}" OSTYPE_INDEX) - if (NOT OSTYPE_INDEX LESS 0) - # Matching index found - OK - break() - endif() -endforeach() - -if (OSTYPE_INDEX LESS 0) - message(STATUS "Extended tests do not support ${OSAL_SYSTEM_OSTYPE}, skipping build") - return() +# For VxWorks and RTEMS targets there are still a few slight +# variances that need to be accounted for, mainly in the file +# names and/or directory structures that the test case uses. +set(UT_COMPILEDEFS_vxworks "_VXWORKS_OS_") +set(UT_COMPILEDEFS_rtems "_RTEMS_OS_") +set(UT_COMPILEDEFS_posix "_POSIX_OS_") +if (DEFINED UT_COMPILEDEFS_${OSAL_SYSTEM_OSTYPE}) + add_definitions(-D${UT_COMPILEDEFS_${OSAL_SYSTEM_OSTYPE}}) endif() enable_testing() -add_definitions(-DUT_VERBOSE) -add_definitions(-D_OSAL_UNIT_TEST_) - -function(add_stubs OUTVAR) - set(RESULT) - foreach(STUB ${ARGN}) - list(APPEND RESULT ${OSAL_SOURCE_DIR}/src/unit-tests/shared/ut_${STUB}_stubs.c) - endforeach() - set(${OUTVAR} ${RESULT} PARENT_SCOPE) -endfunction(add_stubs) - -macro(add_stubs_except OUTVAR) - foreach(STUB ${STUBFILES}) - list(FIND ${ARGN} ${STUB} ISEXCL) - if (ISEXCL GREATER -1) - add_stubs(${OUTVAR} ${STUB}) - endif(ISEXCL GREATER -1) - endforeach() -endmacro(add_stubs_except) - -set(OSAL_TEST_MODULES core) - -# filesys file loader network printf timer) -file(GLOB STUB_SRCS shared/ut_*_stubs.c) -set(STUBFILES) -foreach(STUB ${STUB_SRCS}) - string(REGEX REPLACE ".*/shared/ut_(.*)_stubs\\.c$" "\\1" STUBFILE "${STUB}") - list(APPEND STUBFILES ${STUBFILE}) -endforeach() +include_directories(${OSAL_SOURCE_DIR}/ut_assert/inc) +include_directories(inc) -include_directories(shared) add_subdirectory(oscore-test) add_subdirectory(osloader-test) add_subdirectory(osfilesys-test) diff --git a/src/unit-tests/shared/ut_osloader_stubs.c b/src/unit-tests/inc/ut_os_support.h similarity index 59% rename from src/unit-tests/shared/ut_osloader_stubs.c rename to src/unit-tests/inc/ut_os_support.h index febb3c865..c8955de67 100644 --- a/src/unit-tests/shared/ut_osloader_stubs.c +++ b/src/unit-tests/inc/ut_os_support.h @@ -1,88 +1,83 @@ /*================================================================================* -** File: ut_osloader_stubs.c +** File: ut_os_support.h ** Owner: Tam Ngo -** Date: March 2013 +** Date: May 2013 **================================================================================*/ +#ifndef _UT_OS_SUPPORT_H_ +#define _UT_OS_SUPPORT_H_ + /*--------------------------------------------------------------------------------* ** Includes **--------------------------------------------------------------------------------*/ -#include "ut_os_stubs.h" +#include +#include +#include -/*--------------------------------------------------------------------------------* -** Macros -**--------------------------------------------------------------------------------*/ +#include "utassert.h" +#include "uttest.h" +#include "osapi.h" -/*--------------------------------------------------------------------------------* -** Data types -**--------------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------------* -** External global variables -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Global variables +** Macros **--------------------------------------------------------------------------------*/ -UT_OsReturnCode_t g_moduleTblInit = {0,0}; -UT_OsReturnCode_t g_moduleLoad = {0,0}; -UT_OsReturnCode_t g_moduleUnload = {0,0}; -UT_OsReturnCode_t g_moduleInfo = {0,0}; +/* + * Buffers to hold names of various objects + * + * These are sized somewhat larger than the osconfig.h specification, + * so that test cases may create names that exceed the allowed length + */ +#define UT_OS_NAME_BUFF_SIZE (OS_MAX_API_NAME + 10) +#define UT_OS_FILE_BUFF_SIZE (OS_MAX_FILE_NAME + 10) +#define UT_OS_PATH_BUFF_SIZE (OS_MAX_PATH_LEN + 10) +#define UT_OS_PHYS_NAME_BUFF_SIZE (OS_FS_PHYS_NAME_LEN + 10) +#define UT_OS_LOCAL_PATH_BUFF_SIZE (OS_MAX_LOCAL_PATH_LEN + 10) -UT_OsReturnCode_t g_symbolTblLookup = {0,0}; -UT_OsReturnCode_t g_symbolTblDump = {0,0}; +/* + * Generic buffer for I/O operations + */ +#define UT_OS_IO_BUFF_SIZE 128 -/*--------------------------------------------------------------------------------* -** Local function prototypes -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Function definitions -**--------------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------------*/ -int32 OS_ModuleTableInit() -{ - return (g_moduleTblInit.value); -} +#define UT_OS_TEST_RESULT(descStr, caseType) \ + UtAssertEx(false, caseType, __FILE__, __LINE__, "%s", descStr) /*--------------------------------------------------------------------------------*/ -int32 OS_ModuleLoad(uint32* module_id, char* module_name, char* filename) -{ - return (g_moduleLoad.value); -} +#define UT_os_sprintf(buf,...) \ + snprintf(buf,sizeof(buf),__VA_ARGS__) /*--------------------------------------------------------------------------------*/ -int32 OS_ModuleUnload(uint32 module_id) -{ - return (g_moduleUnload.value); -} +#define UT_OS_LOG(...) \ + UtAssert_Message(UTASSERT_CASETYPE_INFO,__FILE__,__LINE__,__VA_ARGS__); -/*--------------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------------* +** Data types +**--------------------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------------------* +** External global variables +**--------------------------------------------------------------------------------*/ -int32 OS_ModuleInfo(uint32 module_id, OS_module_prop_t* module_info) -{ - return (g_moduleInfo.value); -} +/*--------------------------------------------------------------------------------* +** Global variables +**--------------------------------------------------------------------------------*/ -/*--------------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------------* +** Function prototypes +**--------------------------------------------------------------------------------*/ -int32 OS_SymbolLookup(uint32* SymbolAddress, char* SymbolName) -{ - return (g_symbolTblLookup.value); -} /*--------------------------------------------------------------------------------*/ -int32 OS_SymbolTableDump(char* filename, uint32 SizeLimit) -{ - return (g_symbolTblDump.value); -} +#endif /* _UT_OS_SUPPORT_H_ */ /*================================================================================* -** End of File: ut_osloader_stubs.c +** End of File: ut_os_support.h **================================================================================*/ diff --git a/src/unit-tests/oscore-test/CMakeLists.txt b/src/unit-tests/oscore-test/CMakeLists.txt index b8b7faa4e..0ed5ba38b 100644 --- a/src/unit-tests/oscore-test/CMakeLists.txt +++ b/src/unit-tests/oscore-test/CMakeLists.txt @@ -7,8 +7,10 @@ set(TEST_MODULE_FILES ut_oscore_countsem_test.c ut_oscore_mutex_test.c ut_oscore_task_test.c - ut_oscore_test.c) + ut_oscore_interrupt_test.c + ut_oscore_exception_test.c + ut_oscore_test.c +) -add_stubs(TEST_STUBS os) -add_osal_ut_exe(osal_core_UT ${TEST_MODULE_FILES} ${TEST_STUBS}) +add_osal_ut_exe(osal_core_UT ${TEST_MODULE_FILES}) diff --git a/src/unit-tests/oscore-test/ut_oscore_binsem_test.c b/src/unit-tests/oscore-test/ut_oscore_binsem_test.c index a2844422a..892b155ca 100644 --- a/src/unit-tests/oscore-test/ut_oscore_binsem_test.c +++ b/src/unit-tests/oscore-test/ut_oscore_binsem_test.c @@ -22,8 +22,6 @@ ** External global variables **--------------------------------------------------------------------------------*/ -extern UT_OsLogInfo_t g_logInfo; - /*--------------------------------------------------------------------------------* ** Global variables **--------------------------------------------------------------------------------*/ @@ -44,11 +42,7 @@ void UT_os_sample_test() /* Must declare these variables for each function. They can be renamed. * They're referenced in the macros used to track test cases and their results. */ int32 idx = 0; - UT_OsApiInfo_t apiInfo; - const char* testDesc = NULL; - - /* Call this once at the beginning of the function to initialize the test variables. */ - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------* * For each test case, @@ -70,7 +64,7 @@ void UT_os_sample_test() if (OS_xxx() == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_sample_test_exit_tag; } @@ -82,9 +76,9 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(NULL,...) == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* TODO: Reset the test environment here, if necessary */ @@ -94,9 +88,9 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(aVeryLoooooongName) == OS_ERR_NAME_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* TODO: Reset the test environment here, if necessary */ @@ -106,17 +100,15 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(...) != OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); /* TODO: Reset the test environment here, if necessary */ UT_os_sample_test_exit_tag: - /* Call these macros at the very end of the function to close out the test variables - * and get it added to the global list being tracked. */ - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_xxx", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } #endif @@ -134,47 +126,43 @@ void UT_os_sample_test() void UT_os_bin_sem_create_test() { int i; - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; uint32 test_setup_invalid = 0; - char sem_name[OS_MAX_API_NAME]; - char long_sem_name[OS_MAX_API_NAME+5]; + char sem_name[UT_OS_NAME_BUFF_SIZE]; + char long_sem_name[UT_OS_NAME_BUFF_SIZE]; uint32 sem_ids[OS_MAX_BIN_SEMAPHORES+1]; - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - /*-----------------------------------------------------*/ testDesc = "API not implemented"; res = OS_BinSemCreate(&sem_ids[0], "Good", 1, 0 ); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_bin_sem_create_test_exit_tag; } /* Clean up */ - res = OS_BinSemDelete(sem_ids[0]); + OS_BinSemDelete(sem_ids[0]); /*-----------------------------------------------------*/ testDesc = "#1 Null-pointer-arg-1"; res = OS_BinSemCreate(NULL, "BinSem1", 1, 0); if (res == OS_INVALID_POINTER) - /* cppcheck-suppress syntaxError */ - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Null-pointer-arg-2"; res = OS_BinSemCreate(&sem_ids[0], NULL, 1, 0); if (res == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Name-too-long"; @@ -183,9 +171,9 @@ void UT_os_bin_sem_create_test() long_sem_name[sizeof(long_sem_name)-1] = '\0'; res = OS_BinSemCreate(&sem_ids[0], long_sem_name, 1, 0); if (res == OS_ERR_NAME_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#4 No-free-IDs"; @@ -200,7 +188,7 @@ void UT_os_bin_sem_create_test() if ( res != OS_SUCCESS ) { testDesc = "#4 No-free-IDs - Bin Sem Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); test_setup_invalid = 1; break; } @@ -210,9 +198,9 @@ void UT_os_bin_sem_create_test() { res = OS_BinSemCreate(&sem_ids[OS_MAX_BIN_SEMAPHORES], "OneTooMany", 1, 0); if (res == OS_ERR_NO_FREE_IDS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } @@ -227,15 +215,15 @@ void UT_os_bin_sem_create_test() if ( res != OS_SUCCESS ) { testDesc = "#5 Duplicate-name - Bin Sem Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_BinSemCreate(&sem_ids[0], "DUPLICATE", 1, 0); if (res == OS_ERR_NAME_TAKEN) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ res = OS_BinSemDelete(sem_ids[0]); @@ -244,23 +232,22 @@ void UT_os_bin_sem_create_test() /*-----------------------------------------------------*/ testDesc = "#6 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#7 Nominal"; res = OS_BinSemCreate(&sem_ids[0], "Good", 1, 0); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ res = OS_BinSemDelete(sem_ids[0]); UT_os_bin_sem_create_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_BinSemCreate", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; } /*--------------------------------------------------------------------------------* @@ -273,20 +260,17 @@ void UT_os_bin_sem_create_test() **--------------------------------------------------------------------------------*/ void UT_os_bin_sem_delete_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; uint32 bin_sem_id; - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - /*-----------------------------------------------------*/ testDesc = "API not implemented"; res = OS_BinSemDelete(0); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_bin_sem_delete_test_exit_tag; } @@ -295,14 +279,14 @@ void UT_os_bin_sem_delete_test() res = OS_BinSemDelete(99999); if ( res == OS_ERR_INVALID_ID ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#3 Nominal"; @@ -312,20 +296,19 @@ void UT_os_bin_sem_delete_test() if ( res != OS_SUCCESS ) { testDesc = "#3 Nominal - Bin Sem Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_BinSemDelete(bin_sem_id); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } UT_os_bin_sem_delete_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_BinSemDelete", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; } /*--------------------------------------------------------------------------------* @@ -339,20 +322,17 @@ void UT_os_bin_sem_delete_test() **--------------------------------------------------------------------------------*/ void UT_os_bin_sem_flush_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; uint32 bin_sem_id; - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - /*-----------------------------------------------------*/ testDesc = "API not implemented"; res = OS_BinSemFlush(0); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_bin_sem_flush_test_exit_tag; } @@ -361,14 +341,14 @@ void UT_os_bin_sem_flush_test() res = OS_BinSemFlush(99999); if ( res == OS_ERR_INVALID_ID ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*----------------------------------------------------*/ testDesc = "#3 Nominal"; @@ -378,22 +358,22 @@ void UT_os_bin_sem_flush_test() if ( res != OS_SUCCESS ) { testDesc = "#3 Nominal - Bin Sem Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_BinSemFlush(bin_sem_id); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); res = OS_BinSemDelete(bin_sem_id); } UT_os_bin_sem_flush_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_BinSemFlush", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -407,20 +387,17 @@ void UT_os_bin_sem_flush_test() **--------------------------------------------------------------------------------*/ void UT_os_bin_sem_give_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; uint32 bin_sem_id; - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - /*-----------------------------------------------------*/ testDesc = "API not implemented"; res = OS_BinSemGive(0); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_bin_sem_give_test_exit_tag; } @@ -429,14 +406,14 @@ void UT_os_bin_sem_give_test() res = OS_BinSemGive(99999); if ( res == OS_ERR_INVALID_ID ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#3 Nominal"; @@ -446,22 +423,22 @@ void UT_os_bin_sem_give_test() if ( res != OS_SUCCESS ) { testDesc = "#3 Nominal - Bin Sem Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_BinSemGive(bin_sem_id); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); res = OS_BinSemDelete(bin_sem_id); } UT_os_bin_sem_give_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_BinSemGive", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -476,20 +453,17 @@ void UT_os_bin_sem_give_test() **--------------------------------------------------------------------------------*/ void UT_os_bin_sem_take_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; uint32 bin_sem_id; - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - /*-----------------------------------------------------*/ testDesc = "API not implemented"; res = OS_BinSemTake(0); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_bin_sem_take_test_exit_tag; } @@ -498,14 +472,14 @@ void UT_os_bin_sem_take_test() res = OS_BinSemTake(99999); if ( res == OS_ERR_INVALID_ID ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#3 Nominal"; @@ -515,22 +489,22 @@ void UT_os_bin_sem_take_test() if ( res != OS_SUCCESS ) { testDesc = "#3 Nominal - Bin Sem Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_BinSemTake(bin_sem_id); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); res = OS_BinSemDelete(bin_sem_id); } UT_os_bin_sem_take_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_BinSemTake", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -544,20 +518,17 @@ void UT_os_bin_sem_take_test() **--------------------------------------------------------------------------------*/ void UT_os_bin_sem_timed_wait_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; uint32 bin_sem_id; - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - /*-----------------------------------------------------*/ testDesc = "API not implemented"; res = OS_BinSemTimedWait(0,1000); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_bin_sem_timed_wait_test_exit_tag; } @@ -566,14 +537,14 @@ void UT_os_bin_sem_timed_wait_test() res = OS_BinSemTimedWait(99999, 1000); if ( res == OS_ERR_INVALID_ID ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#3 Sem-take-timed-out"; @@ -583,7 +554,7 @@ void UT_os_bin_sem_timed_wait_test() if ( res != OS_SUCCESS ) { testDesc = "#3 Sem-take-timed-out - Bin Sem Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { @@ -591,15 +562,15 @@ void UT_os_bin_sem_timed_wait_test() if ( res != OS_SUCCESS ) { testDesc = "#3 Sem-take-timed-out - Bin Sem Take failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_BinSemTimedWait(bin_sem_id,1000); if ( res == OS_SEM_TIMEOUT ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } res = OS_BinSemDelete(bin_sem_id); @@ -613,22 +584,22 @@ void UT_os_bin_sem_timed_wait_test() if ( res != OS_SUCCESS ) { testDesc = "#4 Nominal - Bin Sem Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_BinSemTimedWait(bin_sem_id,1000); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); res = OS_BinSemDelete(bin_sem_id); } UT_os_bin_sem_timed_wait_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_BinSemTimedWait", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -643,13 +614,10 @@ void UT_os_bin_sem_timed_wait_test() **--------------------------------------------------------------------------------*/ void UT_os_bin_sem_get_id_by_name_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; uint32 bin_sem_id; - char long_sem_name[OS_MAX_API_NAME+5]; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + char long_sem_name[UT_OS_NAME_BUFF_SIZE]; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -657,7 +625,7 @@ void UT_os_bin_sem_get_id_by_name_test() res = OS_BinSemGetIdByName(0, "InvalidName"); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_bin_sem_get_id_by_name_test_exit_tag; } @@ -666,18 +634,18 @@ void UT_os_bin_sem_get_id_by_name_test() res = OS_BinSemGetIdByName(NULL, "InvalidName"); if ( res == OS_INVALID_POINTER ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Invalid-pointer-arg-2"; res = OS_BinSemGetIdByName(&bin_sem_id, NULL); if ( res == OS_INVALID_POINTER ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Name-too-long"; @@ -686,18 +654,18 @@ void UT_os_bin_sem_get_id_by_name_test() long_sem_name[sizeof(long_sem_name)-1] = '\0'; res = OS_BinSemGetIdByName(&bin_sem_id, long_sem_name); if ( res == OS_ERR_NAME_TOO_LONG ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#4 Name-not-found"; res = OS_BinSemGetIdByName(&bin_sem_id, "NameNotFound"); if ( res == OS_ERR_NAME_NOT_FOUND ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#5 Nominal"; @@ -707,22 +675,22 @@ void UT_os_bin_sem_get_id_by_name_test() if ( res != OS_SUCCESS ) { testDesc = "#5 Nominal - Bin Sem Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_BinSemGetIdByName(&bin_sem_id, "GetIDByName"); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); res = OS_BinSemDelete(bin_sem_id); } UT_os_bin_sem_get_id_by_name_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_BinSemGetIdByName", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -736,21 +704,18 @@ void UT_os_bin_sem_get_id_by_name_test() **--------------------------------------------------------------------------------*/ void UT_os_bin_sem_get_info_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; uint32 bin_sem_id; OS_bin_sem_prop_t bin_sem_prop; - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - /*-----------------------------------------------------*/ testDesc = "API not implemented"; res = OS_BinSemGetInfo(0, &bin_sem_prop); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_bin_sem_get_info_test_exit_tag; } @@ -759,9 +724,9 @@ void UT_os_bin_sem_get_info_test() res = OS_BinSemGetInfo(99999, &bin_sem_prop); if ( res == OS_ERR_INVALID_ID ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Invalid-pointer-arg"; @@ -771,15 +736,15 @@ void UT_os_bin_sem_get_info_test() if ( res != OS_SUCCESS ) { testDesc = "#2 Invalid-pointer-arg - Bin Sem Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_BinSemGetInfo(bin_sem_id, NULL); if ( res == OS_INVALID_POINTER ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); res = OS_BinSemDelete(bin_sem_id); } @@ -792,22 +757,22 @@ void UT_os_bin_sem_get_info_test() if ( res != OS_SUCCESS ) { testDesc = "#3 Nominal - Bin Sem Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_BinSemGetInfo(bin_sem_id, &bin_sem_prop); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); res = OS_BinSemDelete(bin_sem_id); } UT_os_bin_sem_get_info_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_BinSemGetInfo", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*================================================================================* diff --git a/src/unit-tests/oscore-test/ut_oscore_binsem_test.h b/src/unit-tests/oscore-test/ut_oscore_binsem_test.h index 2368f0fa7..d1b8a0a59 100644 --- a/src/unit-tests/oscore-test/ut_oscore_binsem_test.h +++ b/src/unit-tests/oscore-test/ut_oscore_binsem_test.h @@ -11,7 +11,7 @@ ** Includes **--------------------------------------------------------------------------------*/ -#include "ut_os_stubs.h" +#include "ut_os_support.h" /*--------------------------------------------------------------------------------* ** Macros diff --git a/src/unit-tests/oscore-test/ut_oscore_countsem_test.c b/src/unit-tests/oscore-test/ut_oscore_countsem_test.c index 7dc1c2751..8abde7c35 100644 --- a/src/unit-tests/oscore-test/ut_oscore_countsem_test.c +++ b/src/unit-tests/oscore-test/ut_oscore_countsem_test.c @@ -9,7 +9,6 @@ **--------------------------------------------------------------------------------*/ #include "ut_oscore_countsem_test.h" -#include "ut_oscore_test_platforms.h" /*--------------------------------------------------------------------------------* ** Macros @@ -23,8 +22,6 @@ ** External global variables **--------------------------------------------------------------------------------*/ -extern UT_OsLogInfo_t g_logInfo; - /*--------------------------------------------------------------------------------* ** Global variables **--------------------------------------------------------------------------------*/ @@ -45,11 +42,7 @@ void UT_os_sample_test() /* Must declare these variables for each function. They can be renamed. * They're referenced in the macros used to track test cases and their results. */ int32 idx = 0; - UT_OsApiInfo_t apiInfo; - const char* testDesc = NULL; - - /* Call this once at the beginning of the function to initialize the test variables. */ - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------* * For each test case, @@ -71,7 +64,7 @@ void UT_os_sample_test() if (OS_xxx() == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_sample_test_exit_tag; } @@ -83,9 +76,9 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(NULL,...) == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* TODO: Reset the test environment here, if necessary */ @@ -95,9 +88,9 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(aVeryLoooooongName) == OS_ERR_NAME_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* TODO: Reset the test environment here, if necessary */ @@ -107,17 +100,15 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(...) != OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); /* TODO: Reset the test environment here, if necessary */ UT_os_sample_test_exit_tag: - /* Call these macros at the very end of the function to close out the test variables - * and get it added to the global list being tracked. */ - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_xxx", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } #endif @@ -135,47 +126,43 @@ void UT_os_sample_test() void UT_os_count_sem_create_test() { int i; - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; uint32 count_sem_ids[OS_MAX_COUNT_SEMAPHORES+1]; - char sem_name[OS_MAX_API_NAME]; - char long_sem_name[OS_MAX_API_NAME+5]; + char sem_name[UT_OS_NAME_BUFF_SIZE]; + char long_sem_name[UT_OS_NAME_BUFF_SIZE]; uint32 test_setup_invalid = 0; - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - /*-----------------------------------------------------*/ testDesc = "API not implemented"; res = OS_CountSemCreate(&count_sem_ids[0], "Good", 1, 0 ); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_count_sem_create_test_exit_tag; } /* Clean up */ - res = OS_CountSemDelete(count_sem_ids[0]); + OS_CountSemDelete(count_sem_ids[0]); /*-----------------------------------------------------*/ testDesc = "#1 Null-pointer-arg-1"; res = OS_CountSemCreate(NULL, "CountSem1", 1, 0); if (res == OS_INVALID_POINTER) - /* cppcheck-suppress syntaxError */ - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Null-pointer-arg-2"; res = OS_CountSemCreate(&count_sem_ids[0], NULL, 1, 0); if (res == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Name-too-long"; @@ -184,9 +171,9 @@ void UT_os_count_sem_create_test() long_sem_name[sizeof(long_sem_name)-1] = '\0'; res = OS_CountSemCreate(&count_sem_ids[0], long_sem_name, 1, 0); if (res == OS_ERR_NAME_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#4 Initial-count-too-high"; @@ -199,11 +186,11 @@ void UT_os_count_sem_create_test() #ifdef SEM_VALUE_MAX res = OS_CountSemCreate(&count_sem_ids[0], "CountSem1", ((uint32)SEM_VALUE_MAX) + 1, 0); if (res == OS_INVALID_SEM_VALUE) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); #else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); #endif /*-----------------------------------------------------*/ @@ -218,7 +205,7 @@ void UT_os_count_sem_create_test() if ( res != OS_SUCCESS ) { testDesc = "#5 No-free-IDs - Count Sem Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); test_setup_invalid = 1; break; } @@ -228,9 +215,9 @@ void UT_os_count_sem_create_test() { res = OS_CountSemCreate(&count_sem_ids[OS_MAX_COUNT_SEMAPHORES], "OneTooMany", 1, 0); if (res == OS_ERR_NO_FREE_IDS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } /* Reset test environment */ @@ -244,41 +231,41 @@ void UT_os_count_sem_create_test() if ( res != OS_SUCCESS ) { testDesc = "#6 Duplicate-name - Count Sem Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); } else { res = OS_CountSemCreate(&count_sem_ids[1], "DUPLICATE", 1, 0); if (res == OS_ERR_NAME_TAKEN) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ - res = OS_CountSemDelete(count_sem_ids[0]); - res = OS_CountSemDelete(count_sem_ids[1]); + OS_CountSemDelete(count_sem_ids[0]); + OS_CountSemDelete(count_sem_ids[1]); } /*-----------------------------------------------------*/ testDesc = "#7 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#8 Nominal"; res = OS_CountSemCreate(&count_sem_ids[0], "Good", 1, 0); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ res = OS_CountSemDelete(count_sem_ids[0]); UT_os_count_sem_create_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_CountSemCreate", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -291,20 +278,17 @@ void UT_os_count_sem_create_test() **--------------------------------------------------------------------------------*/ void UT_os_count_sem_delete_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; uint32 count_sem_id; - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - /*-----------------------------------------------------*/ testDesc = "API not implemented"; res = OS_CountSemDelete(0); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_count_sem_delete_test_exit_tag; } @@ -313,14 +297,14 @@ void UT_os_count_sem_delete_test() res = OS_CountSemDelete(99999); if ( res == OS_ERR_INVALID_ID ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#3 Nominal"; @@ -330,20 +314,20 @@ void UT_os_count_sem_delete_test() if ( res != OS_SUCCESS ) { testDesc = "#3 Nominal - Count Sem Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_CountSemDelete(count_sem_id); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } UT_os_count_sem_delete_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_CountSemDelete", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -357,20 +341,17 @@ void UT_os_count_sem_delete_test() **--------------------------------------------------------------------------------*/ void UT_os_count_sem_give_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; uint32 count_sem_id; - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - /*-----------------------------------------------------*/ testDesc = "API not implemented"; res = OS_CountSemGive(0); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_count_sem_give_test_exit_tag; } @@ -379,14 +360,14 @@ void UT_os_count_sem_give_test() res = OS_CountSemGive(99999); if ( res == OS_ERR_INVALID_ID ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#3 Nominal"; @@ -396,22 +377,22 @@ void UT_os_count_sem_give_test() if ( res != OS_SUCCESS ) { testDesc = "#3 Nominal - Count Sem Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_CountSemGive(count_sem_id); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); res = OS_CountSemDelete(count_sem_id); } UT_os_count_sem_give_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_CountSemGive", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -425,20 +406,17 @@ void UT_os_count_sem_give_test() **--------------------------------------------------------------------------------*/ void UT_os_count_sem_take_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; uint32 count_sem_id; - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - /*-----------------------------------------------------*/ testDesc = "API not implemented"; res = OS_CountSemTake(0); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_count_sem_take_test_exit_tag; } @@ -447,14 +425,14 @@ void UT_os_count_sem_take_test() res = OS_CountSemTake(99999); if ( res == OS_ERR_INVALID_ID ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#3 Nominal"; @@ -464,21 +442,21 @@ void UT_os_count_sem_take_test() if ( res != OS_SUCCESS ) { testDesc = "#3 Nominal - Count Sem Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_CountSemTake(count_sem_id); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); res = OS_CountSemDelete(count_sem_id); } UT_os_count_sem_take_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_CountSemTake", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -492,20 +470,17 @@ void UT_os_count_sem_take_test() **--------------------------------------------------------------------------------*/ void UT_os_count_sem_timed_wait_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; uint32 count_sem_id; - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - /*-----------------------------------------------------*/ testDesc = "API not implemented"; res = OS_CountSemTimedWait(0,1000); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_count_sem_timed_wait_test_exit_tag; } @@ -514,14 +489,14 @@ void UT_os_count_sem_timed_wait_test() res = OS_CountSemTimedWait(99999, 1000); if ( res == OS_ERR_INVALID_ID ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#3 Sem-take-timed-out"; @@ -531,7 +506,7 @@ void UT_os_count_sem_timed_wait_test() if ( res != OS_SUCCESS ) { testDesc = "#3 Sem-take-timed-out - Count Sem Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { @@ -539,15 +514,15 @@ void UT_os_count_sem_timed_wait_test() if ( res != OS_SUCCESS ) { testDesc = "#3 Sem-take-timed-out - Count Sem Take failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_CountSemTimedWait(count_sem_id, 1000); if ( res == OS_SEM_TIMEOUT ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } res = OS_CountSemDelete(count_sem_id); } @@ -560,22 +535,22 @@ void UT_os_count_sem_timed_wait_test() if ( res != OS_SUCCESS ) { testDesc = "#4 Nominal - Count Sem Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_CountSemTimedWait(count_sem_id, 1000); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); res = OS_CountSemDelete(count_sem_id); } UT_os_count_sem_timed_wait_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_CountSemTimedWait", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -590,13 +565,10 @@ void UT_os_count_sem_timed_wait_test() **--------------------------------------------------------------------------------*/ void UT_os_count_sem_get_id_by_name_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; uint32 count_sem_id; - char long_sem_name[OS_MAX_API_NAME+5]; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + char long_sem_name[UT_OS_NAME_BUFF_SIZE]; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -604,7 +576,7 @@ void UT_os_count_sem_get_id_by_name_test() res = OS_CountSemGetIdByName(0, "InvalidName"); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_count_sem_get_id_by_name_test_exit_tag; } @@ -613,18 +585,18 @@ void UT_os_count_sem_get_id_by_name_test() res = OS_CountSemGetIdByName(NULL, "InvalidName"); if ( res == OS_INVALID_POINTER ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Invalid-pointer-arg-2"; res = OS_CountSemGetIdByName(&count_sem_id, NULL); if ( res == OS_INVALID_POINTER ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Name-too-long"; @@ -633,18 +605,18 @@ void UT_os_count_sem_get_id_by_name_test() long_sem_name[sizeof(long_sem_name)-1] = '\0'; res = OS_CountSemGetIdByName(&count_sem_id, long_sem_name); if ( res == OS_ERR_NAME_TOO_LONG ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#4 Name-not-found"; res = OS_CountSemGetIdByName(&count_sem_id, "NameNotFound"); if ( res == OS_ERR_NAME_NOT_FOUND ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#5 Nominal"; @@ -654,22 +626,22 @@ void UT_os_count_sem_get_id_by_name_test() if ( res != OS_SUCCESS ) { testDesc = "#5 Nominal - Count Sem Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_CountSemGetIdByName(&count_sem_id, "GetIDByName"); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); res = OS_CountSemDelete(count_sem_id); } UT_os_count_sem_get_id_by_name_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_CountSemGetIdByName", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -682,21 +654,18 @@ void UT_os_count_sem_get_id_by_name_test() **--------------------------------------------------------------------------------*/ void UT_os_count_sem_get_info_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; uint32 count_sem_id; OS_count_sem_prop_t count_sem_prop; - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - /*-----------------------------------------------------*/ testDesc = "API not implemented"; res = OS_CountSemGetInfo(0,&count_sem_prop); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_count_sem_get_info_test_exit_tag; } @@ -705,9 +674,9 @@ void UT_os_count_sem_get_info_test() res = OS_CountSemGetInfo(99999, &count_sem_prop); if ( res == OS_ERR_INVALID_ID ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Invalid-pointer-arg"; @@ -717,15 +686,15 @@ void UT_os_count_sem_get_info_test() if ( res != OS_SUCCESS ) { testDesc = "#2 Invalid-pointer-arg - Count Sem Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_CountSemGetInfo(count_sem_id, NULL); if ( res == OS_INVALID_POINTER ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); res = OS_CountSemDelete(count_sem_id); } @@ -738,22 +707,22 @@ void UT_os_count_sem_get_info_test() if ( res != OS_SUCCESS ) { testDesc = "#3 Nominal - Count Sem Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_CountSemGetInfo(count_sem_id, &count_sem_prop); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); res = OS_CountSemDelete(count_sem_id); } UT_os_count_sem_get_info_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_CountSemGetInfo", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*================================================================================* diff --git a/src/unit-tests/oscore-test/ut_oscore_countsem_test.h b/src/unit-tests/oscore-test/ut_oscore_countsem_test.h index 23671074c..fc29ed371 100644 --- a/src/unit-tests/oscore-test/ut_oscore_countsem_test.h +++ b/src/unit-tests/oscore-test/ut_oscore_countsem_test.h @@ -11,7 +11,7 @@ ** Includes **--------------------------------------------------------------------------------*/ -#include "ut_os_stubs.h" +#include "ut_os_support.h" /*--------------------------------------------------------------------------------* ** Macros diff --git a/src/unit-tests/oscore-test/ut_oscore_exception_test.c b/src/unit-tests/oscore-test/ut_oscore_exception_test.c index 1db3c8edc..3f75bd0df 100644 --- a/src/unit-tests/oscore-test/ut_oscore_exception_test.c +++ b/src/unit-tests/oscore-test/ut_oscore_exception_test.c @@ -9,7 +9,6 @@ **--------------------------------------------------------------------------------*/ #include "ut_oscore_exception_test.h" -#include "ut_oscore_test_platforms.h" /*--------------------------------------------------------------------------------* ** Macros @@ -23,8 +22,6 @@ ** External global variables **--------------------------------------------------------------------------------*/ -extern UT_OsLogInfo_t g_logInfo; - /*--------------------------------------------------------------------------------* ** Global variables **--------------------------------------------------------------------------------*/ @@ -45,11 +42,7 @@ void UT_os_sample_test() /* Must declare these variables for each function. They can be renamed. * They're referenced in the macros used to track test cases and their results. */ int32 idx = 0; - UT_OsApiInfo_t apiInfo; - const char* testDesc = NULL; - - /* Call this once at the beginning of the function to initialize the test variables. */ - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------* * For each test case, @@ -71,7 +64,7 @@ void UT_os_sample_test() if (OS_xxx() == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_sample_test_exit_tag; } @@ -83,9 +76,9 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(NULL,...) == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* TODO: Reset the test environment here, if necessary */ @@ -95,9 +88,9 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(aVeryLoooooongName) == OS_ERR_NAME_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* TODO: Reset the test environment here, if necessary */ @@ -107,17 +100,15 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(...) != OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); /* TODO: Reset the test environment here, if necessary */ UT_os_sample_test_exit_tag: - /* Call these macros at the very end of the function to close out the test variables - * and get it added to the global list being tracked. */ - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_xxx", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } #endif @@ -140,12 +131,9 @@ void UT_os_sample_test() **--------------------------------------------------------------------------------*/ void UT_os_fpuexc_setmask_test() { - UT_OsApiInfo_t apiInfo; uint32 oldMask=0x00, newMask=0x01, curMask=0x00; - int32 res = 0, idx = 0; - const char* testDesc = NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + int32 res = 0; + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -154,7 +142,7 @@ void UT_os_fpuexc_setmask_test() res = OS_FPUExcSetMask(newMask); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_fpuexc_setmask_exit_tag; } @@ -170,22 +158,21 @@ void UT_os_fpuexc_setmask_test() { res = OS_FPUExcGetMask(&curMask); if ((res == OS_SUCCESS) && (curMask == newMask)) - /* cppcheck-suppress syntaxError */ - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } else { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } /* Reset test environment */ OS_FPUExcSetMask(oldMask); UT_os_fpuexc_setmask_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_FPUExcSetMask", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -213,12 +200,9 @@ void UT_os_fpuexc_setmask_test() **--------------------------------------------------------------------------------*/ void UT_os_fpuexc_getmask_test() { - UT_OsApiInfo_t apiInfo; - uint32 oldMask=0x00, newMask=0x01, curMask=0x00; - int32 res = 0, idx = 0; - const char* testDesc = NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + uint32 curMask=0x00; + int32 res = 0; + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -226,7 +210,7 @@ void UT_os_fpuexc_getmask_test() res = OS_FPUExcGetMask(&curMask); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_fpuexc_getmask_exit_tag; } @@ -235,22 +219,22 @@ void UT_os_fpuexc_getmask_test() res = OS_FPUExcGetMask(NULL); if (res == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Nominal"; res = OS_FPUExcGetMask(&curMask); if (res == OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); UT_os_fpuexc_getmask_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_FPUExcGetMask", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*================================================================================* diff --git a/src/unit-tests/oscore-test/ut_oscore_exception_test.h b/src/unit-tests/oscore-test/ut_oscore_exception_test.h index 30548c6e0..d92518b33 100644 --- a/src/unit-tests/oscore-test/ut_oscore_exception_test.h +++ b/src/unit-tests/oscore-test/ut_oscore_exception_test.h @@ -11,7 +11,7 @@ ** Includes **--------------------------------------------------------------------------------*/ -#include "ut_os_stubs.h" +#include "ut_os_support.h" /*--------------------------------------------------------------------------------* ** Macros diff --git a/src/unit-tests/oscore-test/ut_oscore_interrupt_test.c b/src/unit-tests/oscore-test/ut_oscore_interrupt_test.c index 8dbf050fa..489c7ecbc 100644 --- a/src/unit-tests/oscore-test/ut_oscore_interrupt_test.c +++ b/src/unit-tests/oscore-test/ut_oscore_interrupt_test.c @@ -9,7 +9,6 @@ **--------------------------------------------------------------------------------*/ #include "ut_oscore_interrupt_test.h" -#include "ut_oscore_test_platforms.h" /*--------------------------------------------------------------------------------* ** Macros @@ -23,8 +22,6 @@ ** External global variables **--------------------------------------------------------------------------------*/ -extern UT_OsLogInfo_t g_logInfo; - /*--------------------------------------------------------------------------------* ** Global variables **--------------------------------------------------------------------------------*/ @@ -47,11 +44,7 @@ void UT_os_sample_test() /* Must declare these variables for each function. They can be renamed. * They're referenced in the macros used to track test cases and their results. */ int32 idx = 0; - UT_OsApiInfo_t apiInfo; - const char* testDesc = NULL; - - /* Call this once at the beginning of the function to initialize the test variables. */ - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------* * For each test case, @@ -73,7 +66,7 @@ void UT_os_sample_test() if (OS_xxx() == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_sample_test_exit_tag; } @@ -85,9 +78,9 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(NULL,...) == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* TODO: Reset the test environment here, if necessary */ @@ -97,9 +90,9 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(aVeryLoooooongName) == OS_ERR_NAME_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* TODO: Reset the test environment here, if necessary */ @@ -109,17 +102,17 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(...) != OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); /* TODO: Reset the test environment here, if necessary */ UT_os_sample_test_exit_tag: /* Call these macros at the very end of the function to close out the test variables * and get it added to the global list being tracked. */ - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_xxx", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } #endif @@ -130,7 +123,6 @@ void UT_myInterruptFunc(void) static int32 iCounter=0; iCounter++; - OS_printf("\nUT_myInterruptFunc() - count=%d\n", iCounter); } /*--------------------------------------------------------------------------------* @@ -145,7 +137,7 @@ void UT_myInterruptFunc(void) ** Returns: OS_INVALID_POINTER if passing in null pointer ** OS_ERROR if OS call failed ** OS_SUCCESS if succeeded -/*--------------------------------------------------------------------------------* +**-------------------------------------------------------------------------------- ** Test #0: Not-implemented condition ** 1) Call this routine ** 2) If the returned value is OS_ERR_NOT_IMPLEMENTED, then exit test @@ -169,11 +161,8 @@ void UT_myInterruptFunc(void) **--------------------------------------------------------------------------------*/ void UT_os_int_attachhandler_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + int32 res = 0; + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -181,7 +170,7 @@ void UT_os_int_attachhandler_test() res = OS_IntAttachHandler(1, UT_myInterruptFunc, 100); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_int_attachhandler_exit_tag; } @@ -190,33 +179,32 @@ void UT_os_int_attachhandler_test() res = OS_IntAttachHandler(1, NULL, 0); if (res == OS_INVALID_POINTER) - /* cppcheck-suppress syntaxError */ - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 OS-call-failure"; res = OS_IntAttachHandler(100, UT_myInterruptFunc, 0); if (res == OS_ERROR) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Nominal"; res = OS_IntAttachHandler(1, UT_myInterruptFunc, 0); if (res == OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); UT_os_int_attachhandler_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_IntAttachHandler", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -244,11 +232,8 @@ void UT_os_int_attachhandler_test() **--------------------------------------------------------------------------------*/ void UT_os_int_enable_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + int32 res = 0; + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -256,7 +241,7 @@ void UT_os_int_enable_test() res = OS_IntEnable(1); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_int_enable_exit_tag; } @@ -266,23 +251,23 @@ void UT_os_int_enable_test() /*-----------------------------------------------------*/ testDesc = "#1 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#2 Nominal"; res = OS_IntEnable(1); if (res == OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ OS_IntDisable(1); UT_os_int_enable_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_IntEnable", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -310,11 +295,8 @@ void UT_os_int_enable_test() **--------------------------------------------------------------------------------*/ void UT_os_int_disable_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + int32 res = 0; + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -322,14 +304,14 @@ void UT_os_int_disable_test() res = OS_IntDisable(1); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_int_disable_exit_tag; } /*-----------------------------------------------------*/ testDesc = "#1 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#2 Nominal"; @@ -338,19 +320,19 @@ void UT_os_int_disable_test() { res = OS_IntDisable(1); if (res == OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } else { testDesc = "#2 Nominal - Interrupt-Enable failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } UT_os_int_disable_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_IntDisable", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -377,25 +359,22 @@ void UT_os_int_disable_test() **--------------------------------------------------------------------------------*/ void UT_os_int_lock_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + int32 res = 0; + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; if (OS_IntLock() == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_int_lock_exit_tag; } /*-----------------------------------------------------*/ testDesc = "#1 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#2 Nominal"; @@ -403,13 +382,13 @@ void UT_os_int_lock_test() res = OS_IntLock(); /* Note: Could check for more evidence here; only checking API for now. */ if (OS_IntUnlock(res) == OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); UT_os_int_lock_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_IntLock", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -437,38 +416,35 @@ void UT_os_int_lock_test() **--------------------------------------------------------------------------------*/ void UT_os_int_unlock_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + int32 res = 0; + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; if (OS_IntUnlock(0) == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_int_unlock_exit_tag; } /*-----------------------------------------------------*/ testDesc = "#1 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#2 Nominal"; res = OS_IntLock(); if (OS_IntUnlock(res) == OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); UT_os_int_unlock_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_IntUnlock", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*================================================================================* diff --git a/src/unit-tests/oscore-test/ut_oscore_interrupt_test.h b/src/unit-tests/oscore-test/ut_oscore_interrupt_test.h index e7d0b89fc..d18b200a0 100644 --- a/src/unit-tests/oscore-test/ut_oscore_interrupt_test.h +++ b/src/unit-tests/oscore-test/ut_oscore_interrupt_test.h @@ -11,7 +11,7 @@ ** Includes **--------------------------------------------------------------------------------*/ -#include "ut_os_stubs.h" +#include "ut_os_support.h" /*--------------------------------------------------------------------------------* ** Macros diff --git a/src/unit-tests/oscore-test/ut_oscore_misc_test.c b/src/unit-tests/oscore-test/ut_oscore_misc_test.c index c7a357f6d..447aaf7d0 100644 --- a/src/unit-tests/oscore-test/ut_oscore_misc_test.c +++ b/src/unit-tests/oscore-test/ut_oscore_misc_test.c @@ -9,7 +9,6 @@ **--------------------------------------------------------------------------------*/ #include "ut_oscore_misc_test.h" -#include "ut_oscore_test_platforms.h" /*--------------------------------------------------------------------------------* ** Macros @@ -23,8 +22,6 @@ ** External global variables **--------------------------------------------------------------------------------*/ -extern UT_OsLogInfo_t g_logInfo; - /*--------------------------------------------------------------------------------* ** Global variables **--------------------------------------------------------------------------------*/ @@ -49,11 +46,7 @@ void UT_os_sample_test() /* Must declare these variables for each function. They can be renamed. * They're referenced in the macros used to track test cases and their results. */ int32 idx = 0; - UT_OsApiInfo_t apiInfo; - const char* testDesc = NULL; - - /* Call this once at the beginning of the function to initialize the test variables. */ - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------* * For each test case, @@ -75,7 +68,7 @@ void UT_os_sample_test() if (OS_xxx() == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_sample_test_exit_tag; } @@ -87,9 +80,9 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(NULL,...) == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* TODO: Reset the test environment here, if necessary */ @@ -99,9 +92,9 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(aVeryLoooooongName) == OS_ERR_NAME_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* TODO: Reset the test environment here, if necessary */ @@ -111,17 +104,15 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(...) != OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); /* TODO: Reset the test environment here, if necessary */ UT_os_sample_test_exit_tag: - /* Call these macros at the very end of the function to close out the test variables - * and get it added to the global list being tracked. */ - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_xxx", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } #endif @@ -155,14 +146,11 @@ void UT_os_sample_test() *--------------------------------------------------------------------------------*/ void UT_os_apiinit_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; uint32 qId = 0, qDepth = 10, qSize = 4, qFlags = 0; uint32 semIds[3], semInitValue = 1, semOptions = 0; - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - /*-----------------------------------------------------*/ testDesc = "#1 Init-not-call-first"; @@ -170,10 +158,9 @@ void UT_os_apiinit_test() (OS_BinSemCreate(&semIds[0], "BinSem 1", semInitValue, semOptions) != OS_SUCCESS) && (OS_CountSemCreate(&semIds[1], "CountSem 1", semInitValue, semOptions) != OS_SUCCESS) && (OS_MutSemCreate(&semIds[2], "MutexSem 1", semOptions) != OS_SUCCESS)) - /* cppcheck-suppress syntaxError */ - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ OS_QueueDelete(qId); @@ -188,7 +175,7 @@ void UT_os_apiinit_test() if (res == OS_ERR_NOT_IMPLEMENTED) { testDesc = "API not implemented"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_apiinit_test_exit_tag; } else if ((res == OS_SUCCESS) && @@ -197,11 +184,11 @@ void UT_os_apiinit_test() (OS_CountSemCreate(&semIds[1], "CountSem 1", semInitValue, semOptions) == OS_SUCCESS) && (OS_MutSemCreate(&semIds[2], "MutexSem 1", semOptions) == OS_SUCCESS)) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); } else { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } /* Reset test environment */ @@ -211,8 +198,8 @@ void UT_os_apiinit_test() OS_MutSemDelete(semIds[2]); UT_os_apiinit_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_API_Init", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -229,19 +216,12 @@ void UT_os_apiinit_test() **--------------------------------------------------------------------------------*/ void UT_os_printf_test() { - int32 idx = 0; - UT_OsApiInfo_t apiInfo; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - OS_printf_enable(); - UT_OS_LOG_MACRO("OS_printf() - #1 Nominal [This is the expected stdout output after API call]\n") + UT_OS_LOG("OS_printf() - #1 Nominal [This is the expected stdout output after API call]\n"); OS_printf("OS_printf() - #1 Nominal [ This is the expected stdout output after API call]\n"); - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, "#1 Nominal - Manual inspection required", UT_OS_MIR) + UT_OS_TEST_RESULT( "#1 Nominal - Manual inspection required", UTASSERT_CASETYPE_MIR); - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_printf", idx) - UT_OS_LOG_API_MACRO(apiInfo) } /*--------------------------------------------------------------------------------* @@ -258,21 +238,14 @@ void UT_os_printf_test() **--------------------------------------------------------------------------------*/ void UT_os_printfenable_test() { - int32 idx = 0; - UT_OsApiInfo_t apiInfo; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - OS_printf_disable(); OS_printf_enable(); - UT_OS_LOG_MACRO("OS_printf_enable() - #1 Nominal [This is the expected stdout output after API call]\n") + UT_OS_LOG("OS_printf_enable() - #1 Nominal [This is the expected stdout output after API call]\n"); OS_printf("OS_printf_enable() - #1 Nominal [This is the expected stdout output after API call]\n"); - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, "#1 Nominal - Manual inspection required", UT_OS_MIR) + UT_OS_TEST_RESULT( "#1 Nominal - Manual inspection required", UTASSERT_CASETYPE_MIR); - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_printf_enable", idx) - UT_OS_LOG_API_MACRO(apiInfo) } /*--------------------------------------------------------------------------------* @@ -289,28 +262,21 @@ void UT_os_printfenable_test() **--------------------------------------------------------------------------------*/ void UT_os_printfdisable_test() { - int32 idx = 0; - UT_OsApiInfo_t apiInfo; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - OS_printf_enable(); - UT_OS_LOG_MACRO("OS_printf_disable() - #1 Nominal [This is the expected stdout output before API call]\n") + UT_OS_LOG("OS_printf_disable() - #1 Nominal [This is the expected stdout output before API call]\n"); OS_printf("OS_printf_disable() - #1 Nominal [This is the expected stdout output before API call]\n"); OS_printf_disable(); - UT_OS_LOG_MACRO("OS_printf_disable() - #1 Nominal [This is NOT the expected stdout output after API call]\n") + UT_OS_LOG("OS_printf_disable() - #1 Nominal [This is NOT the expected stdout output after API call]\n"); OS_printf("OS_printf_disable() - #1 Nominal [This is NOT the expected stdout output after API call]\n"); - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, "#1 Nominal - Manual inspection required", UT_OS_MIR) + UT_OS_TEST_RESULT( "#1 Nominal - Manual inspection required", UTASSERT_CASETYPE_MIR); /* Reset test environment */ OS_printf_enable(); - UT_OS_LOG_MACRO("OS_printf_disable() - #1 Nominal [This is the expected stdout output after test reset]\n") + UT_OS_LOG("OS_printf_disable() - #1 Nominal [This is the expected stdout output after test reset]\n"); OS_printf("OS_printf_disable() - #1 Nominal [This is the expected stdout output after test reset]\n"); - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_printf_disable", idx) - UT_OS_LOG_API_MACRO(apiInfo) } /*--------------------------------------------------------------------------------* @@ -332,11 +298,8 @@ void UT_os_printfdisable_test() **--------------------------------------------------------------------------------*/ void UT_os_tick2micros_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + int32 res = 0; + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -344,7 +307,7 @@ void UT_os_tick2micros_test() res = OS_Tick2Micros(); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_tick2micros_test_exit_tag; } @@ -353,13 +316,13 @@ void UT_os_tick2micros_test() res = OS_Tick2Micros(); if (res >= 0) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); UT_os_tick2micros_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_Tick2Micros", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -387,12 +350,9 @@ void UT_os_tick2micros_test() **--------------------------------------------------------------------------------*/ void UT_os_milli2ticks_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; + int32 res = 0; uint32 timeInMillisecs = 0; - const char* testDesc = NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -400,7 +360,7 @@ void UT_os_milli2ticks_test() res = OS_Milli2Ticks(timeInMillisecs); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_milli2ticks_test_exit_tag; } @@ -410,9 +370,9 @@ void UT_os_milli2ticks_test() timeInMillisecs = 0; res = OS_Milli2Ticks(timeInMillisecs); if (res == 0) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Nominal"; @@ -420,13 +380,13 @@ void UT_os_milli2ticks_test() timeInMillisecs = 100; res = OS_Milli2Ticks(timeInMillisecs); if (res >= 0) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); UT_os_milli2ticks_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_Milli2Ticks", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -463,11 +423,8 @@ void UT_os_milli2ticks_test() void UT_os_getlocaltime_test() { OS_time_t time_struct; - UT_OsApiInfo_t apiInfo; - const char* testDesc = NULL; - int32 res = 0, idx = 0, i = 0; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; + int32 res = 0, i = 0; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -475,7 +432,7 @@ void UT_os_getlocaltime_test() res = OS_GetLocalTime(NULL); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_getlocaltime_test_exit_tag; } @@ -483,14 +440,14 @@ void UT_os_getlocaltime_test() testDesc = "#1 Null-pointer-arg"; res = OS_GetLocalTime(NULL); if (res == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#3 Nominal"; @@ -498,28 +455,28 @@ void UT_os_getlocaltime_test() res = OS_GetLocalTime(&time_struct); if (res == OS_SUCCESS) { - UT_OS_LOG_MACRO("\n") + UT_OS_LOG("\n"); for (i=0; i < 5; i++) { - UT_OS_LOG_MACRO("OS_GetLocalTime() - #3 Nominal ") - UT_OS_LOG_MACRO("[Expecting output after API call to increase over time: %ld.%ld]\n", + UT_OS_LOG("OS_GetLocalTime() - #3 Nominal "); + UT_OS_LOG("[Expecting output after API call to increase over time: %ld.%ld]\n", (long)time_struct.seconds, (long)time_struct.microsecs); - UT_OS_WAIT_MACRO + OS_TaskDelay(20); OS_GetLocalTime(&time_struct); } testDesc = "#3 Nominal - Manual inspection required"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_MIR) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_MIR); } else { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } UT_os_getlocaltime_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_GetLocalTime", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -556,11 +513,8 @@ void UT_os_getlocaltime_test() void UT_os_setlocaltime_test() { OS_time_t time_struct; - UT_OsApiInfo_t apiInfo; - const char* testDesc = NULL; - int32 res = 0, idx = 0, i = 0; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; + int32 res = 0, i = 0; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -568,7 +522,7 @@ void UT_os_setlocaltime_test() res = OS_SetLocalTime(NULL); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_setlocaltime_test_exit_tag; } @@ -577,14 +531,14 @@ void UT_os_setlocaltime_test() res = OS_GetLocalTime(NULL); if (res == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#3 Nominal"; @@ -592,14 +546,13 @@ void UT_os_setlocaltime_test() res = OS_GetLocalTime(&time_struct); if (res == OS_SUCCESS) { - UT_os_printf("\n"); for (i=0; i < 5; i++) { - UT_OS_LOG_MACRO("OS_SetLocalTime() - #3 Nominal ") - UT_OS_LOG_MACRO("[Expecting output before API call to increase over time: %ld.%ld]\n", + UT_OS_LOG("OS_SetLocalTime() - #3 Nominal "); + UT_OS_LOG("[Expecting output before API call to increase over time: %ld.%ld]\n", (long)time_struct.seconds, (long)time_struct.microsecs); - UT_OS_WAIT_MACRO + OS_TaskDelay(20); OS_GetLocalTime(&time_struct); } } @@ -611,36 +564,35 @@ void UT_os_setlocaltime_test() res = OS_SetLocalTime(&time_struct); if (res == OS_SUCCESS) { - UT_OS_LOG_MACRO("OS_SetLocalTime() - #3 Nominal [New time set at %ld.%ld]\n", + UT_OS_LOG("OS_SetLocalTime() - #3 Nominal [New time set at %ld.%ld]\n", (long)time_struct.seconds, (long)time_struct.microsecs); res = OS_GetLocalTime(&time_struct); if (res == OS_SUCCESS) { - UT_os_printf("\n"); for (i=0; i < 5; i++) { - UT_OS_LOG_MACRO("OS_SetLocalTime() - #3 Nominal ") - UT_OS_LOG_MACRO("[Expecting output after API call to increase over time: %ld.%ld]\n", + UT_OS_LOG("OS_SetLocalTime() - #3 Nominal "); + UT_OS_LOG("[Expecting output after API call to increase over time: %ld.%ld]\n", (long)time_struct.seconds, (long)time_struct.microsecs); - UT_OS_WAIT_MACRO + OS_TaskDelay(20); OS_GetLocalTime(&time_struct); } } testDesc = "#3 Nominal - Manual inspection required"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_MIR) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_MIR); } else { /* Most likely it is a permission issue - no way to fix - but OK to ignore this failure */ - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); } UT_os_setlocaltime_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_SetLocalTime", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -669,12 +621,9 @@ void UT_os_setlocaltime_test() **--------------------------------------------------------------------------------*/ void UT_os_geterrorname_test(void) { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; + int32 res = 0; os_err_name_t errNames[4]; - const char* testDesc = NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -682,7 +631,7 @@ void UT_os_geterrorname_test(void) res = OS_GetErrorName(OS_SUCCESS, &errNames[0]); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_geterrorname_test_exit_tag; } @@ -691,17 +640,17 @@ void UT_os_geterrorname_test(void) res = OS_GetErrorName(OS_ERROR, NULL); if (res == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Undefined Error"; if (OS_GetErrorName(12345, &errNames[0]) == OS_ERROR) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Nominal"; @@ -712,13 +661,13 @@ void UT_os_geterrorname_test(void) (strcmp(errNames[1], "OS_ERR_NAME_TAKEN") == 0) && (OS_GetErrorName(OS_ERR_NO_FREE_IDS, &errNames[2]) == OS_SUCCESS) && (strcmp(errNames[2], "OS_ERR_NO_FREE_IDS") == 0)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); UT_os_geterrorname_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_GetErrorName", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -753,12 +702,9 @@ void UT_os_geterrorname_test(void) **--------------------------------------------------------------------------------*/ void UT_os_heapgetinfo_test(void) { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; + int32 res = 0; OS_heap_prop_t heapProp; - const char* testDesc = NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -766,7 +712,7 @@ void UT_os_heapgetinfo_test(void) res = OS_HeapGetInfo(&heapProp); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_heapgetinfo_test_exit_tag; } @@ -775,27 +721,27 @@ void UT_os_heapgetinfo_test(void) res = OS_HeapGetInfo(NULL); if (res == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#3 Nominal"; res = OS_HeapGetInfo(&heapProp); if (res == OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); UT_os_heapgetinfo_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_HeapGetInfo", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*================================================================================* diff --git a/src/unit-tests/oscore-test/ut_oscore_misc_test.h b/src/unit-tests/oscore-test/ut_oscore_misc_test.h index bce37b3b8..916f18db7 100644 --- a/src/unit-tests/oscore-test/ut_oscore_misc_test.h +++ b/src/unit-tests/oscore-test/ut_oscore_misc_test.h @@ -11,7 +11,7 @@ ** Includes **--------------------------------------------------------------------------------*/ -#include "ut_os_stubs.h" +#include "ut_os_support.h" /*--------------------------------------------------------------------------------* ** Macros diff --git a/src/unit-tests/oscore-test/ut_oscore_mutex_test.c b/src/unit-tests/oscore-test/ut_oscore_mutex_test.c index 417622a2e..ca2f31a4b 100644 --- a/src/unit-tests/oscore-test/ut_oscore_mutex_test.c +++ b/src/unit-tests/oscore-test/ut_oscore_mutex_test.c @@ -22,8 +22,6 @@ ** External global variables **--------------------------------------------------------------------------------*/ -extern UT_OsLogInfo_t g_logInfo; - /*--------------------------------------------------------------------------------* ** Global variables **--------------------------------------------------------------------------------*/ @@ -44,11 +42,7 @@ void UT_os_sample_test() /* Must declare these variables for each function. They can be renamed. * They're referenced in the macros used to track test cases and their results. */ int32 idx = 0; - UT_OsApiInfo_t apiInfo; - const char* testDesc = NULL; - - /* Call this once at the beginning of the function to initialize the test variables. */ - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------* * For each test case, @@ -70,7 +64,7 @@ void UT_os_sample_test() if (OS_xxx() == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_sample_test_exit_tag; } @@ -82,9 +76,9 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(NULL,...) == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* TODO: Reset the test environment here, if necessary */ @@ -94,9 +88,9 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(aVeryLoooooongName) == OS_ERR_NAME_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* TODO: Reset the test environment here, if necessary */ @@ -106,17 +100,15 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(...) != OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); /* TODO: Reset the test environment here, if necessary */ UT_os_sample_test_exit_tag: - /* Call these macros at the very end of the function to close out the test variables - * and get it added to the global list being tracked. */ - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_xxx", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } #endif @@ -134,48 +126,44 @@ void UT_os_sample_test() void UT_os_mut_sem_create_test() { int i; - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; uint32 mut_sem_id; uint32 mut_sem_id2; - char sem_name[OS_MAX_API_NAME]; - char long_sem_name[OS_MAX_API_NAME+5]; + char sem_name[UT_OS_NAME_BUFF_SIZE]; + char long_sem_name[UT_OS_NAME_BUFF_SIZE]; uint32 test_setup_invalid = 0; - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - /*-----------------------------------------------------*/ testDesc = "API not implemented"; res = OS_MutSemCreate(&mut_sem_id, "Good", 0 ); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_mut_sem_create_test_exit_tag; } /* Clean up */ - res = OS_MutSemDelete(mut_sem_id); + OS_MutSemDelete(mut_sem_id); /*-----------------------------------------------------*/ testDesc = "#1 Null-pointer-arg-1"; res = OS_MutSemCreate(NULL, "MutSem1", 0); if (res == OS_INVALID_POINTER) - /* cppcheck-suppress syntaxError */ - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Null-pointer-arg-2"; res = OS_MutSemCreate(&mut_sem_id, NULL, 0); if (res == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Name-too-long"; @@ -184,9 +172,9 @@ void UT_os_mut_sem_create_test() long_sem_name[sizeof(long_sem_name)-1] = '\0'; res = OS_MutSemCreate(&mut_sem_id, long_sem_name, 0); if (res == OS_ERR_NAME_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#4 No-free-IDs"; @@ -200,7 +188,7 @@ void UT_os_mut_sem_create_test() if ( res != OS_SUCCESS ) { testDesc = "#4 No-free-IDs - Mutex Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); test_setup_invalid = 1; break; } @@ -210,9 +198,9 @@ void UT_os_mut_sem_create_test() { res = OS_MutSemCreate(&mut_sem_id, "OneTooMany", 0); if (res == OS_ERR_NO_FREE_IDS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } /* Reset test environment */ @@ -226,15 +214,15 @@ void UT_os_mut_sem_create_test() if ( res != OS_SUCCESS ) { testDesc = "#5 Duplicate-name - Mutex Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_MutSemCreate(&mut_sem_id, "DUPLICATE", 0); if (res == OS_ERR_NAME_TAKEN) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ res = OS_MutSemDelete(mut_sem_id2); @@ -243,23 +231,23 @@ void UT_os_mut_sem_create_test() /*-----------------------------------------------------*/ testDesc = "#6 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#7 Nominal"; res = OS_MutSemCreate(&mut_sem_id, "Good", 0); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ res = OS_MutSemDelete(mut_sem_id); UT_os_mut_sem_create_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_MutSemCreate", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -273,20 +261,17 @@ void UT_os_mut_sem_create_test() **--------------------------------------------------------------------------------*/ void UT_os_mut_sem_delete_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; uint32 mut_sem_id; - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - /*-----------------------------------------------------*/ testDesc = "API not implemented"; res = OS_MutSemDelete(0); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_mut_sem_delete_test_exit_tag; } @@ -295,14 +280,14 @@ void UT_os_mut_sem_delete_test() res = OS_MutSemDelete(99999); if ( res == OS_ERR_INVALID_ID ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#3 Nominal"; @@ -312,20 +297,20 @@ void UT_os_mut_sem_delete_test() if ( res != OS_SUCCESS ) { testDesc = "#3 Nominal - Mutex Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_MutSemDelete(mut_sem_id); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } UT_os_mut_sem_delete_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_MutSemDelete", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -339,20 +324,17 @@ void UT_os_mut_sem_delete_test() **--------------------------------------------------------------------------------*/ void UT_os_mut_sem_give_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; uint32 mut_sem_id; - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - /*-----------------------------------------------------*/ testDesc = "API not implemented"; res = OS_MutSemGive(0); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_mut_sem_give_test_exit_tag; } @@ -361,14 +343,14 @@ void UT_os_mut_sem_give_test() res = OS_MutSemGive(99999); if ( res == OS_ERR_INVALID_ID ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#3 Nominal"; @@ -378,7 +360,7 @@ void UT_os_mut_sem_give_test() if ( res != OS_SUCCESS ) { testDesc = "#3 Nominal - Mutex Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { @@ -386,23 +368,23 @@ void UT_os_mut_sem_give_test() if ( res != OS_SUCCESS ) { testDesc = "#3 Nominal - Mutex Take failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_MutSemGive(mut_sem_id); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); res = OS_MutSemDelete(mut_sem_id); } } UT_os_mut_sem_give_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_MutSemGive", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -416,20 +398,17 @@ void UT_os_mut_sem_give_test() **--------------------------------------------------------------------------------*/ void UT_os_mut_sem_take_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; uint32 mut_sem_id; - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - /*-----------------------------------------------------*/ testDesc = "API not implemented"; res = OS_MutSemTake(0); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_mut_sem_take_test_exit_tag; } @@ -438,14 +417,14 @@ void UT_os_mut_sem_take_test() res = OS_MutSemTake(99999); if ( res == OS_ERR_INVALID_ID ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#3 Nominal"; @@ -455,23 +434,23 @@ void UT_os_mut_sem_take_test() if ( res != OS_SUCCESS ) { testDesc = "#3 Nominal - Mutex Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_MutSemTake(mut_sem_id); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); - res = OS_MutSemGive(mut_sem_id); - res = OS_MutSemDelete(mut_sem_id); + OS_MutSemGive(mut_sem_id); + OS_MutSemDelete(mut_sem_id); } UT_os_mut_sem_take_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_MutSemTake", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -485,13 +464,10 @@ void UT_os_mut_sem_take_test() **--------------------------------------------------------------------------------*/ void UT_os_mut_sem_get_id_by_name_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; uint32 mut_sem_id; - char long_sem_name[OS_MAX_API_NAME+5]; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + char long_sem_name[UT_OS_NAME_BUFF_SIZE]; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -499,7 +475,7 @@ void UT_os_mut_sem_get_id_by_name_test() res = OS_MutSemGetIdByName(0,"InvalidName"); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_mut_sem_get_id_by_name_test_exit_tag; } @@ -508,18 +484,18 @@ void UT_os_mut_sem_get_id_by_name_test() res = OS_MutSemGetIdByName(NULL, "InvalidName"); if ( res == OS_INVALID_POINTER ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Invalid-pointer-arg-2"; res = OS_MutSemGetIdByName(&mut_sem_id, NULL); if ( res == OS_INVALID_POINTER ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Name-too-long"; @@ -528,18 +504,18 @@ void UT_os_mut_sem_get_id_by_name_test() long_sem_name[sizeof(long_sem_name)-1] = '\0'; res = OS_MutSemGetIdByName(&mut_sem_id, long_sem_name); if ( res == OS_ERR_NAME_TOO_LONG ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#4 Name-not-found"; res = OS_MutSemGetIdByName(&mut_sem_id, "NameNotFound"); if ( res == OS_ERR_NAME_NOT_FOUND ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#5 Nominal"; @@ -548,22 +524,22 @@ void UT_os_mut_sem_get_id_by_name_test() if ( res != OS_SUCCESS ) { testDesc = "#5 Nominal - Mutex Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_MutSemGetIdByName(&mut_sem_id, "GetIDByName"); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); res = OS_MutSemDelete(mut_sem_id); } UT_os_mut_sem_get_id_by_name_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_MutSemGetIdByName", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -576,21 +552,18 @@ void UT_os_mut_sem_get_id_by_name_test() **--------------------------------------------------------------------------------*/ void UT_os_mut_sem_get_info_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; uint32 mut_sem_id; OS_mut_sem_prop_t mut_sem_prop; - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - /*-----------------------------------------------------*/ testDesc = "API not implemented"; res = OS_MutSemGetInfo(0, &mut_sem_prop); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_mut_sem_get_info_test_exit_tag; } @@ -599,9 +572,9 @@ void UT_os_mut_sem_get_info_test() res = OS_MutSemGetInfo(99999, &mut_sem_prop); if ( res == OS_ERR_INVALID_ID ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Invalid-pointer-arg"; @@ -610,15 +583,15 @@ void UT_os_mut_sem_get_info_test() if (res != OS_SUCCESS) { testDesc = "#2 Invalid-pointer-arg - Mutex Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_MutSemGetInfo(mut_sem_id, NULL); if ( res == OS_INVALID_POINTER ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); OS_MutSemDelete(mut_sem_id); } @@ -631,22 +604,22 @@ void UT_os_mut_sem_get_info_test() if ( res != OS_SUCCESS ) { testDesc = "#3 Nominal - Mutex Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_MutSemGetInfo(mut_sem_id, &mut_sem_prop); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); res = OS_MutSemDelete(mut_sem_id); } UT_os_mut_sem_get_info_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_MutSemGetInfo", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*================================================================================* diff --git a/src/unit-tests/oscore-test/ut_oscore_mutex_test.h b/src/unit-tests/oscore-test/ut_oscore_mutex_test.h index f641ee7b4..87e1a5c66 100644 --- a/src/unit-tests/oscore-test/ut_oscore_mutex_test.h +++ b/src/unit-tests/oscore-test/ut_oscore_mutex_test.h @@ -11,7 +11,7 @@ ** Includes **--------------------------------------------------------------------------------*/ -#include "ut_os_stubs.h" +#include "ut_os_support.h" /*--------------------------------------------------------------------------------* ** Macros diff --git a/src/unit-tests/oscore-test/ut_oscore_queue_test.c b/src/unit-tests/oscore-test/ut_oscore_queue_test.c index 90d262bb5..45abc6ac7 100644 --- a/src/unit-tests/oscore-test/ut_oscore_queue_test.c +++ b/src/unit-tests/oscore-test/ut_oscore_queue_test.c @@ -22,8 +22,6 @@ ** External global variables **--------------------------------------------------------------------------------*/ -extern UT_OsLogInfo_t g_logInfo; - /*--------------------------------------------------------------------------------* ** Global variables **--------------------------------------------------------------------------------*/ @@ -48,11 +46,7 @@ void UT_os_sample_test() /* Must declare these variables for each function. They can be renamed. * They're referenced in the macros used to track test cases and their results. */ int32 idx = 0; - UT_OsApiInfo_t apiInfo; - const char* testDesc = NULL; - - /* Call this once at the beginning of the function to initialize the test variables. */ - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------* * For each test case, @@ -74,7 +68,7 @@ void UT_os_sample_test() if (OS_xxx() == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_sample_test_exit_tag; } @@ -86,9 +80,9 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(NULL,...) == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* TODO: Reset the test environment here, if necessary */ @@ -98,9 +92,9 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(aVeryLoooooongName) == OS_ERR_NAME_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* TODO: Reset the test environment here, if necessary */ @@ -110,17 +104,15 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(...) != OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); /* TODO: Reset the test environment here, if necessary */ UT_os_sample_test_exit_tag: - /* Call these macros at the very end of the function to close out the test variables - * and get it added to the global list being tracked. */ - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_xxx", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } #endif @@ -138,47 +130,43 @@ void UT_os_sample_test() void UT_os_queue_create_test() { int i = 0; - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; uint32 queue_id = 0; uint32 queue_id2 = 0; - char queue_name[OS_MAX_API_NAME]; - char long_queue_name[OS_MAX_API_NAME+5]; + char queue_name[UT_OS_NAME_BUFF_SIZE]; + char long_queue_name[UT_OS_NAME_BUFF_SIZE]; uint32 test_setup_invalid = 0; - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - /*-----------------------------------------------------*/ testDesc = "API not implemented"; res = OS_QueueCreate(&queue_id, "Good", 10, 4, 0); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_queue_create_test_exit_tag; } /* Clean up */ - res = OS_QueueDelete(queue_id); + OS_QueueDelete(queue_id); /*-----------------------------------------------------*/ testDesc = "#1 Null-pointer-arg-1"; res = OS_QueueCreate(NULL, "Queue1", 10, 4, 0); if (res == OS_INVALID_POINTER) - /* cppcheck-suppress syntaxError */ - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Null-pointer-arg-2"; res = OS_QueueCreate(&queue_id, NULL, 10, 4, 0); if (res == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Name-too-long"; @@ -187,9 +175,9 @@ void UT_os_queue_create_test() long_queue_name[sizeof(long_queue_name)-1] = '\0'; res = OS_QueueCreate(&queue_id, long_queue_name, 10, 4, 0); if (res == OS_ERR_NAME_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#4 No-free-IDs"; @@ -203,7 +191,7 @@ void UT_os_queue_create_test() if ( res != OS_SUCCESS ) { testDesc = "#4 No-free-IDs - Queue Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); test_setup_invalid = 1; break; } @@ -213,9 +201,9 @@ void UT_os_queue_create_test() { res = OS_QueueCreate(&queue_id, "OneTooMany", 10, 4, 0); if (res == OS_ERR_NO_FREE_IDS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } /* Reset test environment */ @@ -228,15 +216,15 @@ void UT_os_queue_create_test() res = OS_QueueCreate(&queue_id2, "DUPLICATE", 10, 4, 0); if ( res != OS_SUCCESS ) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, "Queue Create failed", UT_OS_TSF) + UT_OS_TEST_RESULT( "Queue Create failed", UTASSERT_CASETYPE_TSF); } else { res = OS_QueueCreate(&queue_id, "DUPLICATE", 10, 4, 0); if (res == OS_ERR_NAME_TAKEN) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ res = OS_QueueDelete(queue_id2); @@ -245,23 +233,23 @@ void UT_os_queue_create_test() /*-----------------------------------------------------*/ testDesc = "#6 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#7 Nominal"; res = OS_QueueCreate(&queue_id, "Good", 10, 4, 0); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ res = OS_QueueDelete(queue_id); UT_os_queue_create_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_QueueCreate", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -274,20 +262,17 @@ void UT_os_queue_create_test() **--------------------------------------------------------------------------------*/ void UT_os_queue_delete_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; uint32 queue_id; - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - /*-----------------------------------------------------*/ testDesc = "API not implemented"; res = OS_QueueDelete(0); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_queue_delete_test_exit_tag; } @@ -296,14 +281,14 @@ void UT_os_queue_delete_test() res = OS_QueueDelete(99999); if ( res == OS_ERR_INVALID_ID ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#3 Nominal"; @@ -313,20 +298,20 @@ void UT_os_queue_delete_test() if ( res != OS_SUCCESS ) { testDesc = "#3 Nominal - Queue Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_QueueDelete(queue_id); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } UT_os_queue_delete_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_QueueDelete", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -342,24 +327,21 @@ void UT_os_queue_delete_test() **--------------------------------------------------------------------------------*/ void UT_os_queue_get_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; uint32 queue_id; uint32 queue_data_out; uint32 queue_data_in; uint32 size_copied; uint32 data_size; - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - /*-----------------------------------------------------*/ testDesc = "API not implemented"; res = OS_QueueGet(0, (void *)&queue_data_in, 4, &size_copied, OS_CHECK); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_queue_get_test_exit_tag; } @@ -368,9 +350,9 @@ void UT_os_queue_get_test() res = OS_QueueGet(99999, (void *)&queue_data_in, 4, &size_copied, OS_CHECK); if ( res == OS_ERR_INVALID_ID ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Invalid-pointer-arg-1"; @@ -380,15 +362,15 @@ void UT_os_queue_get_test() if ( res != OS_SUCCESS ) { testDesc = "#2 Invalid-pointer-arg-1 - Queue Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_QueueGet(queue_id, NULL, 4, &size_copied, OS_CHECK); if ( res == OS_INVALID_POINTER ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); res = OS_QueueDelete(queue_id); } @@ -401,15 +383,15 @@ void UT_os_queue_get_test() if ( res != OS_SUCCESS ) { testDesc = "#3 Invalid-pointer-arg-2 - Queue Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_QueueGet(queue_id, (void *)&queue_data_in, 4, NULL, OS_CHECK); if ( res == OS_INVALID_POINTER ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); res = OS_QueueDelete(queue_id); } @@ -422,15 +404,15 @@ void UT_os_queue_get_test() if ( res != OS_SUCCESS ) { testDesc = "#4 Queue-empty - Queue Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_QueueGet(queue_id, (void *)&queue_data_in, 4, &data_size, OS_CHECK); if ( res == OS_QUEUE_EMPTY ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); res = OS_QueueDelete(queue_id); } @@ -443,15 +425,15 @@ void UT_os_queue_get_test() if ( res != OS_SUCCESS ) { testDesc = "#5 Queue-timed-out - Queue Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_QueueGet(queue_id, (void *)&queue_data_in, 4, &data_size, 2); if ( res == OS_QUEUE_TIMEOUT ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); res = OS_QueueDelete(queue_id); } @@ -464,7 +446,7 @@ void UT_os_queue_get_test() if ( res != OS_SUCCESS ) { testDesc = "#6 Invalid-queue-size - Queue Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { @@ -473,15 +455,15 @@ void UT_os_queue_get_test() if ( res != OS_SUCCESS ) { testDesc = "#6 Invalid-queue-size - Queue Put failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_QueueGet(queue_id, (void *)&queue_data_in, 3, &data_size, OS_CHECK); if ( res == OS_QUEUE_INVALID_SIZE ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } res = OS_QueueDelete(queue_id); } @@ -489,7 +471,7 @@ void UT_os_queue_get_test() /*-----------------------------------------------------*/ testDesc = "#7 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#8 Nominal Pend"; @@ -499,7 +481,7 @@ void UT_os_queue_get_test() if ( res != OS_SUCCESS ) { testDesc = "#8 Nominal Pend - Queue Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { @@ -508,15 +490,15 @@ void UT_os_queue_get_test() if ( res != OS_SUCCESS ) { testDesc = "#8 Nominal Pend - Queue Put failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_QueueGet(queue_id, (void *)&queue_data_in, 4, &data_size, OS_PEND); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } res = OS_QueueDelete(queue_id); } @@ -529,7 +511,7 @@ void UT_os_queue_get_test() if ( res != OS_SUCCESS ) { testDesc = "#9 Nominal timeout - Queue Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { @@ -538,15 +520,15 @@ void UT_os_queue_get_test() if ( res != OS_SUCCESS ) { testDesc = "#9 Nominal timeout - Queue Put failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_QueueGet(queue_id, (void *)&queue_data_in, 4, &data_size, 20); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } res = OS_QueueDelete(queue_id); } @@ -559,7 +541,7 @@ void UT_os_queue_get_test() if ( res != OS_SUCCESS ) { testDesc = "#10 Nominal check - Queue Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { @@ -568,22 +550,22 @@ void UT_os_queue_get_test() if ( res != OS_SUCCESS ) { testDesc = "#10 Nominal check - Queue Put failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_QueueGet(queue_id, (void *)&queue_data_in, 4, &data_size, OS_CHECK); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } res = OS_QueueDelete(queue_id); } UT_os_queue_get_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_QueueGet", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -598,22 +580,19 @@ void UT_os_queue_get_test() **--------------------------------------------------------------------------------*/ void UT_os_queue_put_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; uint32 queue_id; uint32 queue_data_out = 0; int i; - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - /*-----------------------------------------------------*/ testDesc = "API not implemented"; res = OS_QueuePut(0, (void *)&queue_data_out, 4, 0); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_queue_put_test_exit_tag; } @@ -622,9 +601,9 @@ void UT_os_queue_put_test() res = OS_QueuePut(99999, (void *)&queue_data_out, 4, 0); if ( res == OS_ERR_INVALID_ID ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Invalid-pointer-arg"; @@ -634,22 +613,22 @@ void UT_os_queue_put_test() if ( res != OS_SUCCESS ) { testDesc = "#2 Invalid-pointer-arg - Queue Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_QueuePut(queue_id, NULL, 4, 0); if ( res == OS_INVALID_POINTER ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); res = OS_QueueDelete(queue_id); } /*-----------------------------------------------------*/ testDesc = "#3 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#4 Queue-full"; @@ -659,7 +638,7 @@ void UT_os_queue_put_test() if ( res != OS_SUCCESS ) { testDesc = "#4 Queue-full - Queue Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { @@ -672,9 +651,9 @@ void UT_os_queue_put_test() } if ( res == OS_QUEUE_FULL ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); res = OS_QueueDelete(queue_id); } @@ -687,22 +666,22 @@ void UT_os_queue_put_test() if ( res != OS_SUCCESS ) { testDesc = "#5 Nominal - Queue Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { queue_data_out = 0x11223344; res = OS_QueuePut(queue_id, (void *)&queue_data_out, 4, 0); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); res = OS_QueueDelete(queue_id); } UT_os_queue_put_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_QueuePut", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -716,13 +695,10 @@ void UT_os_queue_put_test() **--------------------------------------------------------------------------------*/ void UT_os_queue_get_id_by_name_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; uint32 queue_id; - char long_queue_name[OS_MAX_API_NAME+5]; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + char long_queue_name[UT_OS_NAME_BUFF_SIZE]; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -730,7 +706,7 @@ void UT_os_queue_get_id_by_name_test() res = OS_QueueGetIdByName(0, "InvalidName"); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_queue_get_id_by_name_test_exit_tag; } @@ -739,18 +715,18 @@ void UT_os_queue_get_id_by_name_test() res = OS_QueueGetIdByName(NULL, "InvalidName"); if ( res == OS_INVALID_POINTER ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Invalid-pointer-arg-2"; res = OS_QueueGetIdByName(&queue_id, NULL); if ( res == OS_INVALID_POINTER ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Name-too-long"; @@ -759,18 +735,18 @@ void UT_os_queue_get_id_by_name_test() long_queue_name[sizeof(long_queue_name)-1] = '\0'; res = OS_QueueGetIdByName(&queue_id, long_queue_name); if ( res == OS_ERR_NAME_TOO_LONG ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#4 Name-not-found"; res = OS_QueueGetIdByName(&queue_id, "NameNotFound"); if ( res == OS_ERR_NAME_NOT_FOUND ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#5 Nominal"; @@ -780,22 +756,22 @@ void UT_os_queue_get_id_by_name_test() if ( res != OS_SUCCESS ) { testDesc = "#5 Nominal - Queue Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_QueueGetIdByName(&queue_id, "GetIDByName"); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); res = OS_QueueDelete(queue_id); } UT_os_queue_get_id_by_name_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_QueueGetIdByName", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -808,21 +784,18 @@ void UT_os_queue_get_id_by_name_test() **--------------------------------------------------------------------------------*/ void UT_os_queue_get_info_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; uint32 queue_id; OS_queue_prop_t queue_prop; - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - /*-----------------------------------------------------*/ testDesc = "API not implemented"; res = OS_QueueGetInfo(0,&queue_prop); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_queue_get_info_test_exit_tag; } @@ -831,9 +804,9 @@ void UT_os_queue_get_info_test() res = OS_QueueGetInfo(99999, &queue_prop); if ( res == OS_ERR_INVALID_ID ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Invalid-pointer-arg"; @@ -843,15 +816,15 @@ void UT_os_queue_get_info_test() if ( res != OS_SUCCESS ) { testDesc = "#2 Invalid-pointer-arg - Queue Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_QueueGetInfo(queue_id, NULL); if ( res == OS_INVALID_POINTER ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); res = OS_QueueDelete(queue_id); } @@ -864,22 +837,22 @@ void UT_os_queue_get_info_test() if ( res != OS_SUCCESS ) { testDesc = "#3 Nominal - Queue Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_QueueGetInfo(queue_id, &queue_prop); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); res = OS_QueueDelete(queue_id); } UT_os_queue_get_info_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_QueueGetInfo", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*================================================================================* diff --git a/src/unit-tests/oscore-test/ut_oscore_queue_test.h b/src/unit-tests/oscore-test/ut_oscore_queue_test.h index 29de42389..08525da97 100644 --- a/src/unit-tests/oscore-test/ut_oscore_queue_test.h +++ b/src/unit-tests/oscore-test/ut_oscore_queue_test.h @@ -11,7 +11,7 @@ ** Includes **--------------------------------------------------------------------------------*/ -#include "ut_os_stubs.h" +#include "ut_os_support.h" /*--------------------------------------------------------------------------------* ** Macros diff --git a/src/unit-tests/oscore-test/ut_oscore_task_test.c b/src/unit-tests/oscore-test/ut_oscore_task_test.c index 9a57ccd60..e8c9a1963 100644 --- a/src/unit-tests/oscore-test/ut_oscore_task_test.c +++ b/src/unit-tests/oscore-test/ut_oscore_task_test.c @@ -28,13 +28,8 @@ ** External global variables **--------------------------------------------------------------------------------*/ -extern UT_OsLogInfo_t g_logInfo; - -extern int32 g_skipTestCase; -extern char* g_skipTestCaseResult; - extern char* g_task_names[UT_OS_TASK_LIST_LEN]; -extern char g_long_task_name[OS_MAX_API_NAME+5]; +extern char g_long_task_name[UT_OS_NAME_BUFF_SIZE]; /*--------------------------------------------------------------------------------* ** Global variables @@ -65,11 +60,7 @@ void UT_os_sample_test() /* Must declare these variables for each function. They can be renamed. * They're referenced in the macros used to track test cases and their results. */ int32 idx = 0; - UT_OsApiInfo_t apiInfo; - const char* testDesc = NULL; - - /* Call this once at the beginning of the function to initialize the test variables. */ - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------* * For each test case, @@ -91,7 +82,7 @@ void UT_os_sample_test() if (OS_xxx() == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_sample_test_exit_tag; } @@ -103,9 +94,9 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(NULL,...) == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* TODO: Reset the test environment here, if necessary */ @@ -115,9 +106,9 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(aVeryLoooooongName) == OS_ERR_NAME_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* TODO: Reset the test environment here, if necessary */ @@ -127,17 +118,15 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(...) != OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); /* TODO: Reset the test environment here, if necessary */ UT_os_sample_test_exit_tag: - /* Call these macros at the very end of the function to close out the test variables - * and get it added to the global list being tracked. */ - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_xxx", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } #endif @@ -153,7 +142,7 @@ void generic_test_task(void) task_id = OS_TaskGetId(); OS_TaskGetInfo(task_id, &task_prop); - UT_OS_LOG_MACRO("Starting GenericTask: %s, id: %d\n", task_prop.name, (int)task_id); + UT_OS_LOG("Starting GenericTask: %s, id: %d\n", task_prop.name, (int)task_id); while (1) { @@ -175,12 +164,9 @@ void generic_test_task(void) **--------------------------------------------------------------------------------*/ void UT_os_task_create_test() { - UT_OsApiInfo_t apiInfo; - int32 i=0, res=0, idx=0; - const char* testDesc=NULL; - char task_name[UT_OS_SM_TEXT_LEN]; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + int32 i=0, res=0; + const char* testDesc; + char task_name[UT_OS_NAME_BUFF_SIZE]; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -189,7 +175,7 @@ void UT_os_task_create_test() UT_TASK_STACK_SIZE, UT_TASK_PRIORITY, 0); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_task_create_test_exit_tag; } @@ -197,7 +183,7 @@ void UT_os_task_create_test() OS_TaskDelay(200); /* Reset test environment */ - res = OS_TaskDelete(g_task_ids[0]); + OS_TaskDelete(g_task_ids[0]); /*-----------------------------------------------------*/ testDesc = "#1 Null-pointer-arg-1"; @@ -205,10 +191,9 @@ void UT_os_task_create_test() res = OS_TaskCreate(NULL, g_task_names[1], generic_test_task, g_task_stacks[1], UT_TASK_STACK_SIZE, UT_TASK_PRIORITY, 0); if (res == OS_INVALID_POINTER) - /* cppcheck-suppress syntaxError */ - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Null-pointer-arg-2"; @@ -216,9 +201,9 @@ void UT_os_task_create_test() res = OS_TaskCreate(&g_task_ids[2], NULL, generic_test_task, g_task_stacks[2], UT_TASK_STACK_SIZE, UT_TASK_PRIORITY, 0); if (res == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Null-pointer-arg-3"; @@ -226,9 +211,9 @@ void UT_os_task_create_test() res = OS_TaskCreate(&g_task_ids[3], g_task_names[3], NULL, g_task_stacks[3], UT_TASK_STACK_SIZE, UT_TASK_PRIORITY, 0); if (res == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#4 Name-too-long"; @@ -236,9 +221,9 @@ void UT_os_task_create_test() res = OS_TaskCreate(&g_task_ids[4], g_long_task_name, generic_test_task, g_task_stacks[4], UT_TASK_STACK_SIZE, UT_TASK_PRIORITY, 0); if (res == OS_ERR_NAME_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#5 Invalid-priority"; @@ -246,46 +231,38 @@ void UT_os_task_create_test() res = OS_TaskCreate(&g_task_ids[5], g_task_names[5], generic_test_task, g_task_stacks[5], UT_TASK_STACK_SIZE, MAX_PRIORITY+1, 0); if (res == OS_ERR_INVALID_PRIORITY) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#6 No-free-IDs"; - if (g_skipTestCase == 6) - { - testDesc = "#6 No-free-IDs - Test case not applicable on platform"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, g_skipTestCaseResult) - } - else + /* Setup */ + for (i=0; i <= OS_MAX_TASKS; i++) { - /* Setup */ - for (i=0; i <= OS_MAX_TASKS; i++) + memset(task_name, '\0', sizeof(task_name)); + UT_os_sprintf(task_name, "CREATE_TASK%d", (int)i); + res = OS_TaskCreate(&g_task_ids[i], task_name, generic_test_task, g_task_stacks[i], + UT_TASK_STACK_SIZE, UT_TASK_PRIORITY, 0); + if (res != OS_SUCCESS) { - memset(task_name, '\0', sizeof(task_name)); - UT_os_sprintf(task_name, "CREATE_TASK%d", (int)i); - res = OS_TaskCreate(&g_task_ids[i], task_name, generic_test_task, g_task_stacks[i], - UT_TASK_STACK_SIZE, UT_TASK_PRIORITY, 0); - if (res != OS_SUCCESS) - { - break; - } + break; } + } - if ((res == OS_ERR_NO_FREE_IDS) && (i == OS_MAX_TASKS)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) - else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + if ((res == OS_ERR_NO_FREE_IDS) && (i == OS_MAX_TASKS)) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); + else + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); - /* Delay to let child tasks run */ - OS_TaskDelay(500); + /* Delay to let child tasks run */ + OS_TaskDelay(500); - /* Reset test environment */ - for (i=0; i < OS_MAX_TASKS; i++) - { - res = OS_TaskDelete(g_task_ids[i]); /* Ignore errors, does not matter here */ - } + /* Reset test environment */ + for (i=0; i < OS_MAX_TASKS; i++) + { + res = OS_TaskDelete(g_task_ids[i]); /* Ignore errors, does not matter here */ } /*-----------------------------------------------------*/ @@ -297,16 +274,16 @@ void UT_os_task_create_test() if (res != OS_SUCCESS) { testDesc = "#7 Duplicate-name - Task-Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_TaskCreate(&g_task_ids[8], g_task_names[7], generic_test_task, g_task_stacks[8], UT_TASK_STACK_SIZE, UT_TASK_PRIORITY, 0); if (res == OS_ERR_NAME_TAKEN) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Delay to let child task run */ OS_TaskDelay(200); @@ -318,7 +295,7 @@ void UT_os_task_create_test() /*-----------------------------------------------------*/ testDesc = "#8 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#9 Nominal"; @@ -326,9 +303,9 @@ void UT_os_task_create_test() res = OS_TaskCreate(&g_task_ids[9], g_task_names[9], generic_test_task, g_task_stacks[9], UT_TASK_STACK_SIZE, UT_TASK_PRIORITY, 0); if (res == OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Delay to let child task run */ OS_TaskDelay(200); @@ -337,8 +314,8 @@ void UT_os_task_create_test() res = OS_TaskDelete(g_task_ids[9]); UT_os_task_create_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_TaskCreate", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -351,11 +328,8 @@ void UT_os_task_create_test() **--------------------------------------------------------------------------------*/ void UT_os_task_delete_test() { - int32 res=0, idx=0; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + int32 res=0; + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -363,7 +337,7 @@ void UT_os_task_delete_test() res = OS_TaskDelete(99999); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_task_delete_test_exit_tag; } @@ -372,14 +346,14 @@ void UT_os_task_delete_test() res = OS_TaskDelete(99999); if ( res == OS_ERR_INVALID_ID ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#3 Nominal"; @@ -390,7 +364,7 @@ void UT_os_task_delete_test() if (res != OS_SUCCESS) { testDesc = "#3 Nominal - Task-Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { @@ -399,14 +373,14 @@ void UT_os_task_delete_test() res = OS_TaskDelete(g_task_ids[3]); if (res == OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } UT_os_task_delete_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_TaskDelete", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -418,7 +392,7 @@ void UT_os_task_delete_test() **--------------------------------------------------------------------------------*/ void delete_handler_callback(void) { - UT_OS_LOG_MACRO("Task delete callback...\n") + UT_OS_LOG("Task delete callback...\n"); } /*--------------------------------------------------------------------------------*/ @@ -427,15 +401,13 @@ void delete_handler_test_task(void) { int32 task_id=0; OS_task_prop_t task_prop; - char text[UT_OS_MD_TEXT_LEN]; OS_TaskRegister(); task_id = OS_TaskGetId(); OS_TaskGetInfo(task_id, &task_prop); - memset(text, '\0', sizeof(text)); - UT_OS_LOG_MACRO("Starting DeleteTest Task: %s, id: %d\n", task_prop.name, (int)task_id); + UT_OS_LOG("Starting DeleteTest Task: %s, id: %d\n", task_prop.name, (int)task_id); g_task_result = OS_TaskInstallDeleteHandler(&delete_handler_callback); @@ -455,11 +427,8 @@ void delete_handler_test_task(void) void UT_os_task_install_delete_handler_test(void) { - int32 res=0, idx=0; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + int32 res=0; + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -467,30 +436,22 @@ void UT_os_task_install_delete_handler_test(void) res = OS_TaskInstallDeleteHandler(&delete_handler_callback); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_task_install_delete_handler_test_exit_tag; } /*-----------------------------------------------------*/ testDesc = "#1 Invalid-ID-arg"; - if (g_skipTestCase == 1) - { - testDesc = "#1 Invalid-ID-arg - Test case not applicable on platform"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, g_skipTestCaseResult) - } + /* + ** This test works because it is being called from the main task + ** which should not be an official OSAL task + */ + res = OS_TaskInstallDeleteHandler(&delete_handler_callback); + if ( res == OS_ERR_INVALID_ID ) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - { - /* - ** This test works because it is being called from the main task - ** which should not be an official OSAL task - */ - res = OS_TaskInstallDeleteHandler(&delete_handler_callback); - if ( res == OS_ERR_INVALID_ID ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) - else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) - } + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Nominal"; @@ -500,40 +461,40 @@ void UT_os_task_install_delete_handler_test(void) if (res != OS_SUCCESS) { testDesc = "#2 Nominal - Bin-Sem-Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { - res = OS_BinSemTake(g_task_sync_sem); + OS_BinSemTake(g_task_sync_sem); res = OS_TaskCreate(&g_task_ids[2], g_task_names[2], delete_handler_test_task, g_task_stacks[2], UT_TASK_STACK_SIZE, UT_TASK_PRIORITY, 0); if (res != OS_SUCCESS) { testDesc = "#2 Nominal - Task-Create-failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { /* Wait for the task to finish the test */ - res = OS_BinSemTake(g_task_sync_sem); + OS_BinSemTake(g_task_sync_sem); /* Delay to let child task run */ OS_TaskDelay(500); res = OS_TaskDelete(g_task_ids[2]); if (g_task_result == OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } res = OS_BinSemDelete(g_task_sync_sem); } UT_os_task_install_delete_handler_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_TaskInstallDeleteHandler", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -552,7 +513,7 @@ void exit_test_task(void) task_id = OS_TaskGetId(); OS_TaskGetInfo(task_id, &task_prop); - UT_OS_LOG_MACRO("Starting ExitTest Task: %s, id: %d\n", task_prop.name, (int)task_id); + UT_OS_LOG("Starting ExitTest Task: %s, id: %d\n", task_prop.name, (int)task_id);; /* ** The parent task will check to see if this task is valid. @@ -571,12 +532,9 @@ void exit_test_task(void) void UT_os_task_exit_test(void) { - int32 res=0, idx=0; - UT_OsApiInfo_t apiInfo; + int32 res=0; OS_task_prop_t task_prop; - const char* testDesc = NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "#1 Nominal"; @@ -586,23 +544,23 @@ void UT_os_task_exit_test(void) if (res != OS_SUCCESS) { testDesc = "#1 Nominal - Bin-Sem-Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { - res = OS_BinSemTake(g_task_sync_sem); + OS_BinSemTake(g_task_sync_sem); res = OS_TaskCreate(&g_task_ids[1], g_task_names[1], exit_test_task, g_task_stacks[1], UT_TASK_STACK_SIZE, UT_TASK_PRIORITY, 0); if (res != OS_SUCCESS) { testDesc = "#1 Nominal - Task-Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { /* Wait for the task to finish the test */ - res = OS_BinSemTake(g_task_sync_sem); + OS_BinSemTake(g_task_sync_sem); /* Delay to let the child task run */ OS_TaskDelay(500); @@ -612,18 +570,18 @@ void UT_os_task_exit_test(void) */ res = OS_TaskGetInfo(g_task_ids[1], &task_prop); if (res == OS_ERR_INVALID_ID) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); - res = OS_TaskDelete(g_task_ids[1]); /* Won't hurt if its already deleted */ + OS_TaskDelete(g_task_ids[1]); /* Won't hurt if its already deleted */ } - res = OS_BinSemDelete(g_task_sync_sem); + OS_BinSemDelete(g_task_sync_sem); } - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_TaskExit", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -635,11 +593,8 @@ void UT_os_task_exit_test(void) **--------------------------------------------------------------------------------*/ void UT_os_task_delay_test() { - int32 res=0, idx=0; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + int32 res=0; + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -647,27 +602,27 @@ void UT_os_task_delay_test() res = OS_TaskDelay(100); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_task_delay_test_exit_tag; } /*-----------------------------------------------------*/ testDesc = "#1 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#2 Nominal"; res = OS_TaskDelay(100); if (res == OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); UT_os_task_delay_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_TaskDelay", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -681,11 +636,8 @@ void UT_os_task_delay_test() **--------------------------------------------------------------------------------*/ void UT_os_task_set_priority_test() { - int32 res=0, idx=0; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + int32 res=0; + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -695,7 +647,7 @@ void UT_os_task_set_priority_test() if (res != OS_SUCCESS) { testDesc = "#0 API not implemented - Task-Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_task_set_priority_test_exit_tag; } else @@ -703,7 +655,7 @@ void UT_os_task_set_priority_test() res = OS_TaskSetPriority(g_task_ids[0], UT_TASK_PRIORITY); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_task_set_priority_test_exit_tag; } @@ -719,9 +671,9 @@ void UT_os_task_set_priority_test() res = OS_TaskSetPriority(99999, 100); if (res == OS_ERR_INVALID_ID) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Invalid-priority"; @@ -731,15 +683,15 @@ void UT_os_task_set_priority_test() if (res != OS_SUCCESS) { testDesc = "#2 Invalid-priority - Task-Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_TaskSetPriority(g_task_ids[2], MAX_PRIORITY+1); if (res == OS_ERR_INVALID_PRIORITY) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Delay to let child task run */ OS_TaskDelay(500); @@ -751,7 +703,7 @@ void UT_os_task_set_priority_test() /*-----------------------------------------------------*/ testDesc = "#3 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#4 Nominal"; @@ -761,27 +713,27 @@ void UT_os_task_set_priority_test() if (res != OS_SUCCESS) { testDesc = "#4 Nominal - Task-Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_TaskSetPriority(g_task_ids[4], UT_TASK_PRIORITY-10); if (res == OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Delay to let child task run */ OS_TaskDelay(500); /* Reset test environment */ - res = OS_TaskSetPriority(g_task_ids[4], UT_TASK_PRIORITY); - res = OS_TaskDelete(g_task_ids[4]); + OS_TaskSetPriority(g_task_ids[4], UT_TASK_PRIORITY); + OS_TaskDelete(g_task_ids[4]); } UT_os_task_set_priority_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_TaskSetPriority", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -796,15 +748,13 @@ void register_test_task(void) { int32 task_id=0; OS_task_prop_t task_prop; - char text[UT_OS_MD_TEXT_LEN]; g_task_result = OS_TaskRegister(); task_id = OS_TaskGetId(); OS_TaskGetInfo(task_id, &task_prop); - memset(text, '\0', sizeof(text)); - UT_OS_LOG_MACRO("Starting RegisterTest Task: %s\n", task_prop.name); + UT_OS_LOG("Starting RegisterTest Task: %s\n", task_prop.name);; /* ** Release the semaphore so the main function can record the results of the test @@ -822,11 +772,8 @@ void register_test_task(void) void UT_os_task_register_test(void) { - int32 res=0, idx=0; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + int32 res=0; + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -834,31 +781,23 @@ void UT_os_task_register_test(void) res = OS_TaskRegister(); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_task_register_test_exit_tag; } /*-----------------------------------------------------*/ testDesc = "#1 Invalid-ID-arg"; - if (g_skipTestCase == 1) - { - testDesc = "#1 Invalid-ID-arg - Test case not applicable on platform"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, g_skipTestCaseResult) - } + res = OS_TaskRegister(); + if (res == OS_ERR_INVALID_ID) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - { - res = OS_TaskRegister(); - if (res == OS_ERR_INVALID_ID) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) - else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) - } + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#3 Nominal"; @@ -868,39 +807,39 @@ void UT_os_task_register_test(void) if (res != OS_SUCCESS) { testDesc = "#3 Nominal - Bin-Sem-Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { - res = OS_BinSemTake(g_task_sync_sem); + OS_BinSemTake(g_task_sync_sem); res = OS_TaskCreate(&g_task_ids[3], g_task_names[3], register_test_task, g_task_stacks[3], UT_TASK_STACK_SIZE, UT_TASK_PRIORITY, 0); if ( res != OS_SUCCESS ) { testDesc = "#3 Nominal - Task-Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { /* Wait for the task to finish the test */ - res = OS_BinSemTake(g_task_sync_sem); + OS_BinSemTake(g_task_sync_sem); /* Delay to let child task run */ OS_TaskDelay(500); - res = OS_TaskDelete(g_task_ids[3]); + OS_TaskDelete(g_task_ids[3]); res = OS_BinSemDelete(g_task_sync_sem); if (g_task_result == OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } } UT_os_task_register_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_TaskRegister", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------*/ @@ -909,15 +848,13 @@ void getid_test_task(void) { int32 task_id=0; OS_task_prop_t task_prop; - char text[UT_OS_LG_TEXT_LEN]; OS_TaskRegister(); task_id = OS_TaskGetId(); OS_TaskGetInfo(task_id, &task_prop); - memset(text, '\0', sizeof(text)); - UT_OS_LOG_MACRO("OS_TaskGetId() - #1 Nominal [This is the returned task Id=%d]\n", + UT_OS_LOG("OS_TaskGetId() - #1 Nominal [This is the returned task Id=%d]\n", (int)task_id); while (1) @@ -934,11 +871,8 @@ void getid_test_task(void) **--------------------------------------------------------------------------------*/ void UT_os_task_get_id_test() { - int32 res=0, idx=0; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + int32 res=0; + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -946,7 +880,7 @@ void UT_os_task_get_id_test() res = OS_TaskGetId(); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_task_get_id_test_exit_tag; } @@ -959,23 +893,23 @@ void UT_os_task_get_id_test() if (res != OS_SUCCESS) { testDesc = "#1 Nominal - Task-Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { OS_TaskDelay(500); - UT_OS_LOG_MACRO("OS_TaskGetId() - #1 Nominal [This is the expected task Id=%d]\n", + UT_OS_LOG("OS_TaskGetId() - #1 Nominal [This is the expected task Id=%d]\n", (int)g_task_ids[1]); res = OS_TaskDelete(g_task_ids[1]); /* Won't hurt if its already deleted */ - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, "#1 Nominal - Manual inspection required", UT_OS_MIR) + UT_OS_TEST_RESULT( "#1 Nominal - Manual inspection required", UTASSERT_CASETYPE_MIR); } UT_os_task_get_id_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_TaskGetId", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -989,11 +923,8 @@ void UT_os_task_get_id_test() **--------------------------------------------------------------------------------*/ void UT_os_task_get_id_by_name_test() { - int32 res=0, idx=0; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + int32 res=0; + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -1001,7 +932,7 @@ void UT_os_task_get_id_by_name_test() res = OS_TaskGetIdByName(0, "InvalidName"); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_task_get_id_by_name_test_exit_tag; } @@ -1010,36 +941,36 @@ void UT_os_task_get_id_by_name_test() res = OS_TaskGetIdByName(NULL, "InvalidName"); if (res == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Invalid-pointer-arg-2"; res = OS_TaskGetIdByName(&g_task_ids[2], NULL); if (res == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Name-too-long"; res = OS_TaskGetIdByName(&g_task_ids[3], g_long_task_name); if (res == OS_ERR_NAME_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#4 Name-not-found"; res = OS_TaskGetIdByName(&g_task_ids[4], "NameNotFound"); if ( res == OS_ERR_NAME_NOT_FOUND ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#5 Nominal"; @@ -1050,23 +981,23 @@ void UT_os_task_get_id_by_name_test() if (res != OS_SUCCESS) { testDesc = "#5 Nominal - Task-Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_TaskGetIdByName(&g_task_ids[6], g_task_names[5]); if ((res == OS_SUCCESS) && (g_task_ids[5] == g_task_ids[6])) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); OS_TaskDelay(500); /* Delay to let task run */ res = OS_TaskDelete(g_task_ids[5]); } UT_os_task_get_id_by_name_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_TaskGetIdByName", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -1079,12 +1010,9 @@ void UT_os_task_get_id_by_name_test() **--------------------------------------------------------------------------------*/ void UT_os_task_get_info_test() { - int32 res=0, idx=0; - UT_OsApiInfo_t apiInfo; + int32 res=0; OS_task_prop_t task_prop; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -1092,7 +1020,7 @@ void UT_os_task_get_info_test() res = OS_TaskGetInfo(99999, &task_prop); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_task_get_info_test_exit_tag; } @@ -1101,9 +1029,9 @@ void UT_os_task_get_info_test() res = OS_TaskGetInfo(99999, &task_prop); if (res == OS_ERR_INVALID_ID) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Invalid-pointer-arg"; @@ -1114,15 +1042,15 @@ void UT_os_task_get_info_test() if (res != OS_SUCCESS) { testDesc = "#2 Invalid-pointer-arg - Task-Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_TaskGetInfo(g_task_ids[2], NULL); if (res == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Delay to let child task run */ OS_TaskDelay(500); @@ -1140,15 +1068,15 @@ void UT_os_task_get_info_test() if (res != OS_SUCCESS) { testDesc = "#3 Nominal - Task-Create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_TaskGetInfo(g_task_ids[3], &task_prop); if (res == OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Delay to let child task run */ OS_TaskDelay(500); @@ -1158,8 +1086,8 @@ void UT_os_task_get_info_test() } UT_os_task_get_info_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_TaskGetInfo", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*================================================================================* diff --git a/src/unit-tests/oscore-test/ut_oscore_task_test.h b/src/unit-tests/oscore-test/ut_oscore_task_test.h index 34ba14dab..660ed4f80 100644 --- a/src/unit-tests/oscore-test/ut_oscore_task_test.h +++ b/src/unit-tests/oscore-test/ut_oscore_task_test.h @@ -11,7 +11,7 @@ ** Includes **--------------------------------------------------------------------------------*/ -#include "ut_os_stubs.h" +#include "ut_os_support.h" /*--------------------------------------------------------------------------------* ** Macros diff --git a/src/unit-tests/oscore-test/ut_oscore_test.c b/src/unit-tests/oscore-test/ut_oscore_test.c index 6961a7930..e9a4aedcd 100644 --- a/src/unit-tests/oscore-test/ut_oscore_test.c +++ b/src/unit-tests/oscore-test/ut_oscore_test.c @@ -22,17 +22,12 @@ ** External global variables **--------------------------------------------------------------------------------*/ -extern UT_OsLogInfo_t g_logInfo; - /*--------------------------------------------------------------------------------* ** Global variables **--------------------------------------------------------------------------------*/ -int32 g_skipTestCase = -1; -const char* g_skipTestCaseResult = " "; - const char* g_task_names[UT_OS_TASK_LIST_LEN]; -char g_long_task_name[OS_MAX_API_NAME+5]; +char g_long_task_name[UT_OS_NAME_BUFF_SIZE]; /*--------------------------------------------------------------------------------* ** External function prototypes @@ -173,99 +168,119 @@ void UT_os_init_task_get_info_test() void OS_Application_Startup(void) { - UT_os_setup(UT_OS_LOG_FILENAME); - - /* UT_OS_LOG_OFF, UT_OS_LOG_MINIMAL, UT_OS_LOG_MODERATE, UT_OS_LOG_EVERYTHING */ - UT_os_set_log_verbose(UT_OS_LOG_EVERYTHING); - - UT_OS_LOG_MACRO("OSAL Unit Test Output File for oscore APIs\n") - - UT_os_apiinit_test(); - - UT_OS_LOG_MACRO("\n============================================\n") - UT_os_printf_test(); - UT_os_printfenable_test(); - UT_os_printfdisable_test(); - UT_OS_LOG_MACRO("============================================\n") - - UT_os_bin_sem_create_test(); - UT_os_bin_sem_delete_test(); - UT_os_bin_sem_flush_test(); - UT_os_bin_sem_give_test(); - UT_os_bin_sem_take_test(); - UT_os_bin_sem_timed_wait_test(); - UT_os_bin_sem_get_id_by_name_test(); - UT_os_bin_sem_get_info_test(); - - UT_os_count_sem_create_test(); - UT_os_count_sem_delete_test(); - UT_os_count_sem_give_test(); - UT_os_count_sem_take_test(); - UT_os_count_sem_timed_wait_test(); - UT_os_count_sem_get_id_by_name_test(); - UT_os_count_sem_get_info_test(); - - UT_os_mut_sem_create_test(); - UT_os_mut_sem_delete_test(); - UT_os_mut_sem_give_test(); - UT_os_mut_sem_take_test(); - UT_os_mut_sem_get_id_by_name_test(); - UT_os_mut_sem_get_info_test(); - - UT_os_queue_create_test(); - UT_os_queue_delete_test(); - UT_os_queue_put_test(); - UT_os_queue_get_test(); - UT_os_queue_get_id_by_name_test(); - UT_os_queue_get_info_test(); - - UT_os_init_task_misc(); - - UT_os_init_task_create_test(); - UT_os_task_create_test(); - - UT_os_init_task_delete_test(); - UT_os_task_delete_test(); - - UT_os_setup_install_delete_handler_test(); - UT_os_task_install_delete_handler_test(); - - UT_os_init_task_exit_test(); - UT_os_task_exit_test(); - - UT_os_init_task_delay_test(); - UT_os_task_delay_test(); - - UT_os_init_task_set_priority_test(); - UT_os_task_set_priority_test(); - - UT_os_init_task_register_test(); - UT_os_task_register_test(); - - UT_os_init_task_get_id_test(); - UT_OS_LOG_MACRO("\n============================================\n") - UT_os_task_get_id_test(); - UT_OS_LOG_MACRO("============================================\n") - - UT_os_init_task_get_id_by_name_test(); - UT_os_task_get_id_by_name_test(); - - UT_os_init_task_get_info_test(); - UT_os_task_get_info_test(); - - UT_os_geterrorname_test(); - - UT_os_tick2micros_test(); - UT_os_milli2ticks_test(); - - UT_OS_LOG_MACRO("\n============================================") - UT_os_getlocaltime_test(); - UT_OS_LOG_MACRO("============================================\n") - UT_os_setlocaltime_test(); + UtTest_Add(UT_os_apiinit_test, NULL, NULL, "OS_API_Init"); + + UtTest_Add(UT_os_printf_test, NULL, NULL, "OS_printf"); + UtTest_Add(UT_os_printfenable_test, NULL, NULL, "OS_printf_enable"); + UtTest_Add(UT_os_printfdisable_test, NULL, NULL, "OS_printf_disable"); + + UtTest_Add(UT_os_bin_sem_create_test, NULL, NULL, "OS_BinSemCreate"); + UtTest_Add(UT_os_bin_sem_delete_test, NULL, NULL, "OS_BinSemDelete"); + UtTest_Add(UT_os_bin_sem_flush_test, NULL, NULL, "OS_BinSemFlush"); + UtTest_Add(UT_os_bin_sem_give_test, NULL, NULL, "OS_BinSemGive"); + UtTest_Add(UT_os_bin_sem_take_test, NULL, NULL, "OS_BinSemTake"); + UtTest_Add(UT_os_bin_sem_timed_wait_test, NULL, NULL, "OS_BinSemTimedWait"); + UtTest_Add(UT_os_bin_sem_get_id_by_name_test, NULL, NULL, "OS_BinSemGetIdByName"); + UtTest_Add(UT_os_bin_sem_get_info_test, NULL, NULL, "OS_BinSemGetInfo"); + + UtTest_Add(UT_os_count_sem_create_test, NULL, NULL, "OS_CountSemCreate"); + UtTest_Add(UT_os_count_sem_delete_test, NULL, NULL, "OS_CountSemDelete"); + UtTest_Add(UT_os_count_sem_give_test, NULL, NULL, "OS_CountSemGive"); + UtTest_Add(UT_os_count_sem_take_test, NULL, NULL, "OS_CountSemTake"); + UtTest_Add(UT_os_count_sem_timed_wait_test, NULL, NULL, "OS_CountSemTimedWait"); + UtTest_Add(UT_os_count_sem_get_id_by_name_test, NULL, NULL, "OS_CountSemGetIdByName"); + UtTest_Add(UT_os_count_sem_get_info_test, NULL, NULL, "OS_CountSemGetInfo"); + + UtTest_Add(UT_os_mut_sem_create_test, NULL, NULL, "OS_MutSemCreate"); + UtTest_Add(UT_os_mut_sem_delete_test, NULL, NULL, "OS_MutSemDelete"); + UtTest_Add(UT_os_mut_sem_give_test, NULL, NULL, "OS_MutSemGive"); + UtTest_Add(UT_os_mut_sem_take_test, NULL, NULL, "OS_MutSemTake"); + UtTest_Add(UT_os_mut_sem_get_id_by_name_test, NULL, NULL, "OS_MutSemGetIdByName"); + UtTest_Add(UT_os_mut_sem_get_info_test, NULL, NULL, "OS_MutSemGetInfo"); + + UtTest_Add(UT_os_queue_create_test, NULL, NULL, "OS_QueueCreate"); + UtTest_Add(UT_os_queue_delete_test, NULL, NULL, "OS_QueueDelete"); + UtTest_Add(UT_os_queue_put_test, NULL, NULL, "OS_QueuePut"); + UtTest_Add(UT_os_queue_get_test, NULL, NULL, "OS_QueueGet"); + UtTest_Add(UT_os_queue_get_id_by_name_test, NULL, NULL, "OS_QueueGetIdByName"); + UtTest_Add(UT_os_queue_get_info_test, NULL, NULL, "OS_QueueGetInfo"); + + UtTest_Add( + NULL, + UT_os_init_task_misc, + NULL, + "UT_os_init_task_misc"); + UtTest_Add( + UT_os_task_create_test, + UT_os_init_task_create_test, + NULL, + "OS_TaskCreate"); + UtTest_Add( + UT_os_task_delete_test, + UT_os_init_task_delete_test, + NULL, + "OS_TaskDelete"); + UtTest_Add( + UT_os_task_install_delete_handler_test, + UT_os_setup_install_delete_handler_test, + NULL, + "OS_TaskInstallDeleteHandler"); + UtTest_Add( + UT_os_task_exit_test, + UT_os_init_task_exit_test, + NULL, + "OS_TaskExit"); + UtTest_Add( + UT_os_task_delay_test, + UT_os_init_task_delay_test, + NULL, + "OS_TaskDelay"); + UtTest_Add( + UT_os_task_set_priority_test, + UT_os_init_task_set_priority_test, + NULL, + "OS_TaskSetPriority"); + UtTest_Add( + UT_os_task_register_test, + UT_os_init_task_register_test, + NULL, + "OS_TaskRegister"); + UtTest_Add( + UT_os_task_get_id_test, + UT_os_init_task_get_id_test, + NULL, + "OS_TaskGetId"); + UtTest_Add( + UT_os_task_get_id_by_name_test, + UT_os_init_task_get_id_by_name_test, + NULL, + "OS_TaskGetIdByName"); + UtTest_Add( + UT_os_task_get_info_test, + UT_os_init_task_get_info_test, + NULL, + "OS_TaskGetInfo"); + + UtTest_Add(UT_os_geterrorname_test, NULL, NULL, "OS_GetErrorName"); + + UtTest_Add(UT_os_tick2micros_test, NULL, NULL, "OS_Tick2Micros"); + UtTest_Add(UT_os_milli2ticks_test, NULL, NULL, "OS_Milli2Ticks"); + + UtTest_Add(UT_os_getlocaltime_test, NULL, NULL, "OS_GetLocalTime"); + UtTest_Add(UT_os_setlocaltime_test, NULL, NULL, "OS_SetLocalTime"); + + UtTest_Add(UT_os_heapgetinfo_test, NULL, NULL, "OS_HeapGetInfo"); + + UtTest_Add(UT_os_int_attachhandler_test, NULL, NULL, "OS_IntAttachHandler"); + UtTest_Add(UT_os_int_enable_test, NULL, NULL, "OS_IntEnable"); + UtTest_Add(UT_os_int_disable_test, NULL, NULL, "OS_IntDisable"); + UtTest_Add(UT_os_int_lock_test, NULL, NULL, "OS_IntLock"); + UtTest_Add(UT_os_int_unlock_test, NULL, NULL, "OS_IntUnlock"); + + UtTest_Add(UT_os_fpuexc_setmask_test, NULL, NULL, "OS_FPUExcSetMask"); + UtTest_Add(UT_os_fpuexc_getmask_test, NULL, NULL, "OS_FPUExcGetMask"); - UT_os_teardown("ut_oscore"); - OS_ApplicationExit(g_logInfo.nFailed > 0); } /*================================================================================* diff --git a/src/unit-tests/oscore-test/ut_oscore_test.h b/src/unit-tests/oscore-test/ut_oscore_test.h index ca810bde6..14d790ca2 100644 --- a/src/unit-tests/oscore-test/ut_oscore_test.h +++ b/src/unit-tests/oscore-test/ut_oscore_test.h @@ -11,20 +11,20 @@ ** Includes **--------------------------------------------------------------------------------*/ -#include "ut_os_stubs.h" +#include "ut_os_support.h" #include "ut_oscore_misc_test.h" #include "ut_oscore_binsem_test.h" #include "ut_oscore_countsem_test.h" #include "ut_oscore_mutex_test.h" #include "ut_oscore_queue_test.h" #include "ut_oscore_task_test.h" +#include "ut_oscore_interrupt_test.h" +#include "ut_oscore_exception_test.h" /*--------------------------------------------------------------------------------* ** Macros **--------------------------------------------------------------------------------*/ -#define UT_OS_LOG_FILENAME "ut_oscore_log.txt" - /*--------------------------------------------------------------------------------* ** Data types **--------------------------------------------------------------------------------*/ diff --git a/src/unit-tests/oscore-test/ut_oscore_test_arinc653.c b/src/unit-tests/oscore-test/ut_oscore_test_arinc653.c deleted file mode 100644 index 01e0211d6..000000000 --- a/src/unit-tests/oscore-test/ut_oscore_test_arinc653.c +++ /dev/null @@ -1,299 +0,0 @@ -/*================================================================================* -** File: ut_oscore_test_arinc653.c -** Owner: Tam Ngo -** Date: May 2013 -**================================================================================*/ - -/*--------------------------------------------------------------------------------* -** Includes -**--------------------------------------------------------------------------------*/ - -#include - -#include "ut_oscore_test.h" - -/*--------------------------------------------------------------------------------* -** Macros -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Data types -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** External global variables -**--------------------------------------------------------------------------------*/ - -extern UT_OsLogInfo_t g_logInfo; - -/*--------------------------------------------------------------------------------* -** Global variables -**--------------------------------------------------------------------------------*/ - -int32 g_skipTestCase = -1; -char* g_skipTestCaseResult = " "; - -char* g_task_names[UT_OS_TASK_LIST_LEN]; -char g_long_task_name[OS_MAX_API_NAME+5]; - -/*--------------------------------------------------------------------------------* -** External function prototypes -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Local function prototypes -**--------------------------------------------------------------------------------*/ - -void UT_os_init_task_misc(void); -void UT_os_init_task_create_test(void); -void UT_os_init_task_delete_test(void); -void UT_os_setup_install_delete_handler_test(void); -void UT_os_init_task_exit_test(void); -void UT_os_init_task_set_priority_test(void); -void UT_os_init_task_get_id_test(void); -void UT_os_init_task_get_id_by_name_test(void); -void UT_os_init_task_get_info_test(void); - -void UT_os_core_tests(void); - -/*--------------------------------------------------------------------------------* -** Local function definitions -**--------------------------------------------------------------------------------*/ - -void UT_os_init_task_misc() -{ - memset(g_long_task_name, 'X', sizeof(g_long_task_name)); - g_long_task_name[sizeof(g_long_task_name)-1] = '\0'; -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_init_task_create_test() -{ - memset(g_long_task_name, 'X', sizeof(g_long_task_name)); - g_long_task_name[sizeof(g_long_task_name)-1] = '\0'; - - g_task_names[0] = "Task_A"; /* Create_NotImpl */ - g_task_names[1] = "Task_A"; /* Create_NullPtr1 */ - g_task_names[2] = "Task_A"; /* Create_NullPtr2 */ - g_task_names[3] = "Task_B"; /* Create_NullPtr3 */ - g_task_names[4] = "Task_A"; /* Create_LongName */ - g_task_names[5] = "Task_A"; /* Create_InvPrior */ - g_task_names[6] = "Task_A"; /* Create_Full */ - g_task_names[7] = "Task_A"; /* Create_DuplName */ - g_task_names[8] = "Task_B"; /* Create_OsErr */ - g_task_names[9] = "Task_A"; /* Create_Nominal */ - - g_skipTestCase = 6; - g_skipTestCaseResult = UT_OS_NA; -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_init_task_delete_test() -{ - g_task_names[0] = "Task_B"; /* Delete_NotImpl */ - g_task_names[1] = "Task_B"; /* Delete_InvArg */ - g_task_names[2] = "Task_B"; /* Delete_OsErr */ - g_task_names[3] = "Task_B"; /* Delete_Nominal */ -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_setup_install_delete_handler_test() -{ - g_task_names[0] = "Task_B"; /* DelHandler_NotImpl */ - g_task_names[1] = "Task_B"; /* DelHandler_InvArg */ - g_task_names[2] = "Task_B"; /* DelHandler_Nominal */ - - g_skipTestCase = 1; - g_skipTestCaseResult = UT_OS_NA; -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_init_task_exit_test() -{ - g_task_names[0] = "Task_A"; /* Exit_NotImpl */ - g_task_names[1] = "Task_A"; /* Exit Nominal */ -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_init_task_delay_test() -{ - g_task_names[0] = "Task_A"; /* Delay_NotImpl */ - g_task_names[1] = "Task_A"; /* Delay_OsErr */ - g_task_names[2] = "Task_A"; /* Delay_Nominal */ -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_init_task_set_priority_test() -{ - g_task_names[0] = "Task_A"; /* SetPrio_NotImpl */ - g_task_names[1] = "Task_B"; /* SetPrio_InvArg */ - g_task_names[2] = "Task_A"; /* SetPrio_InvPrio */ - g_task_names[3] = "Task_B"; /* SetPrio_OsErr */ - g_task_names[4] = "Task_A"; /* SetPrio_Nominal */ -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_init_task_register_test() -{ - g_task_names[0] = "Task_A"; /* Register_NotImpl */ - g_task_names[1] = "Task_A"; /* Register_InvArg */ - g_task_names[2] = "Task_A"; /* Register_OsErr */ - g_task_names[3] = "Task_A"; /* Register_Nominal */ - - g_skipTestCase = 1; - g_skipTestCaseResult = UT_OS_NA; -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_init_task_get_id_test() -{ - g_task_names[0] = "Task_B"; /* GetId_NotImpl */ - g_task_names[1] = "Task_B"; /* GetId_Nominal */ -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_init_task_get_id_by_name_test() -{ - g_task_names[0] = "Task_B"; /* GetIdByName_NotImpl */ - g_task_names[1] = "Task_B"; /* GetIdByName_InvPtr1 */ - g_task_names[2] = "Task_B"; /* GetIdByName_InvPtr2 */ - g_task_names[3] = "Task_B"; /* GetIdByName_LongName */ - g_task_names[4] = "Task_B"; /* GetIdByName_NotFound */ - g_task_names[5] = "Task_B"; /* GetIdByName_Nominal */ -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_init_task_get_info_test() -{ - g_task_names[0] = "Task_B"; /* GetInfo_NotImpl */ - g_task_names[1] = "Task_B"; /* GetInfo_InvId */ - g_task_names[2] = "Task_B"; /* GetInfo_InvPtr */ - g_task_names[3] = "Task_B"; /* GetInfo_Nominal */ -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_core_tests() -{ - UT_OS_LOG_MACRO("\n============================================\n") - UT_os_printf_test(); - UT_os_printfenable_test(); - UT_os_printfdisable_test(); - UT_OS_LOG_MACRO("============================================\n") - - UT_os_bin_sem_create_test(); - UT_os_bin_sem_delete_test(); - UT_os_bin_sem_flush_test(); - UT_os_bin_sem_give_test(); - UT_os_bin_sem_take_test(); - UT_os_bin_sem_timed_wait_test(); - UT_os_bin_sem_get_id_by_name_test(); - UT_os_bin_sem_get_info_test(); - - UT_os_count_sem_create_test(); - UT_os_count_sem_delete_test(); - UT_os_count_sem_give_test(); - UT_os_count_sem_take_test(); - UT_os_count_sem_timed_wait_test(); - UT_os_count_sem_get_id_by_name_test(); - UT_os_count_sem_get_info_test(); - - UT_os_mut_sem_create_test(); - UT_os_mut_sem_delete_test(); - UT_os_mut_sem_give_test(); - UT_os_mut_sem_take_test(); - UT_os_mut_sem_get_id_by_name_test(); - UT_os_mut_sem_get_info_test(); - - UT_os_queue_create_test(); - UT_os_queue_delete_test(); - UT_os_queue_put_test(); - UT_os_queue_get_test(); - UT_os_queue_get_id_by_name_test(); - UT_os_queue_get_info_test(); - - UT_os_init_task_misc(); - - UT_os_init_task_create_test(); - UT_os_task_create_test(); - - UT_os_init_task_delete_test(); - UT_os_task_delete_test(); - - UT_os_setup_install_delete_handler_test(); - UT_os_task_install_delete_handler_test(); - - UT_os_init_task_exit_test(); - UT_os_task_exit_test(); - - UT_os_init_task_delay_test(); - UT_os_task_delay_test(); - - UT_os_init_task_set_priority_test(); - UT_os_task_set_priority_test(); - - UT_os_init_task_register_test(); - UT_os_task_register_test(); - - UT_os_init_task_get_id_test(); - UT_OS_LOG_MACRO("\n============================================\n") - UT_os_task_get_id_test(); - UT_OS_LOG_MACRO("============================================\n") - - UT_os_init_task_get_id_by_name_test(); - UT_os_task_get_id_by_name_test(); - - UT_os_init_task_get_info_test(); - UT_os_task_get_info_test(); - - UT_os_geterrorname_test(); - - UT_os_tick2micros_test(); - UT_os_milli2ticks_test(); - - UT_OS_LOG_MACRO("\n============================================") - UT_os_getlocaltime_test(); - UT_OS_LOG_MACRO("============================================\n") - UT_os_setlocaltime_test(); - - UT_os_teardown("ut_oscore"); -} - -/*--------------------------------------------------------------------------------* -** Main -**--------------------------------------------------------------------------------*/ - -void UT_main() -{ - uint32 tId=0, stackPtr=0; - RETURN_CODE_TYPE arincRet=NO_ERROR; - - UT_os_setup(UT_OS_LOG_FILENAME); - - /* UT_OS_LOG_OFF, UT_OS_LOG_MINIMAL, UT_OS_LOG_MODERATE, UT_OS_LOG_EVERYTHING */ - UT_os_set_log_verbose(UT_OS_LOG_EVERYTHING); - - UT_OS_LOG_MACRO("OSAL Unit Test Output File for ARINC653-implementation of oscore APIs\n") - - UT_os_apiinit_test(); - - OS_TaskCreate(&tId, "ut_oscore", - (osal_task_entry)&UT_os_core_tests, - &stackPtr, 0x2000, 110, 0); - - SET_PARTITION_MODE(NORMAL, &arincRet); -} - -/*================================================================================* -** End of File: ut_oscore_test_arinc653.c -**================================================================================*/ diff --git a/src/unit-tests/oscore-test/ut_oscore_test_platforms.h b/src/unit-tests/oscore-test/ut_oscore_test_platforms.h deleted file mode 100644 index d92c11340..000000000 --- a/src/unit-tests/oscore-test/ut_oscore_test_platforms.h +++ /dev/null @@ -1,105 +0,0 @@ -/*================================================================================* -** File: ut_oscore_test_platforms.h -** Owner: Tam Ngo -** Date: September 2013 -**================================================================================*/ - -#ifndef _UT_OSCORE_TEST_PLATFORMS_H_ -#define _UT_OSCORE_TEST_PLATFORMS_H_ - -/*--------------------------------------------------------------------------------* -** Includes -**--------------------------------------------------------------------------------*/ - -#ifdef _LINUX_OS_ -#include -#include -#include -#include -#endif /* _LINUX_OS_ */ - -#ifdef _VXWORKS_OS_ -#include -#endif /* _VXWORKS_OS_ */ - -#ifdef OSP_ARINC653 -#include "apex_api.h" -#endif /* OSP_ARINC653 */ - -/*--------------------------------------------------------------------------------* -** Macros -**--------------------------------------------------------------------------------*/ - -#ifdef OSP_ARINC653 -#define SEM_VALUE_MAX 255 -#endif /* OSP_ARINC653 */ - -/*--------------------------------------------*/ -#ifdef _LINUX_OS_ -/*--------------------------------------------*/ - -#define UT_OS_WAIT_MACRO { \ - struct timespec req = { 0, 2*1000 }; /* 2us delay */ \ - (void) nanosleep(&req, 0); \ - } - -/*--------------------------------------------*/ -#endif /* _LINUX_OS_ */ -/*--------------------------------------------*/ - -/*--------------------------------------------*/ -#ifdef _VXWORKS_OS_ -/*--------------------------------------------*/ - -#define UT_OS_WAIT_MACRO taskDelay(20); - -/*--------------------------------------------*/ -#endif /* _VXWORKS_OS_ */ -/*--------------------------------------------*/ - -/*--------------------------------------------*/ -#ifdef OSP_ARINC653 -/*--------------------------------------------*/ -#define UT_OS_WAIT_MACRO for (j=0; j < 10000; j++) { } - -/*--------------------------------------------*/ -#endif /* OSP_ARINC653 */ -/*--------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Data types -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** External global variables -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------*/ -#ifdef _LINUX_OS_ -/*--------------------------------------------*/ -/*--------------------------------------------*/ -#endif /* _LINUX_OS_ */ -/*--------------------------------------------*/ - -/*--------------------------------------------*/ -#ifdef OSP_ARINC653 -/*--------------------------------------------*/ -/*--------------------------------------------*/ -#endif /* OSP_ARINC653 */ -/*--------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Global variables -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Function prototypes -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------*/ - -#endif /* _UT_OSCORE_TEST_PLATFORMS_H_ */ - -/*================================================================================* -** End of File: ut_oscore_test_platforms.h -**================================================================================*/ diff --git a/src/unit-tests/oscore-test/ut_oscore_test_vxworks.c b/src/unit-tests/oscore-test/ut_oscore_test_vxworks.c deleted file mode 100644 index 2d0c86147..000000000 --- a/src/unit-tests/oscore-test/ut_oscore_test_vxworks.c +++ /dev/null @@ -1,285 +0,0 @@ -/*================================================================================* -** File: ut_oscore_test.c -** Owner: Tam Ngo/Alan Cudmore -** Date: May 2013 -**================================================================================*/ - -/*--------------------------------------------------------------------------------* -** Includes -**--------------------------------------------------------------------------------*/ - -#include "ut_oscore_test.h" -#include "ut_oscore_exception_test.h" -#include "ut_oscore_interrupt_test.h" - -/*--------------------------------------------------------------------------------* -** Macros -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Data types -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** External global variables -**--------------------------------------------------------------------------------*/ - -extern UT_OsLogInfo_t g_logInfo; - -/*--------------------------------------------------------------------------------* -** Global variables -**--------------------------------------------------------------------------------*/ - -int32 g_skipTestCase = -1; -char* g_skipTestCaseResult = " "; - -char* g_task_names[UT_OS_TASK_LIST_LEN]; -char g_long_task_name[OS_MAX_API_NAME+5]; - -/*--------------------------------------------------------------------------------* -** External function prototypes -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Local function prototypes -**--------------------------------------------------------------------------------*/ - -void UT_os_init_task_misc(void); -void UT_os_init_task_create_test(void); -void UT_os_init_task_delete_test(void); -void UT_os_setup_install_delete_handler_test(void); -void UT_os_init_task_exit_test(void); -void UT_os_init_task_delay_test(void); -void UT_os_init_task_set_priority_test(void); -void UT_os_init_task_get_id_test(void); -void UT_os_init_task_get_id_by_name_test(void); -void UT_os_init_task_get_info_test(void); - -/*--------------------------------------------------------------------------------* -** Local function definitions -**--------------------------------------------------------------------------------*/ - -void UT_os_init_task_misc() -{ - memset(g_long_task_name, 'X', sizeof(g_long_task_name)); - g_long_task_name[sizeof(g_long_task_name)-1] = '\0'; -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_init_task_create_test() -{ - g_task_names[0] = "Create_NotImpl"; - g_task_names[1] = "Create_NullPtr1"; - g_task_names[2] = "Create_NullPtr2"; - g_task_names[3] = "Create_NullPtr3"; - g_task_names[4] = "Create_LongName"; - g_task_names[5] = "Create_InvPrior"; - g_task_names[6] = "Create_Full"; - g_task_names[7] = "Create_DuplName"; - g_task_names[8] = "Create_OsErr"; - g_task_names[9] = "Create_Nominal"; -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_init_task_delete_test() -{ - g_task_names[0] = "Delete_NotImpl"; - g_task_names[1] = "Delete_InvArg"; - g_task_names[2] = "Delete_OsErr"; - g_task_names[3] = "Delete_Nominal"; -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_setup_install_delete_handler_test() -{ - g_task_names[0] = "DelHandler_NotImpl"; - g_task_names[1] = "DelHandler_InvArg"; - g_task_names[2] = "DelHandler_Nominal"; -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_init_task_exit_test() -{ - g_task_names[0] = "Exit_NotImpl"; - g_task_names[1] = "Exit_Nominal"; -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_init_task_delay_test() -{ - g_task_names[0] = "Delay_NotImpl"; - g_task_names[1] = "Delay_OsErr"; - g_task_names[2] = "Delay_Nominal"; -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_init_task_set_priority_test() -{ - g_task_names[0] = "SetPrio_NotImpl"; - g_task_names[1] = "SetPrio_InvArg"; - g_task_names[2] = "SetPrio_InvPrio"; - g_task_names[3] = "SetPrio_OsErr"; - g_task_names[4] = "SetPrio_Nominal"; -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_init_task_register_test() -{ - g_task_names[0] = "Register_NotImpl"; - g_task_names[1] = "Register_InvArg"; - g_task_names[2] = "Register_OsErr"; - g_task_names[3] = "Register_Nominal"; -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_init_task_get_id_test() -{ - g_task_names[0] = "GetId_NotImpl"; - g_task_names[1] = "GetId_Nominal"; -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_init_task_get_id_by_name_test() -{ - g_task_names[0] = "GetIdByName_NotImpl"; - g_task_names[1] = "GetIdByName_InvPtr1"; - g_task_names[2] = "GetIdByName_InvPtr2"; - g_task_names[3] = "GetIdByName_LongName"; - g_task_names[4] = "GetIdByName_NotFound"; - g_task_names[5] = "GetIdByName_Nominal"; -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_init_task_get_info_test() -{ - g_task_names[0] = "GetInfo_NotImpl"; - g_task_names[1] = "GetInfo_InvId"; - g_task_names[2] = "GetInfo_InvPtr"; - g_task_names[3] = "GetInfo_Nominal"; -} - -/*--------------------------------------------------------------------------------* -** Main -**--------------------------------------------------------------------------------*/ - -void OS_Application_Startup(void) -{ - UT_os_setup(UT_OS_LOG_FILENAME); - - /* UT_OS_LOG_OFF, UT_OS_LOG_MINIMAL, UT_OS_LOG_MODERATE, UT_OS_LOG_EVERYTHING */ - UT_os_set_log_verbose(UT_OS_LOG_EVERYTHING); - - UT_OS_LOG_MACRO("OSAL Unit Test Output File for oscore APIs\n") - - UT_os_apiinit_test(); - - UT_OS_LOG_MACRO("\n============================================\n") - UT_os_printf_test(); - UT_os_printfenable_test(); - UT_os_printfdisable_test(); - UT_OS_LOG_MACRO("============================================\n") - - UT_os_bin_sem_create_test(); - UT_os_bin_sem_delete_test(); - UT_os_bin_sem_flush_test(); - UT_os_bin_sem_give_test(); - UT_os_bin_sem_take_test(); - UT_os_bin_sem_timed_wait_test(); - UT_os_bin_sem_get_id_by_name_test(); - UT_os_bin_sem_get_info_test(); - - UT_os_count_sem_create_test(); - UT_os_count_sem_delete_test(); - UT_os_count_sem_give_test(); - UT_os_count_sem_take_test(); - UT_os_count_sem_timed_wait_test(); - UT_os_count_sem_get_id_by_name_test(); - UT_os_count_sem_get_info_test(); - - UT_os_mut_sem_create_test(); - UT_os_mut_sem_delete_test(); - UT_os_mut_sem_give_test(); - UT_os_mut_sem_take_test(); - UT_os_mut_sem_get_id_by_name_test(); - UT_os_mut_sem_get_info_test(); - - UT_os_queue_create_test(); - UT_os_queue_delete_test(); - UT_os_queue_put_test(); - UT_os_queue_get_test(); - UT_os_queue_get_id_by_name_test(); - UT_os_queue_get_info_test(); - - UT_os_init_task_misc(); - - UT_os_init_task_create_test(); - UT_os_task_create_test(); - - UT_os_init_task_delete_test(); - UT_os_task_delete_test(); - - UT_os_setup_install_delete_handler_test(); - UT_os_task_install_delete_handler_test(); - - UT_os_init_task_exit_test(); - UT_os_task_exit_test(); - - UT_os_init_task_delay_test(); - UT_os_task_delay_test(); - - UT_os_init_task_set_priority_test(); - UT_os_task_set_priority_test(); - - UT_os_init_task_register_test(); - UT_os_task_register_test(); - - UT_os_init_task_get_id_test(); - UT_OS_LOG_MACRO("\n============================================\n") - UT_os_task_get_id_test(); - UT_OS_LOG_MACRO("============================================\n") - - UT_os_init_task_get_id_by_name_test(); - UT_os_task_get_id_by_name_test(); - - UT_os_init_task_get_info_test(); - UT_os_task_get_info_test(); - - UT_os_geterrorname_test(); - - UT_os_tick2micros_test(); - UT_os_milli2ticks_test(); - - UT_OS_LOG_MACRO("\n============================================") - UT_os_getlocaltime_test(); - UT_OS_LOG_MACRO("============================================\n") - UT_os_setlocaltime_test(); - - UT_os_heapgetinfo_test(); - - UT_os_int_attachhandler_test(); - UT_os_int_enable_test(); - UT_os_int_disable_test(); - UT_os_int_lock_test(); - UT_os_int_unlock_test(); - - UT_os_fpuexc_setmask_test(); - UT_os_fpuexc_getmask_test(); - - UT_os_teardown("ut_oscore"); - - OS_ApplicationExit(g_logInfo.nFailed > 0); -} - -/*================================================================================* -** End of File: ut_oscore_test.c -**================================================================================*/ diff --git a/src/unit-tests/osfile-test/CMakeLists.txt b/src/unit-tests/osfile-test/CMakeLists.txt index 6f060d59a..1af452481 100644 --- a/src/unit-tests/osfile-test/CMakeLists.txt +++ b/src/unit-tests/osfile-test/CMakeLists.txt @@ -5,6 +5,5 @@ set(TEST_MODULE_FILES ut_osfile_dirio_test.c ut_osfile_test.c) -add_stubs(TEST_STUBS os) -add_osal_ut_exe(osal_file_UT ${TEST_MODULE_FILES} ${TEST_STUBS}) +add_osal_ut_exe(osal_file_UT ${TEST_MODULE_FILES}) diff --git a/src/unit-tests/osfile-test/ut_osfile_dirio_test.c b/src/unit-tests/osfile-test/ut_osfile_dirio_test.c index a9b26870b..62d9f082f 100644 --- a/src/unit-tests/osfile-test/ut_osfile_dirio_test.c +++ b/src/unit-tests/osfile-test/ut_osfile_dirio_test.c @@ -24,11 +24,9 @@ ** External global variables **--------------------------------------------------------------------------------*/ -extern UT_OsLogInfo_t g_logInfo; - extern char* g_fsAddrPtr; -extern char g_longPathName[OS_MAX_PATH_LEN+5]; +extern char g_longPathName[UT_OS_PATH_BUFF_SIZE]; extern char* g_mntName; @@ -36,13 +34,13 @@ extern char* g_mntName; ** Global variables **--------------------------------------------------------------------------------*/ -char g_dirName[UT_OS_SM_TEXT_LEN]; -char g_fileName[UT_OS_SM_TEXT_LEN]; +char g_dirName[UT_OS_PATH_BUFF_SIZE]; +char g_fileName[UT_OS_FILE_BUFF_SIZE]; -char g_subdirNames[UT_OS_FILE_MAX_DIRS][UT_OS_SM_TEXT_LEN]; +char g_subdirNames[UT_OS_FILE_MAX_DIRS][UT_OS_PATH_BUFF_SIZE]; const char* g_tgtSubdirs[UT_OS_FILE_MAX_DIRS] = {"subdir1", "subdir2"}; -char g_dirItems[UT_OS_FILE_MAX_DIRS][UT_OS_SM_TEXT_LEN]; +char g_dirItems[UT_OS_FILE_MAX_DIRS][UT_OS_FILE_BUFF_SIZE]; /*--------------------------------------------------------------------------------* ** Local function prototypes @@ -62,11 +60,7 @@ void UT_os_sample_test() /* Must declare these variables for each function. They can be renamed. * They're referenced in the macros used to track test cases and their results. */ int32 idx = 0; - UT_OsApiInfo_t apiInfo; - const char* testDesc = NULL; - - /* Call this once at the beginning of the function to initialize the test variables. */ - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------* * For each test case, @@ -88,7 +82,7 @@ void UT_os_sample_test() if (OS_xxx() == OS_FS_UNIMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_sample_test_exit_tag; } @@ -100,9 +94,9 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(NULL,...) == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* TODO: Reset the test environment here, if necessary */ @@ -112,9 +106,9 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(aVeryLoooooongName) == OS_ERR_NAME_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* TODO: Reset the test environment here, if necessary */ @@ -124,17 +118,15 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(...) != OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); /* TODO: Reset the test environment here, if necessary */ UT_os_sample_test_exit_tag: - /* Call these macros at the very end of the function to close out the test variables - * and get it added to the global list being tracked. */ - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_xxx", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } #endif @@ -186,18 +178,15 @@ void UT_os_sample_test() **--------------------------------------------------------------------------------*/ void UT_os_makedir_test() { - UT_OsApiInfo_t apiInfo; - int32 idx=0, fileDesc=0; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + int32 fileDesc=0; + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; if (OS_mkdir(NULL, 755) == OS_FS_UNIMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_makedir_test_exit_tag; } @@ -205,31 +194,30 @@ void UT_os_makedir_test() testDesc = "#1 Null-pointer-arg"; if (OS_mkdir(NULL, 755) == OS_FS_ERR_INVALID_POINTER) - /* cppcheck-suppress syntaxError */ - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Path-too-long-arg"; if (OS_mkdir(g_longPathName, 755) == OS_FS_ERR_PATH_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Invalid-path-arg"; if (OS_mkdir("tmpDir", 755) == OS_FS_ERR_PATH_INVALID) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#4 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#5 Nominal"; @@ -239,7 +227,7 @@ void UT_os_makedir_test() if (OS_mkdir(g_dirName, 755) != OS_FS_SUCCESS) { testDesc = "#5 Nominal - File-system-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_makedir_test_exit_tag; } @@ -247,9 +235,9 @@ void UT_os_makedir_test() UT_os_sprintf(g_fileName, "%s/mkdir_File.txt", g_dirName); fileDesc = OS_creat(g_fileName, OS_READ_WRITE); if (fileDesc >= 0) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ OS_close(fileDesc); @@ -257,8 +245,8 @@ void UT_os_makedir_test() OS_rmdir(g_dirName); UT_os_makedir_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_mkdir", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -308,19 +296,15 @@ void UT_os_makedir_test() **--------------------------------------------------------------------------------*/ void UT_os_opendir_test() { - int32 idx=0; uint32 dirh; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; if (OS_DirectoryOpen(&dirh, NULL) == OS_FS_UNIMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_opendir_test_exit_tag; } @@ -328,30 +312,30 @@ void UT_os_opendir_test() testDesc = "#1 Null-pointer-arg"; if (OS_DirectoryOpen(&dirh, NULL) == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Path-too-long-arg"; if (OS_DirectoryOpen(&dirh, g_longPathName) == OS_FS_ERR_PATH_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Invalid-path-arg"; if (OS_DirectoryOpen(&dirh, "/drive0/tmpDir") != OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#4 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#5 Nominal"; @@ -361,22 +345,22 @@ void UT_os_opendir_test() if (OS_mkdir(g_dirName, 755) != OS_FS_SUCCESS) { testDesc = "#5 Nominal - Dir-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_opendir_test_exit_tag; } if (OS_DirectoryOpen(&dirh, g_dirName) == OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ OS_DirectoryClose(dirh); OS_rmdir(g_dirName); UT_os_opendir_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_opendir", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -414,27 +398,23 @@ void UT_os_opendir_test() **--------------------------------------------------------------------------------*/ void UT_os_closedir_test() { - int32 idx=0; uint32 dirh; os_dirent_t* dirEntry=NULL; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; if (OS_DirectoryClose(0) == OS_FS_UNIMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_closedir_test_exit_tag; } /*-----------------------------------------------------*/ testDesc = "#1 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#2 Nominal"; @@ -444,34 +424,34 @@ void UT_os_closedir_test() if (OS_mkdir(g_dirName, 755) != OS_FS_SUCCESS) { testDesc = "#2 Nominal - Dir-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_closedir_test_exit_tag; } if (OS_DirectoryOpen(&dirh, g_dirName) != OS_SUCCESS) { testDesc = "#2 Nominal - Dir-open failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); goto UT_os_closedir_test_exit_tag; } if (OS_DirectoryClose(dirh) != OS_SUCCESS) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); goto UT_os_closedir_test_exit_tag; } if (OS_DirectoryRead(dirh, dirEntry) != OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ OS_rmdir(g_dirName); UT_os_closedir_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_closedir", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -519,12 +499,8 @@ void UT_os_closedir_test() **--------------------------------------------------------------------------------*/ void UT_os_readdir_test() { - int32 idx=0; uint32 dirh; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; strcpy(g_subdirNames[0], " "); strcpy(g_subdirNames[1], " "); @@ -534,7 +510,7 @@ void UT_os_readdir_test() if (OS_DirectoryRead(0, NULL) == OS_FS_UNIMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_readdir_test_exit_tag; } @@ -542,14 +518,14 @@ void UT_os_readdir_test() testDesc = "#1 Null-pointer-arg"; if (OS_DirectoryRead(0, NULL) == OS_FS_ERR_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#3 Nominal"; @@ -559,7 +535,7 @@ void UT_os_readdir_test() if (OS_mkdir(g_dirName, 755) != OS_FS_SUCCESS) { testDesc = "#3 Nominal - Dir-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_readdir_test_exit_tag; } @@ -568,7 +544,7 @@ void UT_os_readdir_test() if (OS_mkdir(g_subdirNames[0], 755) != OS_FS_SUCCESS) { testDesc = "#3 Nominal - Dir-create(subdir1) failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_readdir_test_exit_tag; } @@ -578,7 +554,7 @@ void UT_os_readdir_test() if (OS_mkdir(g_subdirNames[1], 755) != OS_FS_SUCCESS) { testDesc = "#3 Nominal - Dir-create(subdir2) failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_readdir_test_exit_tag; } @@ -586,7 +562,7 @@ void UT_os_readdir_test() if (OS_DirectoryOpen(&dirh, g_dirName) != OS_SUCCESS) { testDesc = "#3 Nominal - Dir-open failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_readdir_test_exit_tag; } @@ -595,9 +571,9 @@ void UT_os_readdir_test() if ((strcmp(g_dirItems[2], g_tgtSubdirs[0]) == 0) && (strcmp(g_dirItems[3], g_tgtSubdirs[1]) == 0)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); UT_os_readdir_test_exit_tag: /* Reset test environment */ @@ -606,8 +582,8 @@ void UT_os_readdir_test() OS_rmdir(g_subdirNames[1]); OS_rmdir(g_dirName); - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_readdir", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -652,12 +628,8 @@ void UT_os_readdir_test() **--------------------------------------------------------------------------------*/ void UT_os_rewinddir_test() { - int32 idx=0; uint32 dirh; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; strcpy(g_subdirNames[0], " "); strcpy(g_subdirNames[1], " "); @@ -667,14 +639,14 @@ void UT_os_rewinddir_test() if (OS_DirectoryRewind(0) == OS_FS_UNIMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_rewinddir_test_exit_tag; } /*-----------------------------------------------------*/ testDesc = "#1 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#2 Nominal"; @@ -684,7 +656,7 @@ void UT_os_rewinddir_test() if (OS_mkdir(g_dirName, 755) != OS_FS_SUCCESS) { testDesc = "#2 Nominal - Dir-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_rewinddir_test_exit_tag; } @@ -694,7 +666,7 @@ void UT_os_rewinddir_test() if (OS_mkdir(g_subdirNames[0], 755) != OS_FS_SUCCESS) { testDesc = "#2 Nominal - Dir-create(subdir1) failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_rewinddir_test_exit_tag; } @@ -704,7 +676,7 @@ void UT_os_rewinddir_test() if (OS_mkdir(g_subdirNames[1], 755) != OS_FS_SUCCESS) { testDesc = "#2 Nominal - Dir-create(subdir2) failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_rewinddir_test_exit_tag; } @@ -712,7 +684,7 @@ void UT_os_rewinddir_test() if (OS_DirectoryOpen(&dirh, g_dirName) != OS_SUCCESS) { testDesc = "#2 Nominal - Dir-open failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_rewinddir_test_exit_tag; } @@ -723,7 +695,7 @@ void UT_os_rewinddir_test() (strcmp(g_dirItems[3], g_tgtSubdirs[1]) != 0)) { testDesc = "#2 Nominal - Dir-read failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_rewinddir_test_exit_tag; } @@ -734,9 +706,9 @@ void UT_os_rewinddir_test() if ((strcmp(g_dirItems[2], g_tgtSubdirs[0]) != 0) || (strcmp(g_dirItems[3], g_tgtSubdirs[1]) != 0)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); UT_os_rewinddir_test_exit_tag: /* Reset test environment */ @@ -745,8 +717,8 @@ void UT_os_rewinddir_test() OS_rmdir(g_subdirNames[1]); OS_rmdir(g_dirName); - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_rewinddir", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -804,18 +776,15 @@ void UT_os_rewinddir_test() **--------------------------------------------------------------------------------*/ void UT_os_removedir_test() { - UT_OsApiInfo_t apiInfo; - int32 idx=0, fileDesc=0; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + int32 fileDesc=0; + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; if (OS_rmdir(NULL) == OS_FS_UNIMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_removedir_test_exit_tag; } @@ -823,30 +792,30 @@ void UT_os_removedir_test() testDesc = "#1 Null-pointer-arg"; if (OS_rmdir(NULL) == OS_FS_ERR_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Path-too-long-arg"; if (OS_rmdir(g_longPathName) == OS_FS_ERR_PATH_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Invalid-path-arg"; if (OS_rmdir("tmpDir") == OS_FS_ERR_PATH_INVALID) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#4 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#5 Nominal"; @@ -856,7 +825,7 @@ void UT_os_removedir_test() if (OS_mkdir(g_dirName, 755) != OS_FS_SUCCESS) { testDesc = "#5 Nominal - Dir-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_removedir_test_exit_tag; } @@ -866,7 +835,7 @@ void UT_os_removedir_test() if (fileDesc < 0) { testDesc = "#5 Nominal - File-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } /* Must close and remove all files before the directory can be removed */ @@ -875,7 +844,7 @@ void UT_os_removedir_test() if (OS_rmdir(g_dirName) != OS_FS_SUCCESS) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); goto UT_os_removedir_test_exit_tag; } @@ -883,13 +852,13 @@ void UT_os_removedir_test() UT_os_sprintf(g_fileName, "%s/rmdir_File2.txt", g_dirName); fileDesc = OS_creat(g_fileName, OS_READ_WRITE); if (fileDesc < 0) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); UT_os_removedir_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_rmdir", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* diff --git a/src/unit-tests/osfile-test/ut_osfile_dirio_test.h b/src/unit-tests/osfile-test/ut_osfile_dirio_test.h index abc9270d1..8d689b909 100644 --- a/src/unit-tests/osfile-test/ut_osfile_dirio_test.h +++ b/src/unit-tests/osfile-test/ut_osfile_dirio_test.h @@ -11,7 +11,7 @@ ** Includes **--------------------------------------------------------------------------------*/ -#include "ut_os_stubs.h" +#include "ut_os_support.h" /*--------------------------------------------------------------------------------* ** Macros diff --git a/src/unit-tests/osfile-test/ut_osfile_fileio_test.c b/src/unit-tests/osfile-test/ut_osfile_fileio_test.c index 8fd206318..800e2d574 100644 --- a/src/unit-tests/osfile-test/ut_osfile_fileio_test.c +++ b/src/unit-tests/osfile-test/ut_osfile_fileio_test.c @@ -9,7 +9,6 @@ **--------------------------------------------------------------------------------*/ #include "ut_osfile_fileio_test.h" -#include "ut_osfile_test_platforms.h" /*--------------------------------------------------------------------------------* ** Macros @@ -25,16 +24,11 @@ ** External global variables **--------------------------------------------------------------------------------*/ -extern UT_OsLogInfo_t g_logInfo; - extern char* g_fsAddrPtr; -extern int32 g_skipTestCase; -extern char* g_skipTestCaseResult; - -extern char g_longPathName[OS_MAX_PATH_LEN+5]; -extern char g_longFileName[OS_MAX_PATH_LEN]; -extern char g_invalidPath[OS_MAX_PATH_LEN]; +extern char g_longPathName[UT_OS_PATH_BUFF_SIZE]; +extern char g_longFileName[UT_OS_PATH_BUFF_SIZE]; +extern char g_invalidPath[UT_OS_PATH_BUFF_SIZE]; extern char* g_mntName; @@ -42,11 +36,11 @@ extern char* g_mntName; ** Global variables **--------------------------------------------------------------------------------*/ -char g_fNames[UT_OS_FILE_LIST_LEN][UT_OS_SM_TEXT_LEN]; +char g_fNames[UT_OS_FILE_LIST_LEN][UT_OS_FILE_BUFF_SIZE]; int32 g_fDescs[UT_OS_FILE_LIST_LEN]; -char g_readBuff[UT_OS_MD_TEXT_LEN]; -char g_writeBuff[UT_OS_MD_TEXT_LEN]; +char g_readBuff[UT_OS_IO_BUFF_SIZE]; +char g_writeBuff[UT_OS_IO_BUFF_SIZE]; /*--------------------------------------------------------------------------------* ** External function prototypes @@ -68,11 +62,7 @@ void UT_os_sample_test() /* Must declare these variables for each function. They can be renamed. * They're referenced in the macros used to track test cases and their results. */ int32 idx = 0; - UT_OsApiInfo_t apiInfo; - const char* testDesc = NULL; - - /* Call this once at the beginning of the function to initialize the test variables. */ - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------* * For each test case, @@ -94,7 +84,7 @@ void UT_os_sample_test() if (OS_xxx() == OS_FS_UNIMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_sample_test_exit_tag; } @@ -106,9 +96,9 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(NULL,...) == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* TODO: Reset the test environment here, if necessary */ @@ -118,9 +108,9 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(aVeryLoooooongName) == OS_ERR_NAME_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* TODO: Reset the test environment here, if necessary */ @@ -130,17 +120,17 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(...) != OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); /* TODO: Reset the test environment here, if necessary */ UT_os_sample_test_exit_tag: /* Call these macros at the very end of the function to close out the test variables * and get it added to the global list being tracked. */ - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_xxx", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } #endif @@ -174,16 +164,13 @@ void UT_os_sample_test() *--------------------------------------------------------------------------------*/ void UT_os_initfs_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + int32 res = 0; + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "#1 Init-not-call-first - Test case not applicable on platform"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); /*-----------------------------------------------------*/ testDesc = "#2 Nominal"; @@ -193,19 +180,19 @@ void UT_os_initfs_test() if (res == OS_ERR_NOT_IMPLEMENTED) { testDesc = "API not implemented"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); } else if (res == OS_SUCCESS) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); } else { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_FS_Init", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -282,18 +269,15 @@ void UT_os_initfs_test() **--------------------------------------------------------------------------------*/ void UT_os_createfile_test() { - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - int32 res=0, idx=0, i=0, j=0; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; + int32 res=0, i=0, j=0; /*-----------------------------------------------------*/ testDesc = "API not implemented"; if (OS_creat(NULL, OS_READ_WRITE) == OS_FS_UNIMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_createfile_test_exit_tag; } @@ -301,34 +285,33 @@ void UT_os_createfile_test() testDesc = "#1 Null-pointer-arg"; if (OS_creat(NULL, OS_READ_WRITE) == OS_FS_ERR_INVALID_POINTER) - /* cppcheck-suppress syntaxError */ - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Invalid-path-arg"; if (OS_creat(g_invalidPath, OS_READ_WRITE) == OS_FS_ERR_PATH_INVALID) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Path-too-long-arg"; if (OS_creat(g_longPathName, OS_READ_WRITE) == OS_FS_ERR_PATH_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#4 Name-too-long-arg"; if (OS_creat(g_longFileName, OS_READ_WRITE) == OS_FS_ERR_NAME_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#5 Invalid-permission-arg"; @@ -337,9 +320,9 @@ void UT_os_createfile_test() UT_os_sprintf(g_fNames[0], "%s/Create_InvPerm.txt", g_mntName); res = OS_creat(g_fNames[0], 123); if (res == OS_FS_ERROR) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ OS_close(res); @@ -348,7 +331,7 @@ void UT_os_createfile_test() /*-----------------------------------------------------*/ testDesc = "#6 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#7 File-descriptors-full"; @@ -363,9 +346,9 @@ void UT_os_createfile_test() } if ((i == OS_MAX_NUM_OPEN_FILES) && (g_fDescs[i] == OS_FS_ERR_NO_FREE_FDS)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ for (j=0; j < i; j++) @@ -382,13 +365,13 @@ void UT_os_createfile_test() if ((OS_close(g_fDescs[5]) != OS_FS_SUCCESS) || (OS_close(g_fDescs[6]) != OS_FS_SUCCESS) || (OS_remove(g_fNames[5]) != OS_FS_SUCCESS) || (OS_remove(g_fNames[6]) != OS_FS_SUCCESS)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); UT_os_createfile_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_creat", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -466,18 +449,15 @@ void UT_os_createfile_test() **--------------------------------------------------------------------------------*/ void UT_os_openfile_test() { - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - int32 res=0, idx=0, i=0, j=0, continueFlg=0; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; + int32 res=0, i=0, j=0, continueFlg=0; /*-----------------------------------------------------*/ testDesc = "API not implemented"; if (OS_open(NULL, OS_READ_WRITE, 0644) == OS_FS_UNIMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_openfile_test_exit_tag; } @@ -485,33 +465,33 @@ void UT_os_openfile_test() testDesc = "#1 Null-pointer-arg"; if (OS_open(NULL, OS_READ_WRITE, 0644) == OS_FS_ERR_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Invalid-path-arg"; if (OS_open(g_invalidPath, OS_READ_WRITE, 0644) == OS_FS_ERR_PATH_INVALID) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Path-too-long-arg"; if (OS_open(g_longPathName, OS_READ_WRITE, 0644) == OS_FS_ERR_PATH_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#4 Name-too-long-arg"; if (OS_open(g_longFileName, OS_READ_WRITE, 0644) == OS_FS_ERR_NAME_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#5 Invalid-permission-arg"; @@ -520,9 +500,9 @@ void UT_os_openfile_test() UT_os_sprintf(g_fNames[0], "%s/Open_InvPerm.txt", g_mntName); res = OS_open(g_fNames[0], 123, 0644); if (res == OS_FS_ERROR) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ OS_close(res); @@ -531,7 +511,7 @@ void UT_os_openfile_test() /*-----------------------------------------------------*/ testDesc = "#6 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#7 File-descriptors-full"; @@ -545,7 +525,7 @@ void UT_os_openfile_test() if (g_fDescs[i] < OS_FS_SUCCESS) { testDesc = "#7 File-descriptors-full - File-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); continueFlg = 0; break; } @@ -553,7 +533,7 @@ void UT_os_openfile_test() if (continueFlg && (OS_close(g_fDescs[i]) != OS_FS_SUCCESS)) { testDesc = "#7 File-descriptors-full - File-close failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); continueFlg = 0; break; } @@ -569,9 +549,9 @@ void UT_os_openfile_test() } if ((i == OS_MAX_NUM_OPEN_FILES) && (g_fDescs[i] < OS_FS_SUCCESS)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ for (j=0; j < i; j++) @@ -589,14 +569,14 @@ void UT_os_openfile_test() if ((g_fDescs[5] < OS_FS_SUCCESS) || (g_fDescs[6] < OS_FS_SUCCESS)) { testDesc = "#8 Nominal - File-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_openfile_test_exit_tag; } if ((OS_close(g_fDescs[5]) != OS_FS_SUCCESS) || (OS_close(g_fDescs[6]) != OS_FS_SUCCESS)) { testDesc = "#8 Nominal - File-close failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_openfile_test_exit_tag; } @@ -605,13 +585,13 @@ void UT_os_openfile_test() if ((OS_close(g_fDescs[5]) != OS_FS_SUCCESS) || (OS_close(g_fDescs[6]) != OS_FS_SUCCESS) || (OS_remove(g_fNames[5]) != OS_FS_SUCCESS) || (OS_remove(g_fNames[6]) != OS_FS_SUCCESS)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); UT_os_openfile_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_open", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -654,19 +634,15 @@ void UT_os_openfile_test() **--------------------------------------------------------------------------------*/ void UT_os_closefile_test() { - int32 idx=0; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - char tmpBuff[UT_OS_XS_TEXT_LEN]; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; + char tmpBuff[UT_OS_IO_BUFF_SIZE]; /*-----------------------------------------------------*/ testDesc = "API not implemented"; if (OS_close(99999) == OS_FS_UNIMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_closefile_test_exit_tag; } @@ -674,14 +650,14 @@ void UT_os_closefile_test() testDesc = "#1 Invalid-file-desc-arg"; if (OS_close(99999) == OS_FS_ERR_INVALID_FD) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#3 Nominal"; @@ -693,23 +669,23 @@ void UT_os_closefile_test() if (g_fDescs[0] < 0) { testDesc = "#3 Nominal - File-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_closefile_test_exit_tag; } if ((OS_close(g_fDescs[0]) != OS_FS_SUCCESS) || (OS_write(g_fDescs[0], tmpBuff, sizeof(tmpBuff)) != OS_FS_ERR_INVALID_FD) || (OS_read(g_fDescs[0], tmpBuff, sizeof(tmpBuff)) != OS_FS_ERR_INVALID_FD)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); /* Reset test environment */ OS_remove(g_fNames[0]); UT_os_closefile_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_close", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -767,18 +743,14 @@ void UT_os_closefile_test() **--------------------------------------------------------------------------------*/ void UT_os_readfile_test() { - int32 idx=0; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; if (OS_read(99999, NULL, 0) == OS_FS_UNIMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_readfile_test_exit_tag; } @@ -791,14 +763,14 @@ void UT_os_readfile_test() if (g_fDescs[0] < 0) { testDesc = "#1 Null-pointer-arg - File-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { if (OS_read(g_fDescs[0], NULL, sizeof(g_readBuff)) == OS_FS_ERR_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ OS_close(g_fDescs[0]); @@ -809,14 +781,14 @@ void UT_os_readfile_test() testDesc = "#2 Invalid-file-desc-arg"; if (OS_read(99999, g_readBuff, sizeof(g_readBuff)) == OS_FS_ERR_INVALID_FD) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#4 Nominal"; @@ -828,7 +800,7 @@ void UT_os_readfile_test() if (g_fDescs[0] < 0) { testDesc = "#4 Nominal - File-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_readfile_test_exit_tag; } @@ -837,7 +809,7 @@ void UT_os_readfile_test() if (OS_write(g_fDescs[0], g_writeBuff, strlen(g_writeBuff)) != strlen(g_writeBuff)) { testDesc = "#4 Nominal - File-write failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); /* Reset test environment */ OS_close(g_fDescs[0]); @@ -849,7 +821,7 @@ void UT_os_readfile_test() if (OS_close(g_fDescs[0]) != OS_FS_SUCCESS) { testDesc = "#4 Nominal - File-close failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); /* Reset test environment */ OS_remove(g_fNames[0]); @@ -861,7 +833,7 @@ void UT_os_readfile_test() if (g_fDescs[0] < 0) { testDesc = "#4 Nominal - File-open failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); /* Reset test environment */ OS_remove(g_fNames[0]); @@ -872,20 +844,20 @@ void UT_os_readfile_test() memset(g_readBuff, '\0', sizeof(g_readBuff)); if ((OS_read(g_fDescs[0], g_readBuff, strlen(g_writeBuff)) == strlen(g_writeBuff)) && (strncmp(g_readBuff, g_writeBuff, strlen(g_writeBuff)) == 0)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ OS_close(g_fDescs[0]); OS_remove(g_fNames[0]); - UT_OS_LOG_MACRO("OS_read() success test -- Write to file:\n\t%s\n", g_writeBuff); - UT_OS_LOG_MACRO("OS_read() success test -- Read from file:\n\t%s\n", g_readBuff); + UT_OS_LOG("OS_read() success test -- Write to file:\n\t%s\n", g_writeBuff);; + UT_OS_LOG("OS_read() success test -- Read from file:\n\t%s\n", g_readBuff);; UT_os_readfile_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_read", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -942,18 +914,14 @@ void UT_os_readfile_test() **--------------------------------------------------------------------------------*/ void UT_os_writefile_test() { - int32 idx=0; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; if (OS_write(99999, NULL, 0) == OS_FS_UNIMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_writefile_test_exit_tag; } @@ -966,14 +934,14 @@ void UT_os_writefile_test() if (g_fDescs[0] < 0) { testDesc = "#1 Null-pointer-arg - File-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { if (OS_write(g_fDescs[0], NULL, sizeof(g_writeBuff)) == OS_FS_ERR_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ OS_close(g_fDescs[0]); @@ -984,14 +952,14 @@ void UT_os_writefile_test() testDesc = "#2 Invalid-file-desc-arg"; if (OS_write(99999, g_writeBuff, sizeof(g_writeBuff)) == OS_FS_ERR_INVALID_FD) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#4 Nominal"; @@ -1003,7 +971,7 @@ void UT_os_writefile_test() if (g_fDescs[0] < OS_FS_SUCCESS) { testDesc = "#4 Nominal - File-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_writefile_test_exit_tag; } @@ -1011,7 +979,7 @@ void UT_os_writefile_test() strcpy(g_writeBuff, "TO BE OR NOT TO BE, THAT IS A QUESTION."); if (OS_write(g_fDescs[0], g_writeBuff, strlen(g_writeBuff)) != strlen(g_writeBuff)) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ OS_close(g_fDescs[0]); @@ -1023,7 +991,7 @@ void UT_os_writefile_test() if (OS_close(g_fDescs[0]) != OS_FS_SUCCESS) { testDesc = "#4 Nominal - File-close failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); /* Reset test environment */ OS_remove(g_fNames[0]); @@ -1035,7 +1003,7 @@ void UT_os_writefile_test() if (g_fDescs[0] < 0) { testDesc = "#4 Nominal - File-open failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); /* Reset test environment */ OS_remove(g_fNames[0]); @@ -1046,20 +1014,20 @@ void UT_os_writefile_test() memset(g_readBuff, '\0', sizeof(g_readBuff)); if ((OS_read(g_fDescs[0], g_readBuff, strlen(g_writeBuff)) == strlen(g_writeBuff)) && (strncmp(g_readBuff, g_writeBuff, strlen(g_writeBuff)) == 0)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ OS_close(g_fDescs[0]); OS_remove(g_fNames[0]); - UT_OS_LOG_MACRO("OS_write() success test -- Write to file:\n\t%s\n", g_writeBuff); - UT_OS_LOG_MACRO("OS_write() success test -- Read from file:\n\t%s\n", g_readBuff); + UT_OS_LOG("OS_write() success test -- Write to file:\n\t%s\n", g_writeBuff);; + UT_OS_LOG("OS_write() success test -- Read from file:\n\t%s\n", g_readBuff);; UT_os_writefile_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_write", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -1114,18 +1082,15 @@ void UT_os_writefile_test() **--------------------------------------------------------------------------------*/ void UT_os_lseekfile_test() { - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - int32 idx=0, buffLen=0, pos1=0, pos2=0, pos3=0; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; + int32 buffLen=0, pos1=0, pos2=0, pos3=0; /*-----------------------------------------------------*/ testDesc = "API not implemented"; if (OS_lseek(99999, 0, OS_SEEK_CUR) == OS_FS_UNIMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_lseekfile_test_exit_tag; } @@ -1133,9 +1098,9 @@ void UT_os_lseekfile_test() testDesc = "#1 Invalid-file-desc-arg"; if (OS_lseek(99999, 0, OS_SEEK_SET) == OS_FS_ERR_INVALID_FD) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Invalid-whence-arg"; @@ -1146,14 +1111,14 @@ void UT_os_lseekfile_test() if (g_fDescs[0] < 0) { testDesc = "#2 Invalid-whence-arg - File-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { if (OS_lseek(g_fDescs[0], 0, 123456) == OS_FS_ERROR) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } /* Reset test environment */ @@ -1163,7 +1128,7 @@ void UT_os_lseekfile_test() /*-----------------------------------------------------*/ testDesc = "#3 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#4 Nominal"; @@ -1175,7 +1140,7 @@ void UT_os_lseekfile_test() if (g_fDescs[0] < 0) { testDesc = "#4 Nominal - File-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_lseekfile_test_exit_tag; } @@ -1186,7 +1151,7 @@ void UT_os_lseekfile_test() if (OS_write(g_fDescs[0], g_writeBuff, buffLen) != buffLen) { testDesc = "#4 Nominal - File-write failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_lseekfile_test_exit_tag; } @@ -1196,17 +1161,17 @@ void UT_os_lseekfile_test() if ((pos1 < 0) || (g_writeBuff[pos1] != 'F') || (pos2 < 0) || (g_writeBuff[pos2] != 'P') || (pos3 < 0) || (g_writeBuff[pos3] != 'E')) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); /* Reset test environment */ OS_close(g_fDescs[0]); OS_remove(g_fNames[0]); UT_os_lseekfile_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_lseek", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -1223,24 +1188,20 @@ void UT_os_lseekfile_test() **--------------------------------------------------------------------------------*/ void UT_os_chmodfile_test() { - int32 idx=0; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; if (OS_chmod(NULL, 0644) == OS_FS_UNIMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_chmodfile_test_exit_tag; } UT_os_chmodfile_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_chmod", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -1301,19 +1262,15 @@ void UT_os_chmodfile_test() **--------------------------------------------------------------------------------*/ void UT_os_statfile_test() { - int32 idx=0; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; + const char* testDesc; os_fstat_t fstats1, fstats2; - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - /*-----------------------------------------------------*/ testDesc = "API not implemented"; if (OS_stat(NULL, NULL) == OS_FS_UNIMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_statfile_test_exit_tag; } @@ -1322,30 +1279,30 @@ void UT_os_statfile_test() if ((OS_stat(NULL, &fstats1) == OS_FS_ERR_INVALID_POINTER) && (OS_stat(g_fNames[0], NULL) == OS_FS_ERR_INVALID_POINTER)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Invalid-path-arg"; if (OS_stat(g_invalidPath, &fstats1) == OS_FS_ERR_PATH_INVALID) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Path-too-long-arg"; if (OS_stat(g_longPathName, &fstats1) == OS_FS_ERR_PATH_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#4 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#5 Nominal"; @@ -1357,13 +1314,13 @@ void UT_os_statfile_test() if (g_fDescs[0] < 0) { testDesc = "#5 Nominal - File-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_statfile_test_exit_tag; } if (OS_stat(g_fNames[0], &fstats1) != OS_FS_SUCCESS) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); goto UT_os_statfile_test_exit_tag; } @@ -1372,34 +1329,34 @@ void UT_os_statfile_test() if (OS_write(g_fDescs[0], g_writeBuff, strlen(g_writeBuff)) != strlen(g_writeBuff)) { testDesc = "#5 Nominal - File-write failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_statfile_test_exit_tag; } if (OS_close(g_fDescs[0]) != OS_FS_SUCCESS) { testDesc = "#5 Nominal - File-close failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_statfile_test_exit_tag; } if (OS_stat(g_fNames[0], &fstats2) != OS_FS_SUCCESS) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); goto UT_os_statfile_test_exit_tag; } if (memcmp(&fstats1, &fstats2, sizeof(fstats1)) != 0) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ OS_remove(g_fNames[0]); UT_os_statfile_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_stat", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -1458,19 +1415,15 @@ void UT_os_statfile_test() **--------------------------------------------------------------------------------*/ void UT_os_removefile_test() { - int32 idx=0; os_fstat_t fstats; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; if (OS_remove(NULL) == OS_FS_UNIMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_removefile_test_exit_tag; } @@ -1478,38 +1431,38 @@ void UT_os_removefile_test() testDesc = "#1 Null-pointer-arg"; if (OS_remove(NULL) == OS_FS_ERR_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Invalid-path-arg"; if (OS_remove(g_invalidPath) == OS_FS_ERR_PATH_INVALID) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Path-too-long-arg"; if (OS_remove(g_longPathName) == OS_FS_ERR_PATH_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#4 Name-too-long-arg"; if (OS_remove(g_longFileName) == OS_FS_ERR_NAME_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#5 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#6 Nominal"; @@ -1521,7 +1474,7 @@ void UT_os_removefile_test() if (g_fDescs[0] < 0) { testDesc = "#6 Nominal - File-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_removefile_test_exit_tag; } @@ -1530,18 +1483,18 @@ void UT_os_removefile_test() if (OS_remove(g_fNames[0]) != OS_FS_SUCCESS) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); goto UT_os_removefile_test_exit_tag; } if (OS_stat(g_fNames[0], &fstats) == OS_FS_ERROR) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); UT_os_removefile_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_remove", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -1600,19 +1553,15 @@ void UT_os_removefile_test() **--------------------------------------------------------------------------------*/ void UT_os_renamefile_test() { - int32 idx=0; os_fstat_t fstats; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; if (OS_rename(NULL, NULL) == OS_FS_UNIMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_renamefile_test_exit_tag; } @@ -1626,38 +1575,38 @@ void UT_os_renamefile_test() if ((OS_rename(NULL, g_fNames[1]) == OS_FS_ERR_INVALID_POINTER) && (OS_rename(g_fNames[0], NULL) == OS_FS_ERR_INVALID_POINTER)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Invalid-path-arg"; if (OS_rename(g_invalidPath, g_invalidPath) == OS_FS_ERR_PATH_INVALID) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Path-too-long-arg"; if (OS_rename(g_longPathName, g_longPathName) == OS_FS_ERR_PATH_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#4 Name-too-long-arg"; if (OS_rename(g_longFileName, g_longFileName) == OS_FS_ERR_NAME_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#5 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#6 Nominal"; @@ -1671,28 +1620,28 @@ void UT_os_renamefile_test() if (g_fDescs[0] < 0) { testDesc = "#6 Nominal - File-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_renamefile_test_exit_tag; } if (OS_rename(g_fNames[0], g_fNames[1]) != OS_FS_SUCCESS) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); goto UT_os_renamefile_test_exit_tag; } if (OS_stat(g_fNames[0], &fstats) == OS_FS_ERROR) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ OS_close(g_fDescs[0]); OS_remove(g_fNames[1]); UT_os_renamefile_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_rename", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -1755,19 +1704,15 @@ void UT_os_renamefile_test() **--------------------------------------------------------------------------------*/ void UT_os_copyfile_test() { - int32 idx=0; os_fstat_t fstats; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; if (OS_cp(NULL, NULL) == OS_FS_UNIMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_copyfile_test_exit_tag; } @@ -1781,38 +1726,38 @@ void UT_os_copyfile_test() if ((OS_cp(NULL, g_fNames[1]) == OS_FS_ERR_INVALID_POINTER) && (OS_cp(g_fNames[0], NULL) == OS_FS_ERR_INVALID_POINTER)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Invalid-path-arg"; if (OS_cp(g_invalidPath, g_invalidPath) == OS_FS_ERR_PATH_INVALID) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Path-too-long-arg"; if (OS_cp(g_longPathName, g_longPathName) == OS_FS_ERR_PATH_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#4 Name-too-long-arg"; if (OS_cp(g_longFileName, g_longFileName) == OS_FS_ERR_NAME_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#5 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#6 Nominal"; @@ -1825,7 +1770,7 @@ void UT_os_copyfile_test() if (OS_stat(g_fNames[1], &fstats) != OS_FS_ERROR) { testDesc = "#6 Nominal - File-stat failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_copyfile_test_exit_tag; } @@ -1833,35 +1778,35 @@ void UT_os_copyfile_test() if (g_fDescs[0] < 0) { testDesc = "#6 Nominal - File-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_copyfile_test_exit_tag; } if (OS_close(g_fDescs[0]) != OS_FS_SUCCESS) { testDesc = "#6 Nominal - File-close failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_copyfile_test_exit_tag; } if (OS_cp(g_fNames[0], g_fNames[1]) != OS_FS_SUCCESS) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); goto UT_os_copyfile_test_exit_tag; } if (OS_stat(g_fNames[1], &fstats) == OS_FS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ OS_remove(g_fNames[0]); OS_remove(g_fNames[1]); UT_os_copyfile_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_cp", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -1927,19 +1872,15 @@ void UT_os_copyfile_test() **--------------------------------------------------------------------------------*/ void UT_os_movefile_test() { - int32 idx=0; os_fstat_t fstats; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; if (OS_mv(NULL, NULL) == OS_FS_UNIMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_movefile_test_exit_tag; } @@ -1953,38 +1894,38 @@ void UT_os_movefile_test() if ((OS_mv(NULL, g_fNames[1]) == OS_FS_ERR_INVALID_POINTER) && (OS_mv(g_fNames[0], NULL) == OS_FS_ERR_INVALID_POINTER)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Invalid-path-arg"; if (OS_mv(g_invalidPath, g_invalidPath) == OS_FS_ERR_PATH_INVALID) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Path-too-long-arg"; if (OS_mv(g_longPathName, g_longPathName) == OS_FS_ERR_PATH_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#4 Name-too-long-arg"; if (OS_mv(g_longFileName, g_longFileName) == OS_FS_ERR_NAME_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#5 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#6 Nominal"; @@ -1997,7 +1938,7 @@ void UT_os_movefile_test() if (OS_stat(g_fNames[1], &fstats) != OS_FS_ERROR) { testDesc = "#6 Nominal - File-stat failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_movefile_test_exit_tag; } @@ -2005,7 +1946,7 @@ void UT_os_movefile_test() if (g_fDescs[0] < 0) { testDesc = "#6 Nominal - File-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_movefile_test_exit_tag; } @@ -2013,28 +1954,28 @@ void UT_os_movefile_test() if (OS_close(g_fDescs[0]) != OS_FS_SUCCESS) { testDesc = "#6 Nominal - File-close failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_movefile_test_exit_tag; } if (OS_mv(g_fNames[0], g_fNames[1]) != OS_FS_SUCCESS) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); goto UT_os_movefile_test_exit_tag; } if ((OS_stat(g_fNames[1], &fstats) == OS_FS_SUCCESS) && (OS_stat(g_fNames[0], &fstats) != OS_FS_SUCCESS)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ OS_remove(g_fNames[1]); UT_os_movefile_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_mv", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -2090,26 +2031,16 @@ void UT_os_movefile_test() **--------------------------------------------------------------------------------*/ void UT_os_outputtofile_test() { - int32 idx=0; - UT_OsApiInfo_t apiInfo; + int res; const char* cmd=NULL; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; - if (g_skipTestCase == 0) - { - testDesc = "API not applicable on platform"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, g_skipTestCaseResult) - goto UT_os_outputtofile_test_exit_tag; - } - if (OS_ShellOutputToFile(NULL, 0) == OS_FS_UNIMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_outputtofile_test_exit_tag; } @@ -2117,22 +2048,22 @@ void UT_os_outputtofile_test() testDesc = "#1 Null-pointer-arg"; if (OS_ShellOutputToFile(NULL, 0) == OS_FS_ERR_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Invalid-file-desc-arg"; if (OS_ShellOutputToFile("ls", 99999) == OS_FS_ERR_INVALID_FD) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#4 Nominal"; @@ -2143,44 +2074,54 @@ void UT_os_outputtofile_test() if (g_fDescs[0] < 0) { testDesc = "#4 Nominal - File-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_outputtofile_test_exit_tag; } cmd = "echo \"UT_os_outputtofile_test\""; - if (OS_ShellOutputToFile(cmd, g_fDescs[0]) != OS_FS_SUCCESS) + res = OS_ShellOutputToFile(cmd, g_fDescs[0]); + if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_outputtofile_test_exit_tag; } - if (OS_lseek(g_fDescs[0], 0, OS_SEEK_SET) != OS_FS_SUCCESS) + if (res != OS_SUCCESS) { - testDesc = "#4 Nominal - File-lseek failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); goto UT_os_outputtofile_test_exit_tag; } - memset(g_readBuff, '\0', sizeof(g_readBuff)); - if (OS_read(g_fDescs[0], g_readBuff, sizeof(g_readBuff)) <= 0) + if (OS_lseek(g_fDescs[0], 0, OS_SEEK_SET) != OS_FS_SUCCESS) { - testDesc = "#4 Nominal - File-read failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) - goto UT_os_outputtofile_test_exit_tag; + testDesc = "#4 Nominal - File-lseek failed"; + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } - - if (UT_OS_OUTPUT_TO_FILE_SUCCESS_COND_MACRO) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + { + memset(g_readBuff, '\0', sizeof(g_readBuff)); + if (OS_read(g_fDescs[0], g_readBuff, sizeof(g_readBuff)) <= 0) + { + testDesc = "#4 Nominal - File-read failed"; + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); + } + else if (strstr(g_readBuff, "UT_os_outputtofile_test") != NULL) + { + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); + } + else + { + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); + } + } /* Reset test environment */ OS_close(g_fDescs[0]); OS_remove(g_fNames[0]); UT_os_outputtofile_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_ShellOutputToFile", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -2233,20 +2174,16 @@ void UT_os_outputtofile_test() **--------------------------------------------------------------------------------*/ void UT_os_getfdinfo_test() { - int32 idx=0; - UT_OsApiInfo_t apiInfo; OS_file_prop_t fdProps; - const char* testDesc=NULL; + const char* testDesc; const char* fileName="GetInfo_Nom.txt"; - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - /*-----------------------------------------------------*/ testDesc = "API not implemented"; if (OS_FDGetInfo(0, NULL) == OS_FS_UNIMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_getfdinfo_test_exit_tag; } @@ -2260,15 +2197,15 @@ void UT_os_getfdinfo_test() if (g_fDescs[0] < 0) { testDesc = "#1 Null-pointer-arg - File-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else if (OS_FDGetInfo(g_fDescs[0], NULL) != OS_FS_ERR_INVALID_POINTER) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } else { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); } OS_close(g_fDescs[0]); @@ -2278,14 +2215,14 @@ void UT_os_getfdinfo_test() testDesc = "#2 Invalid-file-desc-arg"; if (OS_FDGetInfo(99999, &fdProps) == OS_FS_ERR_INVALID_FD) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#4 Nominal"; @@ -2296,36 +2233,37 @@ void UT_os_getfdinfo_test() if (g_fDescs[0] < 0) { testDesc = "#4 Nominal - File-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_getfdinfo_test_exit_tag; } memset(&fdProps, 0x00, sizeof(fdProps)); - UT_OS_COMPARE_COND_FOR_NOMINAL_GETFDINFO_MACRO + if (OS_FDGetInfo(g_fDescs[0], &fdProps) != OS_FS_SUCCESS || + strcmp(fdProps.Path, g_fNames[0]) != 0) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); goto UT_os_getfdinfo_test_exit_tag; } if (OS_close(g_fDescs[0]) != OS_FS_SUCCESS) { testDesc = "#4 Nominal - File-close failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_getfdinfo_test_exit_tag; } memset(&fdProps, 0x00, sizeof(fdProps)); if (OS_FDGetInfo(g_fDescs[0], &fdProps) == OS_FS_ERR_INVALID_FD) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ OS_remove(g_fNames[0]); UT_os_getfdinfo_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_FDGetInfo", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -2362,18 +2300,14 @@ void UT_os_getfdinfo_test() **--------------------------------------------------------------------------------*/ void UT_os_checkfileopen_test() { - int32 idx=0; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; if (OS_FileOpenCheck(NULL) == OS_FS_UNIMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_checkfileopen_test_exit_tag; } @@ -2381,9 +2315,9 @@ void UT_os_checkfileopen_test() testDesc = "#1 Null-pointer-arg"; if (OS_FileOpenCheck(NULL) == OS_FS_ERR_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 File-not-opened"; @@ -2395,20 +2329,20 @@ void UT_os_checkfileopen_test() if (g_fDescs[0] < 0) { testDesc = "#2 File-not-opened - File-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else if (OS_close(g_fDescs[0]) != OS_FS_SUCCESS) { testDesc = "#2 File-not-opened - File-close failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else if (OS_FileOpenCheck(g_fNames[0]) != OS_FS_ERROR) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } else { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); } /* Reset test environment */ @@ -2424,22 +2358,22 @@ void UT_os_checkfileopen_test() if (g_fDescs[0] < 0) { testDesc = "#3 Nominal - File-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_checkfileopen_test_exit_tag; } if (OS_FileOpenCheck(g_fNames[0]) == OS_FS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ OS_close(g_fDescs[0]); OS_remove(g_fNames[0]); UT_os_checkfileopen_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_FileOpenCheck", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -2474,25 +2408,21 @@ void UT_os_checkfileopen_test() **--------------------------------------------------------------------------------*/ void UT_os_closeallfiles_test() { - int32 idx=0; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; if (OS_CloseAllFiles() == OS_FS_UNIMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_closeallfiles_test_exit_tag; } /*-----------------------------------------------------*/ testDesc = "#1 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#2 Nominal"; @@ -2510,22 +2440,22 @@ void UT_os_closeallfiles_test() if ((g_fDescs[0] < 0) || (g_fDescs[1] < 0) || (g_fDescs[2] < 0)) { testDesc = "#2 Nominal - File-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_closeallfiles_test_exit_tag; } if (OS_CloseAllFiles() != OS_FS_SUCCESS) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); goto UT_os_closeallfiles_test_exit_tag; } if ((OS_FileOpenCheck(g_fNames[0]) == OS_FS_ERROR) && (OS_FileOpenCheck(g_fNames[1]) == OS_FS_ERROR) && (OS_FileOpenCheck(g_fNames[2]) == OS_FS_ERROR)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ OS_remove(g_fNames[0]); @@ -2533,8 +2463,8 @@ void UT_os_closeallfiles_test() OS_remove(g_fNames[2]); UT_os_closeallfiles_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_CloseAllFiles", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -2581,18 +2511,14 @@ void UT_os_closeallfiles_test() **--------------------------------------------------------------------------------*/ void UT_os_closefilebyname_test() { - int32 idx=0; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; if (OS_CloseFileByName(NULL) == OS_FS_UNIMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_closefilebyname_test_exit_tag; } @@ -2600,22 +2526,22 @@ void UT_os_closefilebyname_test() testDesc = "#1 Null-pointer-arg"; if (OS_CloseFileByName(NULL) == OS_FS_ERR_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Invalid-path-arg"; if (OS_CloseFileByName(g_invalidPath) == OS_FS_ERR_PATH_INVALID) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#4 Nominal"; @@ -2626,27 +2552,27 @@ void UT_os_closefilebyname_test() if (g_fDescs[0] < 0) { testDesc = "#4 Nominal - File-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_closefilebyname_test_exit_tag; } if (OS_CloseFileByName(g_fNames[0]) != OS_FS_SUCCESS) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); goto UT_os_closefilebyname_test_exit_tag; } if (OS_FileOpenCheck(g_fNames[0]) == OS_FS_ERROR) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ OS_remove(g_fNames[0]); UT_os_closefilebyname_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_CloseFileByName", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*================================================================================* diff --git a/src/unit-tests/osfile-test/ut_osfile_fileio_test.h b/src/unit-tests/osfile-test/ut_osfile_fileio_test.h index 112420388..7f5960c98 100644 --- a/src/unit-tests/osfile-test/ut_osfile_fileio_test.h +++ b/src/unit-tests/osfile-test/ut_osfile_fileio_test.h @@ -11,7 +11,7 @@ ** Includes **--------------------------------------------------------------------------------*/ -#include "ut_os_stubs.h" +#include "ut_os_support.h" /*--------------------------------------------------------------------------------* ** Macros diff --git a/src/unit-tests/osfile-test/ut_osfile_test.c b/src/unit-tests/osfile-test/ut_osfile_test.c index 2e4c9278a..584b8de8a 100644 --- a/src/unit-tests/osfile-test/ut_osfile_test.c +++ b/src/unit-tests/osfile-test/ut_osfile_test.c @@ -22,20 +22,15 @@ ** External global variables **--------------------------------------------------------------------------------*/ -extern UT_OsLogInfo_t g_logInfo; - /*--------------------------------------------------------------------------------* ** Global variables **--------------------------------------------------------------------------------*/ char* g_fsAddrPtr = NULL; -int32 g_skipTestCase = -1; -const char* g_skipTestCaseResult = " "; - -char g_longPathName[OS_MAX_PATH_LEN+5]; -char g_longFileName[OS_MAX_PATH_LEN]; -char g_invalidPath[OS_MAX_PATH_LEN]; +char g_longPathName[UT_OS_PATH_BUFF_SIZE]; +char g_longFileName[UT_OS_PATH_BUFF_SIZE]; +char g_invalidPath[UT_OS_PATH_BUFF_SIZE]; const char* g_devName = "/ramdev3"; const char* g_mntName = "/drive3"; @@ -49,7 +44,7 @@ const char* g_mntName = "/drive3"; **--------------------------------------------------------------------------------*/ int32 UT_os_setup_fs(void); -int32 UT_os_teardown_fs(void); +void UT_os_teardown_fs(void); void UT_os_init_file_misc(void); @@ -59,33 +54,33 @@ void UT_os_init_file_misc(void); int32 UT_os_setup_fs() { - int32 res=OS_FS_SUCCESS; + int32 res; res = OS_mkfs(g_fsAddrPtr, g_devName, " ", 512, 20); if (res != OS_FS_SUCCESS) + { + UT_OS_LOG("OS_mkfs() returns %d\n", (int)res);; goto UT_os_setup_fs_exit_tag; + } res = OS_mount(g_devName, g_mntName); if (res != OS_FS_SUCCESS) { + UT_OS_LOG("OS_mount() returns %d\n", (int)res);; OS_rmfs(g_devName); goto UT_os_setup_fs_exit_tag; } UT_os_setup_fs_exit_tag: - UT_OS_LOG_MACRO("\nUT_os_setup_fs() returns %d\n", (int)res); - return (res); } /*--------------------------------------------------------------------------------*/ -int32 UT_os_teardown_fs() +void UT_os_teardown_fs() { OS_unmount(g_mntName); OS_rmfs(g_devName); - - return (OS_FS_SUCCESS); } /*--------------------------------------------------------------------------------*/ @@ -96,10 +91,14 @@ void UT_os_init_file_misc() g_longPathName[0] = '/'; g_longPathName[sizeof(g_longPathName)-1] = '\0'; + /* + * The "g_longFileName" should be within the OS_MAX_PATH_LEN limit, + * but the filename portion of it exceeds the OS_MAX_FILE_NAME limit. + */ memset(g_longFileName, 'Z', sizeof(g_longFileName)); g_longFileName[0] = '/'; g_longFileName[4] = '/'; - g_longFileName[sizeof(g_longFileName)-1] = '\0'; + g_longFileName[OS_MAX_FILE_NAME+9] = '\0'; memset(g_invalidPath, '\0', sizeof(g_invalidPath)); strcpy(g_invalidPath, "/InvalidMnt/log1.txt"); @@ -111,13 +110,6 @@ void UT_os_init_file_misc() void OS_Application_Startup(void) { - UT_os_setup(UT_OS_LOG_FILENAME); - - /* UT_OS_LOG_OFF, UT_OS_LOG_MINIMAL, UT_OS_LOG_MODERATE, UT_OS_LOG_EVERYTHING */ - UT_os_set_log_verbose(UT_OS_LOG_EVERYTHING); - - UT_OS_LOG_MACRO("OSAL Unit Test Output File for osfile APIs\n"); - UT_os_initfs_test(); if (UT_os_setup_fs() == OS_FS_SUCCESS) @@ -125,45 +117,41 @@ void OS_Application_Startup(void) UT_os_init_file_misc(); /* Directory I/O APIs */ - UT_os_makedir_test(); - UT_os_opendir_test(); - UT_os_closedir_test(); + UtTest_Add(UT_os_makedir_test, NULL, NULL, "OS_mkdir"); + UtTest_Add(UT_os_opendir_test, NULL, NULL, "OS_opendir"); + UtTest_Add(UT_os_closedir_test, NULL, NULL, "OS_closedir"); - UT_os_readdir_test(); - UT_os_rewinddir_test(); - UT_os_removedir_test(); + UtTest_Add(UT_os_readdir_test, NULL, NULL, "OS_readdir"); + UtTest_Add(UT_os_rewinddir_test, NULL, NULL, "OS_rewinddir"); + UtTest_Add(UT_os_removedir_test, NULL, NULL, "OS_rmdir"); /* File I/O APIs */ - UT_os_createfile_test(); - UT_os_openfile_test(); - UT_os_closefile_test(); + UtTest_Add(UT_os_createfile_test, NULL, NULL, "OS_creat"); + UtTest_Add(UT_os_openfile_test, NULL, NULL, "OS_open"); + UtTest_Add(UT_os_closefile_test, NULL, NULL, "OS_close"); - UT_os_readfile_test(); - UT_os_writefile_test(); - UT_os_lseekfile_test(); + UtTest_Add(UT_os_readfile_test, NULL, NULL, "OS_read"); + UtTest_Add(UT_os_writefile_test, NULL, NULL, "OS_write"); + UtTest_Add(UT_os_lseekfile_test, NULL, NULL, "OS_lseek"); - UT_os_chmodfile_test(); - UT_os_statfile_test(); + UtTest_Add(UT_os_chmodfile_test, NULL, NULL, "OS_chmod"); + UtTest_Add(UT_os_statfile_test, NULL, NULL, "OS_stat"); - UT_os_removefile_test(); - UT_os_renamefile_test(); - UT_os_copyfile_test(); - UT_os_movefile_test(); + UtTest_Add(UT_os_removefile_test, NULL, NULL, "OS_remove"); + UtTest_Add(UT_os_renamefile_test, NULL, NULL, "OS_rename"); + UtTest_Add(UT_os_copyfile_test, NULL, NULL, "OS_cp"); + UtTest_Add(UT_os_movefile_test, NULL, NULL, "OS_mv"); - UT_os_outputtofile_test(); + UtTest_Add(UT_os_outputtofile_test, NULL, NULL, "OS_ShellOutputToFile"); - UT_os_getfdinfo_test(); - UT_os_checkfileopen_test(); + UtTest_Add(UT_os_getfdinfo_test, NULL, NULL, "OS_FDGetInfo"); + UtTest_Add(UT_os_checkfileopen_test, NULL, NULL, "OS_FileOpenCheck"); - UT_os_closeallfiles_test(); - UT_os_closefilebyname_test(); + UtTest_Add(UT_os_closeallfiles_test, NULL, NULL, "OS_CloseAllFiles"); + UtTest_Add(UT_os_closefilebyname_test, NULL, NULL, "OS_CloseFileByName"); - UT_os_teardown_fs(); + UtTest_Add(NULL, NULL, UT_os_teardown_fs, "TEARDOWN"); } - - UT_os_teardown("ut_osfile"); - - OS_ApplicationExit(g_logInfo.nFailed > 0); } /*================================================================================* diff --git a/src/unit-tests/osfile-test/ut_osfile_test.h b/src/unit-tests/osfile-test/ut_osfile_test.h index 9943a8f8a..1df704839 100644 --- a/src/unit-tests/osfile-test/ut_osfile_test.h +++ b/src/unit-tests/osfile-test/ut_osfile_test.h @@ -11,7 +11,7 @@ ** Includes **--------------------------------------------------------------------------------*/ -#include "ut_os_stubs.h" +#include "ut_os_support.h" #include "ut_osfile_fileio_test.h" #include "ut_osfile_dirio_test.h" @@ -19,8 +19,6 @@ ** Macros **--------------------------------------------------------------------------------*/ -#define UT_OS_LOG_FILENAME "ut_osfile_log.txt" - /*--------------------------------------------------------------------------------* ** Data types **--------------------------------------------------------------------------------*/ @@ -37,10 +35,6 @@ ** Function prototypes **--------------------------------------------------------------------------------*/ -#ifdef _ARINC653_OS_ -void UT_main(void); -#endif /* _ARINC653_OS_ */ - /*--------------------------------------------------------------------------------*/ #endif /* _UT_OSFILE_TEST_H_ */ diff --git a/src/unit-tests/osfile-test/ut_osfile_test_arinc653.c b/src/unit-tests/osfile-test/ut_osfile_test_arinc653.c deleted file mode 100644 index 8722ff4f9..000000000 --- a/src/unit-tests/osfile-test/ut_osfile_test_arinc653.c +++ /dev/null @@ -1,200 +0,0 @@ -/*================================================================================* -** File: ut_osfile_test_arinc653.c -** Owner: Tam Ngo -** Date: May 2013 -**================================================================================*/ - -/*--------------------------------------------------------------------------------* -** Includes -**--------------------------------------------------------------------------------*/ - -#include "ut_osfile_test.h" - -/*--------------------------------------------------------------------------------* -** Macros -**--------------------------------------------------------------------------------*/ - -#define UT_OS_FS_BLOCK_SIZE 512 -#define UT_OS_FS_MAX_BLOCKS 20 - -#define UT_OS_FS_MEM_SPACE (2 * UT_OS_FS_BLOCK_SIZE * UT_OS_FS_MAX_BLOCKS) - -/*--------------------------------------------------------------------------------* -** Data types -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** External global variables -**--------------------------------------------------------------------------------*/ - -extern UT_OsLogInfo_t g_logInfo; - -/*--------------------------------------------------------------------------------* -** Global variables -**--------------------------------------------------------------------------------*/ - -char g_fsMemSpace[UT_OS_FS_MEM_SPACE]; /* This variable must not be moved. */ -char* g_fsAddrPtr = &g_fsMemSpace[9]; /* Offset to be 32-bit aligned, - which is important for the PIRD layer */ -int32 g_skipTestCase = -1; -char* g_skipTestCaseResult = " "; - -char g_longPathName[OS_MAX_PATH_LEN+5]; -char g_longFileName[OS_MAX_PATH_LEN]; -char g_invalidPath[OS_MAX_PATH_LEN]; - -char* g_devName = "/ramdev1"; -char* g_mntName = "/drive1"; - -/*--------------------------------------------------------------------------------* -** External function prototypes -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Local function prototypes -**--------------------------------------------------------------------------------*/ - -int32 UT_os_setup_fs(void); -int32 UT_os_teardown_fs(void); - -void UT_os_init_file_misc(void); -void UT_os_init_rewinddir_test(void); -void UT_os_init_outputtofile_test(void); - -/*--------------------------------------------------------------------------------* -** Local function definitions -**--------------------------------------------------------------------------------*/ - -int32 UT_os_setup_fs() -{ - int32 res = OS_FS_SUCCESS; - char text[UT_OS_LG_TEXT_LEN]; - - res = OS_mkfs(g_fsAddrPtr, g_devName, " ", UT_OS_FS_BLOCK_SIZE, UT_OS_FS_MAX_BLOCKS); - if (res != OS_FS_SUCCESS) - goto UT_os_setup_fs_exit_tag; - - res = OS_mount(g_devName, g_mntName); - if (res != OS_FS_SUCCESS) - { - OS_rmfs(g_devName); - goto UT_os_setup_fs_exit_tag; - } - -UT_os_setup_fs_exit_tag: - memset(text, '\0', sizeof(text)); - OS_sprintf(text, "\nUT_os_setup_fs() returns %d\n", (int)res); - UT_OS_LOG_MACRO(text); - - return (res); -} - -/*--------------------------------------------------------------------------------*/ - -int32 UT_os_teardown_fs() -{ - OS_unmount(g_mntName); - OS_rmfs(g_devName); - - return (OS_FS_SUCCESS); -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_init_file_misc() -{ - memset(g_longPathName, 'Y', sizeof(g_longPathName)); - g_longPathName[0] = '/'; - g_longPathName[sizeof(g_longPathName)-1] = '\0'; - - memset(g_longFileName, 'Z', sizeof(g_longFileName)); - g_longFileName[0] = '/'; - g_longFileName[4] = '/'; - g_longFileName[sizeof(g_longFileName)-1] = '\0'; - - memset(g_invalidPath, '\0', sizeof(g_invalidPath)); - strcpy(g_invalidPath, "log1.txt"); -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_init_rewinddir_test() -{ - g_skipTestCase = 3; - g_skipTestCaseResult = UT_OS_NA; -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_init_outputtofile_test() -{ - g_skipTestCase = 0; - g_skipTestCaseResult = UT_OS_NA; -} - -/*--------------------------------------------------------------------------------* -** Main -**--------------------------------------------------------------------------------*/ -void UT_main() -{ - UT_os_setup(UT_OS_LOG_FILENAME); - - /* UT_OS_LOG_OFF, UT_OS_LOG_MINIMAL, UT_OS_LOG_MODERATE, UT_OS_LOG_EVERYTHING */ - UT_os_set_log_verbose(UT_OS_LOG_EVERYTHING); - - UT_OS_LOG_MACRO("OSAL Unit Test Output File for ARINC653-implementation of osfile APIs\n"); - - UT_os_initfs_test(); - - if (UT_os_setup_fs() == OS_FS_SUCCESS) - { - UT_os_init_file_misc(); - - /* Directory I/O APIs */ - UT_os_makedir_test(); - UT_os_opendir_test(); - UT_os_closedir_test(); - - UT_os_readdir_test(); - - UT_os_init_rewinddir_test(); - UT_os_rewinddir_test(); - - UT_os_removedir_test(); - - /* File I/O APIs */ - UT_os_createfile_test(); - - UT_os_openfile_test(); - UT_os_closefile_test(); - - UT_os_readfile_test(); - UT_os_writefile_test(); - UT_os_lseekfile_test(); - - UT_os_chmodfile_test(); - UT_os_statfile_test(); - - UT_os_removefile_test(); - UT_os_renamefile_test(); - UT_os_copyfile_test(); - UT_os_movefile_test(); - - UT_os_init_outputtofile_test(); - UT_os_outputtofile_test(); - - UT_os_getfdinfo_test(); - UT_os_checkfileopen_test(); - - UT_os_closeallfiles_test(); - UT_os_closefilebyname_test(); - - UT_os_teardown_fs(); - } - - UT_os_teardown("ut_osfile"); -} - -/*================================================================================* -** End of File: ut_osfile_test_arinc653.c -**================================================================================*/ diff --git a/src/unit-tests/osfile-test/ut_osfile_test_platforms.h b/src/unit-tests/osfile-test/ut_osfile_test_platforms.h deleted file mode 100644 index bdc0994a0..000000000 --- a/src/unit-tests/osfile-test/ut_osfile_test_platforms.h +++ /dev/null @@ -1,100 +0,0 @@ -/*================================================================================* -** File: ut_osfile_test_platforms.h -** Owner: Tam Ngo -** Date: September 2013 -**================================================================================*/ - -#ifndef _UT_OSFILE_TEST_PLATFORMS_H_ -#define _UT_OSFILE_TEST_PLATFORMS_H_ - -/*--------------------------------------------------------------------------------* -** Includes -**--------------------------------------------------------------------------------*/ - -#ifdef _LINUX_OS_ -#endif /* _LINUX_OS_ */ - -#ifdef OSP_ARINC653 -#include "apex_api.h" -#endif /* OSP_ARINC653 */ - -/*--------------------------------------------------------------------------------* -** Macros -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------*/ -#ifdef _LINUX_OS_ -/*--------------------------------------------*/ - -#define UT_OS_OUTPUT_TO_FILE_SUCCESS_COND_MACRO \ - strncmp(g_readBuff, "UT_os_outputtofile_test", 7) == 0 - -/*--------------------------------------------------------------------------------*/ - -#define UT_OS_COMPARE_COND_FOR_NOMINAL_GETFDINFO_MACRO \ -if ((OS_FDGetInfo(g_fDescs[0], &fdProps) != OS_FS_SUCCESS) || \ - (fdProps.IsValid != true) || \ - (strncmp(fdProps.Path, g_fNames[0], strlen(g_fNames[0])) != 0)) - -/*--------------------------------------------*/ -#endif /* _LINUX_OS_ */ -/*--------------------------------------------*/ - -/*--------------------------------------------*/ -#ifdef _VXWORKS_OS_ -/*--------------------------------------------*/ - -#define UT_OS_OUTPUT_TO_FILE_SUCCESS_COND_MACRO \ - strncmp(&g_readBuff[1], cmd, strlen(cmd)) == 0 - -/*--------------------------------------------------------------------------------*/ - -#define UT_OS_COMPARE_COND_FOR_NOMINAL_GETFDINFO_MACRO \ -if ((OS_FDGetInfo(g_fDescs[0], &fdProps) != OS_FS_SUCCESS) || \ - (fdProps.IsValid != true) || \ - (strncmp(fdProps.Path, g_fNames[0], strlen(g_fNames[0])) != 0)) - -/*--------------------------------------------*/ -#endif /* _VXWORKS_OS_ */ -/*--------------------------------------------*/ - -/*--------------------------------------------*/ -#if defined(OSP_ARINC653) || defined(_RTEMS_OS_) -/*--------------------------------------------*/ - -#define UT_OS_OUTPUT_TO_FILE_SUCCESS_COND_MACRO 1 - -/*--------------------------------------------------------------------------------*/ - -#define UT_OS_COMPARE_COND_FOR_NOMINAL_GETFDINFO_MACRO \ -if ((OS_FDGetInfo(g_fDescs[0], &fdProps) != OS_FS_SUCCESS) || \ - (fdProps.IsValid != true) || \ - (strncmp(fdProps.Path, fileName, strlen(fileName)) != 0)) - -/*--------------------------------------------*/ -#endif /* OSP_ARINC653 */ -/*--------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Data types -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** External global variables -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Global variables -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Function prototypes -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------*/ - -#endif /* _UT_OSFILE_TEST_PLATFORMS_H_ */ - -/*================================================================================* -** End of File: ut_osfile_test_platforms.h -**================================================================================*/ diff --git a/src/unit-tests/osfilesys-test/CMakeLists.txt b/src/unit-tests/osfilesys-test/CMakeLists.txt index 9dd0208d5..4f7e839ea 100644 --- a/src/unit-tests/osfilesys-test/CMakeLists.txt +++ b/src/unit-tests/osfilesys-test/CMakeLists.txt @@ -4,6 +4,5 @@ set(TEST_MODULE_FILES ut_osfilesys_diskio_test.c ut_osfilesys_test.c) -add_stubs(TEST_STUBS os) -add_osal_ut_exe(osal_filesys_UT ${TEST_MODULE_FILES} ${TEST_STUBS}) +add_osal_ut_exe(osal_filesys_UT ${TEST_MODULE_FILES}) diff --git a/src/unit-tests/osfilesys-test/ut_osfilesys_diskio_test.c b/src/unit-tests/osfilesys-test/ut_osfilesys_diskio_test.c index ee01f17d9..f38cba3b7 100644 --- a/src/unit-tests/osfilesys-test/ut_osfilesys_diskio_test.c +++ b/src/unit-tests/osfilesys-test/ut_osfilesys_diskio_test.c @@ -22,22 +22,17 @@ ** External global variables **--------------------------------------------------------------------------------*/ -extern UT_OsLogInfo_t g_logInfo; - extern char* g_fsAddrPtr; extern int32 g_blkSize; extern int32 g_blkCnt; -extern int32 g_skipTestCase; -extern char* g_skipTestCaseResult; - -extern char g_fsLongName[OS_MAX_PATH_LEN+5]; -extern char g_physDriveName[OS_MAX_PATH_LEN]; +extern char g_fsLongName[UT_OS_PATH_BUFF_SIZE]; +extern char g_physDriveName[UT_OS_PHYS_NAME_BUFF_SIZE]; -extern char g_volNames[UT_OS_FILESYS_LIST_LEN][UT_OS_XS_TEXT_LEN]; -extern char g_devNames[UT_OS_FILESYS_LIST_LEN][UT_OS_XS_TEXT_LEN]; -extern char g_mntNames[UT_OS_FILESYS_LIST_LEN][UT_OS_XS_TEXT_LEN]; +extern char g_volNames[UT_OS_FILESYS_LIST_LEN][UT_OS_NAME_BUFF_SIZE]; +extern char g_devNames[UT_OS_FILESYS_LIST_LEN][UT_OS_FILE_BUFF_SIZE]; +extern char g_mntNames[UT_OS_FILESYS_LIST_LEN][UT_OS_FILE_BUFF_SIZE]; /*--------------------------------------------------------------------------------* ** Global variables @@ -63,11 +58,7 @@ void UT_os_sample_test() /* Must declare these variables for each function. They can be renamed. * They're referenced in the macros used to track test cases and their results. */ int32 idx = 0; - UT_OsApiInfo_t apiInfo; - const char* testDesc = NULL; - - /* Call this once at the beginning of the function to initialize the test variables. */ - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------* * For each test case, @@ -89,7 +80,7 @@ void UT_os_sample_test() if (OS_xxx() == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_sample_test_exit_tag; } @@ -101,9 +92,9 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(NULL,...) == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* TODO: Reset the test environment here, if necessary */ @@ -113,9 +104,9 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(aVeryLoooooongName) == OS_ERR_NAME_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* TODO: Reset the test environment here, if necessary */ @@ -125,17 +116,15 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(...) != OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); /* TODO: Reset the test environment here, if necessary */ UT_os_sample_test_exit_tag: - /* Call these macros at the very end of the function to close out the test variables - * and get it added to the global list being tracked. */ - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_xxx", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } #endif @@ -194,11 +183,8 @@ void UT_os_sample_test() **--------------------------------------------------------------------------------*/ void UT_os_initfs_test() { - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - int32 res=0, idx=0, i=0, j=0; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; + int32 res=0, i=0, j=0; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -206,7 +192,7 @@ void UT_os_initfs_test() res = OS_initfs(NULL, NULL, NULL, g_blkSize, g_blkCnt); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_initfs_test_exit_tag; } @@ -217,10 +203,9 @@ void UT_os_initfs_test() OS_FS_ERR_INVALID_POINTER) && (OS_initfs(g_fsAddrPtr, g_devNames[1], NULL, 0, 0) == OS_FS_ERR_INVALID_POINTER)) - /* cppcheck-suppress syntaxError */ - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Path-too-long-arg"; @@ -229,20 +214,18 @@ void UT_os_initfs_test() OS_FS_ERR_PATH_TOO_LONG) && (OS_initfs(g_fsAddrPtr, g_devNames[2], g_fsLongName, g_blkSize, g_blkCnt) == OS_FS_ERR_PATH_TOO_LONG)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#4 Disk-full"; - UT_os_print_volumetable("VOLUME TABLE _BEFORE_ DISK-FULL TEST SETUP FOR OS_initfs()"); - for (i=0; i <= NUM_TABLE_ENTRIES; i++) { memset(g_devNames[i], '\0', sizeof(g_devNames[i])); @@ -254,41 +237,33 @@ void UT_os_initfs_test() break; } - UT_os_print_volumetable("VOLUME TABLE _AFTER_ DISK-FULL TEST SETUP FOR OS_initfs()"); - /* Only need to check the last call to OS_initfs() */ if (res == OS_FS_ERR_DEVICE_NOT_FREE) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ for (j=0; j < i; j++) OS_rmfs(g_devNames[j]); - UT_os_print_volumetable("VOLUME TABLE _AFTER_ DISK-FULL TEST TEARDOWN FOR OS_initfs()"); - /*-----------------------------------------------------*/ testDesc = "#5 Nominal"; - UT_os_print_volumetable("VOLUME TABLE _BEFORE_ NOMINAL TEST SETUP FOR OS_initfs()"); - if (OS_initfs(g_fsAddrPtr, g_devNames[5], g_volNames[5], g_blkSize, g_blkCnt) != OS_FS_SUCCESS) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); goto UT_os_initfs_test_exit_tag; } if (OS_rmfs(g_devNames[5]) == OS_FS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) - - UT_os_print_volumetable("VOLUME TABLE _AFTER_ NOMINAL TEST FOR OS_initfs()"); + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); UT_os_initfs_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_initfs", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -346,11 +321,8 @@ void UT_os_initfs_test() **--------------------------------------------------------------------------------*/ void UT_os_makefs_test() { - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - int32 res=0, idx=0, i=0, j=0; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; + int32 res=0, i=0, j=0; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -358,7 +330,7 @@ void UT_os_makefs_test() res = OS_mkfs(g_fsAddrPtr, NULL, NULL, g_blkSize, g_blkCnt); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_makefs_test_exit_tag; } @@ -367,9 +339,9 @@ void UT_os_makefs_test() if ((OS_mkfs(g_fsAddrPtr, NULL, g_volNames[1], 0, 0) == OS_FS_ERR_INVALID_POINTER) && (OS_mkfs(g_fsAddrPtr, g_devNames[1], NULL, 0, 0) == OS_FS_ERR_INVALID_POINTER)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Path-too-long-arg"; @@ -378,18 +350,17 @@ void UT_os_makefs_test() OS_FS_ERR_PATH_TOO_LONG) && (OS_mkfs(g_fsAddrPtr, g_devNames[2], g_fsLongName, g_blkSize, g_blkCnt) == OS_FS_ERR_PATH_TOO_LONG)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#4 Disk-full"; - UT_os_print_volumetable("VOLUME TABLE _BEFORE_ DISK-FULL TEST SETUP FOR OS_mkfs()"); for (i=0; i <= NUM_TABLE_ENTRIES; i++) { @@ -402,41 +373,33 @@ void UT_os_makefs_test() break; } - UT_os_print_volumetable("VOLUME TABLE _AFTER_ DISK-FULL TEST SETUP FOR OS_mkfs()"); - /* Only need to check the last call to OS_mkfs() */ if (res == OS_FS_ERR_DEVICE_NOT_FREE) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ for (j=0; j < i; j++) OS_rmfs(g_devNames[j]); - UT_os_print_volumetable("VOLUME TABLE _AFTER_ DISK-FULL TEST TEARDOWN FOR OS_mkfs()"); - /*-----------------------------------------------------*/ testDesc = "#5 Nominal"; - UT_os_print_volumetable("VOLUME TABLE _BEFORE_ NOMINAL TEST SETUP FOR OS_mkfs()"); - if (OS_mkfs(g_fsAddrPtr, g_devNames[5], g_volNames[5], g_blkSize, g_blkCnt) != OS_FS_SUCCESS) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); goto UT_os_makefs_test_exit_tag; } if (OS_rmfs(g_devNames[5]) == OS_FS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) - - UT_os_print_volumetable("VOLUME TABLE _AFTER_ NOMINAL TEST FOR OS_mkfs()"); + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); UT_os_makefs_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_mkfs", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -478,11 +441,8 @@ void UT_os_makefs_test() **--------------------------------------------------------------------------------*/ void UT_os_removefs_test() { - int32 res=0, idx=0; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + int32 res=0; + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -490,7 +450,7 @@ void UT_os_removefs_test() res = OS_rmfs(NULL); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_removefs_test_exit_tag; } @@ -498,17 +458,17 @@ void UT_os_removefs_test() testDesc = "#1 Null-pointer-arg"; if (OS_rmfs(NULL) == OS_FS_ERR_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Invalid-device-arg"; if (OS_rmfs(g_devNames[2]) == OS_FS_ERROR) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Nominal"; @@ -516,22 +476,22 @@ void UT_os_removefs_test() if (OS_mkfs(g_fsAddrPtr, g_devNames[3], g_volNames[3], g_blkSize, g_blkCnt) != OS_FS_SUCCESS) { testDesc = "#3 Nominal - File-system-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_removefs_test_exit_tag; } if ((OS_rmfs(g_devNames[3]) == OS_FS_SUCCESS) && (OS_mkfs(g_fsAddrPtr, g_devNames[3], g_volNames[3], g_blkSize, g_blkCnt) == OS_FS_SUCCESS)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ OS_rmfs(g_devNames[3]); UT_os_removefs_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_rmfs", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -578,11 +538,8 @@ void UT_os_removefs_test() **--------------------------------------------------------------------------------*/ void UT_os_mount_test() { - int32 res=0, idx=0; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + int32 res=0; + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -590,7 +547,7 @@ void UT_os_mount_test() res = OS_mount(NULL, NULL); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_mount_test_exit_tag; } @@ -599,47 +556,41 @@ void UT_os_mount_test() if ((OS_mount(NULL, g_mntNames[1]) == OS_FS_ERR_INVALID_POINTER) && (OS_mount(g_devNames[1], NULL) == OS_FS_ERR_INVALID_POINTER)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Invalid-device-arg"; if (OS_mount("ramdev0", g_mntNames[2]) == OS_FS_ERROR) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Nominal"; - UT_os_print_volumetable("VOLUME TABLE _BEFORE_ NOMINAL TEST SETUP FOR OS_mount()"); - if (OS_mkfs(g_fsAddrPtr, g_devNames[3], g_volNames[3], g_blkSize, g_blkCnt) != OS_FS_SUCCESS) { testDesc = "#3 Nominal - File-system-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_mount_test_exit_tag; } if ((OS_mount(g_devNames[3], g_mntNames[3]) == OS_FS_SUCCESS) && (OS_mount(g_devNames[3], g_mntNames[3]) == OS_FS_ERROR)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) - - UT_os_print_volumetable("VOLUME TABLE _AFTER_ NOMINAL TEST FOR OS_mount()"); + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ OS_unmount(g_mntNames[3]); OS_rmfs(g_devNames[3]); - UT_os_print_volumetable("VOLUME TABLE _AFTER_ NOMINAL TEST TEARDOWN FOR OS_mount()"); - UT_os_mount_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_mount", idx) - UT_OS_LOG_API_MACRO(apiInfo)} + return; +} /*--------------------------------------------------------------------------------* ** Syntax: int32 OS_unmount(const char *mountpoint) @@ -692,11 +643,8 @@ void UT_os_mount_test() **--------------------------------------------------------------------------------*/ void UT_os_unmount_test() { - int32 res=0, idx=0; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + int32 res=0; + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -704,7 +652,7 @@ void UT_os_unmount_test() res = OS_unmount(NULL); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_unmount_test_exit_tag; } @@ -712,25 +660,25 @@ void UT_os_unmount_test() testDesc = "#1 Null-pointer-arg"; if (OS_unmount(NULL) == OS_FS_ERR_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Path-too-long-arg"; if (OS_unmount(g_fsLongName) == OS_FS_ERR_PATH_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Invalid-mount-point-arg"; if (OS_unmount(g_mntNames[3]) == OS_FS_ERROR) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#4 Nominal"; @@ -738,23 +686,23 @@ void UT_os_unmount_test() if (OS_mkfs(g_fsAddrPtr, g_devNames[4], g_volNames[4], g_blkSize, g_blkCnt) != OS_FS_SUCCESS) { testDesc = "#3 Nominal - File-system-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_unmount_test_exit_tag; } if ((OS_mount(g_devNames[4], g_mntNames[4]) == OS_FS_SUCCESS) && (OS_unmount(g_mntNames[4]) == OS_FS_SUCCESS) && (OS_unmount(g_mntNames[4]) == OS_FS_ERROR)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ OS_rmfs(g_devNames[4]); UT_os_unmount_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_unmount", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -807,12 +755,9 @@ void UT_os_unmount_test() ** --------------------------------------------------------------------------------*/ void UT_os_getphysdrivename_test() { - int32 res=0, idx=0; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - char physDevName[UT_OS_LG_TEXT_LEN]; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + int32 res=0; + const char* testDesc; + char physDevName[UT_OS_PHYS_NAME_BUFF_SIZE]; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -820,7 +765,7 @@ void UT_os_getphysdrivename_test() res = OS_FS_GetPhysDriveName(NULL, NULL); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_getphysicaldrivename_test_exit_tag; } @@ -829,25 +774,25 @@ void UT_os_getphysdrivename_test() if ((OS_FS_GetPhysDriveName(NULL, g_mntNames[1]) == OS_FS_ERR_INVALID_POINTER) && (OS_FS_GetPhysDriveName(physDevName, NULL) == OS_FS_ERR_INVALID_POINTER)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Path-too-long-arg"; if (OS_FS_GetPhysDriveName(physDevName, g_fsLongName) == OS_FS_ERR_PATH_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Invalid-mount-point-arg"; if (OS_FS_GetPhysDriveName(physDevName, g_mntNames[3]) == OS_FS_ERROR) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#4 Nominal"; @@ -855,33 +800,31 @@ void UT_os_getphysdrivename_test() if (OS_mkfs(g_fsAddrPtr, g_devNames[4], g_volNames[4], g_blkSize, g_blkCnt) != OS_FS_SUCCESS) { testDesc = "#4 Nominal - File-system-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_getphysicaldrivename_test_exit_tag; } if (OS_mount(g_devNames[4], g_mntNames[4]) != OS_FS_SUCCESS) { testDesc = "#4 Nominal - File-system-mount failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_getphysicaldrivename_test_exit_tag; } - UT_os_print_volumetable("VOLUME TABLE _AFTER_ NOMINAL TEST SETUP for OS_FS_GetPhysDriveName()"); - memset(physDevName, '\0', sizeof(physDevName)); if ((OS_FS_GetPhysDriveName(physDevName, g_mntNames[4]) == OS_FS_SUCCESS) && (strncmp(physDevName, g_physDriveName, strlen(g_physDriveName)) == 0)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ OS_unmount(g_mntNames[4]); OS_rmfs(g_devNames[4]); UT_os_getphysicaldrivename_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_FS_GetPhysDriveName", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -909,11 +852,8 @@ void UT_os_getphysdrivename_test() void UT_os_getfsinfo_test(void) { os_fsinfo_t fsInfo; - int32 res=0, idx=0; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + int32 res=0; + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -921,7 +861,7 @@ void UT_os_getfsinfo_test(void) res = OS_GetFsInfo(&fsInfo); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_getfsinfo_test_exit_tag; } @@ -929,21 +869,21 @@ void UT_os_getfsinfo_test(void) testDesc = "#1 Null-pointer-arg"; if (OS_GetFsInfo(NULL) == OS_FS_ERR_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Nominal"; if (OS_GetFsInfo(&fsInfo) == OS_FS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); UT_os_getfsinfo_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_GetFsInfo", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -995,12 +935,9 @@ void UT_os_getfsinfo_test(void) ** --------------------------------------------------------------------------------*/ void UT_os_translatepath_test() { - int32 res=0, idx=0; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - char localPath[UT_OS_LG_TEXT_LEN]; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + int32 res=0; + const char* testDesc; + char localPath[UT_OS_LOCAL_PATH_BUFF_SIZE]; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -1008,7 +945,7 @@ void UT_os_translatepath_test() res = OS_TranslatePath(NULL, NULL); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_translatepath_test_exit_tag; } @@ -1017,26 +954,26 @@ void UT_os_translatepath_test() if ((OS_TranslatePath(NULL, localPath) == OS_FS_ERR_INVALID_POINTER) && (OS_TranslatePath(g_mntNames[1], NULL) == OS_FS_ERR_INVALID_POINTER)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Path-too-long-arg"; if (OS_TranslatePath(g_fsLongName, localPath) == OS_FS_ERR_PATH_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Invalid-virtual-path-arg"; if ((OS_TranslatePath("cf", localPath) == OS_FS_ERR_PATH_INVALID) && (OS_TranslatePath("/foobar", localPath) == OS_FS_ERR_PATH_INVALID)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#4 Nominal"; @@ -1045,14 +982,14 @@ void UT_os_translatepath_test() OS_FS_SUCCESS) { testDesc = "#4 Nominal - File-system-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_translatepath_test_exit_tag; } if (OS_mount(g_devNames[4], g_mntNames[4]) != OS_FS_SUCCESS) { testDesc = "#4 Nominal - File-system-mount failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); /* Reset test environment */ OS_rmfs(g_devNames[4]); @@ -1062,17 +999,17 @@ void UT_os_translatepath_test() if ((OS_TranslatePath(g_mntNames[4], localPath) == OS_FS_SUCCESS) && (strncmp(localPath, g_physDriveName, strlen(g_physDriveName)) == 0)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ OS_unmount(g_mntNames[4]); OS_rmfs(g_devNames[4]); UT_os_translatepath_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_TranslatePath (internal)", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -1113,29 +1050,26 @@ void UT_os_translatepath_test() ** --------------------------------------------------------------------------------*/ void UT_os_checkfs_test() { - int32 idx=0; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - char driveName[OS_MAX_PATH_LEN + 5]; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; + int res; + char driveName[UT_OS_PATH_BUFF_SIZE]; /*-----------------------------------------------------*/ testDesc = "API not implemented"; - if ((int)OS_chkfs(NULL, 0) == OS_FS_UNIMPLEMENTED) + if (OS_chkfs(NULL, 0) == OS_FS_UNIMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_checkfs_test_exit_tag; } /*-----------------------------------------------------*/ testDesc = "#1 Null-pointer-arg"; - if ((int)OS_chkfs(NULL, 0) == OS_FS_ERR_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + if (OS_chkfs(NULL, 0) == OS_FS_ERR_INVALID_POINTER) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Path-too-long-arg"; @@ -1143,53 +1077,55 @@ void UT_os_checkfs_test() memset(driveName, 'A', sizeof(driveName)); driveName[sizeof(driveName)-1] = '\0'; - if ((int)OS_chkfs(driveName, 0) == OS_FS_ERR_PATH_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + if (OS_chkfs(driveName, 0) == OS_FS_ERR_PATH_TOO_LONG) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#4 Nominal"; - if (g_skipTestCase == 4) + if (OS_mkfs(g_fsAddrPtr, g_devNames[5], g_volNames[5], g_blkSize, g_blkCnt) != OS_FS_SUCCESS) + { + testDesc = "#4 Nominal - File-system-create failed"; + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); + goto UT_os_checkfs_test_exit_tag; + } + + if (OS_mount(g_devNames[5], g_mntNames[5]) != OS_FS_SUCCESS) + { + testDesc = "#4 Nominal - File-system-mount failed"; + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); + goto UT_os_checkfs_test_exit_tag; + } + + res = OS_chkfs(g_mntNames[5], 0); + if (res == OS_ERR_NOT_IMPLEMENTED) { testDesc = "#4 Nominal - Not implemented in API"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, g_skipTestCaseResult) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); + } + else if (res == OS_FS_SUCCESS) + { + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); } else { - if (OS_mkfs(g_fsAddrPtr, g_devNames[5], g_volNames[5], g_blkSize, g_blkCnt) != OS_FS_SUCCESS) - { - testDesc = "#4 Nominal - File-system-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) - goto UT_os_checkfs_test_exit_tag; - } - - if (OS_mount(g_devNames[5], g_mntNames[5]) != OS_FS_SUCCESS) - { - testDesc = "#4 Nominal - File-system-mount failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) - goto UT_os_checkfs_test_exit_tag; - } - - if ((int)OS_chkfs(g_mntNames[5], 0) == OS_FS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) - else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) - - /* Reset test environment */ - OS_unmount(g_mntNames[5]); - OS_rmfs(g_devNames[5]); + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } + /* Reset test environment */ + OS_unmount(g_mntNames[5]); + OS_rmfs(g_devNames[5]); + UT_os_checkfs_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_chkfs", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -1238,18 +1174,14 @@ void UT_os_checkfs_test() ** --------------------------------------------------------------------------------*/ void UT_os_fsblocksfree_test() { - int32 idx=0; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; if (OS_fsBlocksFree(NULL) == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_fsblocksfree_test_exit_tag; } @@ -1257,22 +1189,22 @@ void UT_os_fsblocksfree_test() testDesc = "#1 Null-pointer-arg"; if (OS_fsBlocksFree(NULL) == OS_FS_ERR_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Path-too-long-arg"; if (OS_fsBlocksFree(g_fsLongName) == OS_FS_ERR_PATH_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#4 Nominal"; @@ -1280,29 +1212,29 @@ void UT_os_fsblocksfree_test() if (OS_mkfs(g_fsAddrPtr, g_devNames[4], g_volNames[4], g_blkSize, g_blkCnt) != OS_FS_SUCCESS) { testDesc = "#4 Nominal - File-system-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_fsblocksfree_test_exit_tag; } if (OS_mount(g_devNames[4], g_mntNames[4]) != OS_FS_SUCCESS) { testDesc = "#4 Nominal - File-system-mount failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_fsblocksfree_test_exit_tag; } if (OS_fsBlocksFree(g_mntNames[4]) >= 0) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ OS_unmount(g_mntNames[4]); OS_rmfs(g_devNames[4]); UT_os_fsblocksfree_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_fsBlocksFree", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -1351,19 +1283,15 @@ void UT_os_fsblocksfree_test() ** --------------------------------------------------------------------------------*/ void UT_os_fsbytesfree_test() { - int32 idx=0; uint64 retBytes=0; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; if (OS_fsBytesFree(NULL, NULL) == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_fsbytesfree_test_exit_tag; } @@ -1372,22 +1300,22 @@ void UT_os_fsbytesfree_test() if ((OS_fsBytesFree(NULL, &retBytes) == OS_FS_ERR_INVALID_POINTER) && (OS_fsBytesFree(g_mntNames[1], NULL) == OS_FS_ERR_INVALID_POINTER)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Path-too-long-arg"; if (OS_fsBytesFree(g_fsLongName, &retBytes) == OS_FS_ERR_PATH_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#4 Nominal"; @@ -1395,29 +1323,29 @@ void UT_os_fsbytesfree_test() if (OS_mkfs(g_fsAddrPtr, g_devNames[4], g_volNames[4], g_blkSize, g_blkCnt) != OS_FS_SUCCESS) { testDesc = "#4 Nominal - File-system-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_fsbytesfree_test_exit_tag; } if (OS_mount(g_devNames[4], g_mntNames[4]) != OS_FS_SUCCESS) { testDesc = "#4 Nominal - File-system-mount failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_fsbytesfree_test_exit_tag; } if (OS_fsBytesFree(g_mntNames[4], &retBytes) == OS_FS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ OS_unmount(g_mntNames[4]); OS_rmfs(g_devNames[4]); UT_os_fsbytesfree_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_fsBytesFree", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*================================================================================* diff --git a/src/unit-tests/osfilesys-test/ut_osfilesys_diskio_test.h b/src/unit-tests/osfilesys-test/ut_osfilesys_diskio_test.h index 97efd41ec..4e190c075 100644 --- a/src/unit-tests/osfilesys-test/ut_osfilesys_diskio_test.h +++ b/src/unit-tests/osfilesys-test/ut_osfilesys_diskio_test.h @@ -11,7 +11,7 @@ ** Includes **--------------------------------------------------------------------------------*/ -#include "ut_os_stubs.h" +#include "ut_os_support.h" /*--------------------------------------------------------------------------------* ** Macros diff --git a/src/unit-tests/osfilesys-test/ut_osfilesys_test.c b/src/unit-tests/osfilesys-test/ut_osfilesys_test.c index e95e8336a..58a2b7231 100644 --- a/src/unit-tests/osfilesys-test/ut_osfilesys_test.c +++ b/src/unit-tests/osfilesys-test/ut_osfilesys_test.c @@ -25,8 +25,6 @@ ** External global variables **--------------------------------------------------------------------------------*/ -extern UT_OsLogInfo_t g_logInfo; - /*--------------------------------------------------------------------------------* ** Global variables **--------------------------------------------------------------------------------*/ @@ -36,22 +34,18 @@ char* g_fsAddrPtr = NULL; int32 g_blkSize = UT_OS_FS_BLOCK_SIZE; int32 g_blkCnt = UT_OS_FS_MAX_BLOCKS; -int32 g_skipTestCase = -1; -const char* g_skipTestCaseResult = " "; - -char g_fsLongName[OS_MAX_PATH_LEN+5]; -char g_physDriveName[OS_MAX_PATH_LEN]; +char g_fsLongName[UT_OS_PATH_BUFF_SIZE]; +char g_physDriveName[UT_OS_PHYS_NAME_BUFF_SIZE]; -char g_volNames[UT_OS_FILESYS_LIST_LEN][UT_OS_XS_TEXT_LEN]; -char g_devNames[UT_OS_FILESYS_LIST_LEN][UT_OS_XS_TEXT_LEN]; -char g_mntNames[UT_OS_FILESYS_LIST_LEN][UT_OS_XS_TEXT_LEN]; +char g_volNames[UT_OS_FILESYS_LIST_LEN][UT_OS_NAME_BUFF_SIZE]; +char g_devNames[UT_OS_FILESYS_LIST_LEN][UT_OS_FILE_BUFF_SIZE]; +char g_mntNames[UT_OS_FILESYS_LIST_LEN][UT_OS_FILE_BUFF_SIZE]; /*--------------------------------------------------------------------------------* ** Local function prototypes **--------------------------------------------------------------------------------*/ void UT_os_init_fs_misc(void); -void UT_os_init_checkfs_test(void); /*--------------------------------------------------------------------------------* ** Local function definitions @@ -96,53 +90,33 @@ void UT_os_init_fs_misc() strcpy(g_mntNames[7], "/drive7"); } -/*--------------------------------------------------------------------------------*/ - -void UT_os_init_checkfs_test() -{ - g_skipTestCase = 4; - g_skipTestCaseResult = UT_OS_NA; -} - /*--------------------------------------------------------------------------------* ** Main **--------------------------------------------------------------------------------*/ void OS_Application_Startup(void) { - UT_os_setup(UT_OS_LOG_FILENAME); - - /* UT_OS_LOG_OFF, UT_OS_LOG_MINIMAL, UT_OS_LOG_MODERATE, UT_OS_LOG_EVERYTHING */ - UT_os_set_log_verbose(UT_OS_LOG_EVERYTHING); - - UT_OS_LOG_MACRO("OSAL Unit Test Output File for osfilesys APIs\n") - - OS_API_Init(); - - UT_os_print_volumetable("VOLUME TABLE _AFTER_ OS_API_Init() call"); + if (OS_API_Init() != OS_SUCCESS) + { + UtAssert_Abort("OS_API_Init() failed"); + } UT_os_init_fs_misc(); - UT_os_makefs_test(); - UT_os_initfs_test(); - UT_os_removefs_test(); - - UT_os_mount_test(); - UT_os_unmount_test(); - - UT_os_getphysdrivename_test(); - UT_os_getfsinfo_test(); - UT_os_translatepath_test(); - - UT_os_init_checkfs_test(); - UT_os_checkfs_test(); + UtTest_Add(UT_os_makefs_test, NULL, NULL, "OS_mkfs"); + UtTest_Add(UT_os_initfs_test, NULL, NULL, "OS_initfs"); + UtTest_Add(UT_os_removefs_test, NULL, NULL, "OS_rmfs"); - UT_os_fsblocksfree_test(); - UT_os_fsbytesfree_test(); + UtTest_Add(UT_os_mount_test, NULL, NULL, "OS_mount"); + UtTest_Add(UT_os_unmount_test, NULL, NULL, "OS_unmount"); - UT_os_teardown("ut_osfilesys"); + UtTest_Add(UT_os_getphysdrivename_test, NULL, NULL, "OS_FS_GetPhysDriveName"); + UtTest_Add(UT_os_getfsinfo_test, NULL, NULL, "OS_GetFsInfo"); + UtTest_Add(UT_os_translatepath_test, NULL, NULL, "OS_TranslatePath (internal)"); - OS_ApplicationExit(g_logInfo.nFailed > 0); + UtTest_Add(UT_os_checkfs_test, NULL, NULL, "OS_chkfs"); + UtTest_Add(UT_os_fsblocksfree_test, NULL, NULL, "OS_fsBlocksFree"); + UtTest_Add(UT_os_fsbytesfree_test, NULL, NULL, "OS_fsBytesFree"); } /*================================================================================* diff --git a/src/unit-tests/osfilesys-test/ut_osfilesys_test.h b/src/unit-tests/osfilesys-test/ut_osfilesys_test.h index 32e1c3e45..15178a1f6 100644 --- a/src/unit-tests/osfilesys-test/ut_osfilesys_test.h +++ b/src/unit-tests/osfilesys-test/ut_osfilesys_test.h @@ -11,15 +11,13 @@ ** Includes **--------------------------------------------------------------------------------*/ -#include "ut_os_stubs.h" +#include "ut_os_support.h" #include "ut_osfilesys_diskio_test.h" /*--------------------------------------------------------------------------------* ** Macros **--------------------------------------------------------------------------------*/ -#define UT_OS_LOG_FILENAME "ut_osfilesys_log.txt" - /*--------------------------------------------------------------------------------* ** Data types **--------------------------------------------------------------------------------*/ diff --git a/src/unit-tests/osfilesys-test/ut_osfilesys_test_arinc653.c b/src/unit-tests/osfilesys-test/ut_osfilesys_test_arinc653.c deleted file mode 100644 index ec1323775..000000000 --- a/src/unit-tests/osfilesys-test/ut_osfilesys_test_arinc653.c +++ /dev/null @@ -1,149 +0,0 @@ -/*================================================================================* -** File: ut_osfilesys_test.c -** Owner: Tam Ngo -** Date: May 2013 -**================================================================================*/ - -/*--------------------------------------------------------------------------------* -** Includes -**--------------------------------------------------------------------------------*/ - -#include "ut_osfilesys_test.h" - -/*--------------------------------------------------------------------------------* -** Macros -**--------------------------------------------------------------------------------*/ - -#define UT_OS_FS_BLOCK_SIZE 512 -#define UT_OS_FS_MAX_BLOCKS 20 - -#define UT_OS_FS_MEM_SPACE (2 * UT_OS_FS_BLOCK_SIZE * UT_OS_FS_MAX_BLOCKS) - -/*--------------------------------------------------------------------------------* -** Data types -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** External global variables -**--------------------------------------------------------------------------------*/ - -extern UT_OsLogInfo_t g_logInfo; - -/*--------------------------------------------------------------------------------* -** Global variables -**--------------------------------------------------------------------------------*/ - -char g_fsMemSpace[UT_OS_FS_MEM_SPACE]; /* This variable must not be moved. */ -char* g_fsAddrPtr = &g_fsMemSpace[3]; /* Offset to be 32-bit aligned, - which is important for the PIRD layer */ - -int32 g_blkSize = UT_OS_FS_BLOCK_SIZE; -int32 g_blkCnt = UT_OS_FS_MAX_BLOCKS; - -int32 g_skipTestCase = -1; -char* g_skipTestCaseResult = " "; - -char g_fsLongName[OS_MAX_PATH_LEN+5]; -char g_physDriveName[OS_MAX_PATH_LEN]; - -char g_volNames[UT_OS_FILESYS_LIST_LEN][UT_OS_XS_TEXT_LEN]; -char g_devNames[UT_OS_FILESYS_LIST_LEN][UT_OS_XS_TEXT_LEN]; -char g_mntNames[UT_OS_FILESYS_LIST_LEN][UT_OS_XS_TEXT_LEN]; - -/*--------------------------------------------------------------------------------* -** Local function prototypes -**--------------------------------------------------------------------------------*/ - -void UT_os_init_fs_misc(void); -void UT_os_init_checkfs_test(void); - -/*--------------------------------------------------------------------------------* -** Local function definitions -**--------------------------------------------------------------------------------*/ - -void UT_os_init_fs_misc() -{ - memset(g_fsLongName, 'X', sizeof(g_fsLongName)); - g_fsLongName[0] = '/'; - g_fsLongName[sizeof(g_fsLongName)-1] = '\0'; - - strcpy(g_devNames[0], "/ramdev0"); - strcpy(g_volNames[0], " "); - strcpy(g_mntNames[0], "/drive0"); - - strcpy(g_devNames[1], "/ramdev1"); - strcpy(g_volNames[1], " "); - strcpy(g_mntNames[1], "/drive1"); - - strcpy(g_devNames[2], "/ramdev2"); - strcpy(g_volNames[2], " "); - strcpy(g_mntNames[2], "/drive2"); - - strcpy(g_devNames[3], "/ramdev3"); - strcpy(g_volNames[3], " "); - strcpy(g_mntNames[3], "/drive3"); - - strcpy(g_devNames[4], "/ramdev4"); - strcpy(g_volNames[4], " "); - strcpy(g_mntNames[4], "/drive4"); - - strcpy(g_devNames[5], "/ramdev5"); - strcpy(g_volNames[5], " "); - strcpy(g_mntNames[5], "/drive5"); - - strcpy(g_devNames[6], "/ramdev6"); - strcpy(g_volNames[6], " "); - strcpy(g_mntNames[6], "/drive6"); - - strcpy(g_devNames[7], "/ramdev7"); - strcpy(g_volNames[7], " "); - strcpy(g_mntNames[7], "/drive7"); -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_init_checkfs_test() -{ - g_skipTestCase = 3; - g_skipTestCaseResult = UT_OS_NA; -} - -/*--------------------------------------------------------------------------------* -** Main -**--------------------------------------------------------------------------------*/ - -void UT_main() -{ - UT_os_setup(UT_OS_LOG_FILENAME); - - /* UT_OS_LOG_OFF, UT_OS_LOG_MINIMAL, UT_OS_LOG_MODERATE, UT_OS_LOG_EVERYTHING */ - UT_os_set_log_verbose(UT_OS_LOG_EVERYTHING); - - UT_OS_LOG_MACRO("OSAL Unit Test Output File for ARINC653-implementation of osfilesys APIs\n") - - OS_API_Init(); - - UT_os_init_fs_misc(); - - UT_os_makefs_test(); - UT_os_initfs_test(); - UT_os_removefs_test(); - - UT_os_mount_test(); - UT_os_unmount_test(); - - UT_os_getphysdrivename_test(); - UT_os_translatepath_test(); - - UT_os_init_checkfs_test(); - UT_os_checkfs_test(); - - UT_os_fsblocksfree_test(); - UT_os_fsbytesfree_test(); - - UT_os_teardown("ut_osfilesys"); -} - -/*================================================================================* -** End of File: ut_osfilesys_test.c -**================================================================================*/ diff --git a/src/unit-tests/osfilesys-test/ut_osfilesys_test_vxworks.c b/src/unit-tests/osfilesys-test/ut_osfilesys_test_vxworks.c deleted file mode 100644 index 7700d0fca..000000000 --- a/src/unit-tests/osfilesys-test/ut_osfilesys_test_vxworks.c +++ /dev/null @@ -1,147 +0,0 @@ -/*================================================================================* -** File: ut_osfilesys_test_vxworks.c -** Owner: Tam Ngo -** Date: November 2014 -**================================================================================*/ - -/*--------------------------------------------------------------------------------* -** Includes -**--------------------------------------------------------------------------------*/ - -#include "ut_osfilesys_test.h" - -/*--------------------------------------------------------------------------------* -** Macros -**--------------------------------------------------------------------------------*/ - -#define UT_OS_FS_BLOCK_SIZE 512 -#define UT_OS_FS_MAX_BLOCKS 20 - -/*--------------------------------------------------------------------------------* -** Data types -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** External global variables -**--------------------------------------------------------------------------------*/ - -extern UT_OsLogInfo_t g_logInfo; - -/*--------------------------------------------------------------------------------* -** Global variables -**--------------------------------------------------------------------------------*/ - -char* g_fsAddrPtr = NULL; - -int32 g_blkSize = UT_OS_FS_BLOCK_SIZE; -int32 g_blkCnt = UT_OS_FS_MAX_BLOCKS; - -int32 g_skipTestCase = -1; -char* g_skipTestCaseResult = " "; - -char g_fsLongName[OS_MAX_PATH_LEN+5]; -char g_physDriveName[OS_MAX_PATH_LEN]; - -char g_volNames[UT_OS_FILESYS_LIST_LEN][UT_OS_XS_TEXT_LEN]; -char g_devNames[UT_OS_FILESYS_LIST_LEN][UT_OS_XS_TEXT_LEN]; -char g_mntNames[UT_OS_FILESYS_LIST_LEN][UT_OS_XS_TEXT_LEN]; - -/*--------------------------------------------------------------------------------* -** Local function prototypes -**--------------------------------------------------------------------------------*/ - -void UT_os_init_fs_misc(void); -void UT_os_init_checkfs_test(void); - -/*--------------------------------------------------------------------------------* -** Local function definitions -**--------------------------------------------------------------------------------*/ - -void UT_os_init_fs_misc() -{ - memset(g_fsLongName, 'X', sizeof(g_fsLongName)); - g_fsLongName[0] = '/'; - g_fsLongName[sizeof(g_fsLongName)-1] = '\0'; - - strcpy(g_devNames[0], "/ramdev0"); - strcpy(g_volNames[0], " "); - strcpy(g_mntNames[0], "/drive0"); - - strcpy(g_devNames[1], "/ramdev1"); - strcpy(g_volNames[1], " "); - strcpy(g_mntNames[1], "/drive1"); - - strcpy(g_devNames[2], "/ramdev2"); - strcpy(g_volNames[2], " "); - strcpy(g_mntNames[2], "/drive2"); - - strcpy(g_devNames[3], "/ramdev3"); - strcpy(g_volNames[3], " "); - strcpy(g_mntNames[3], "/drive3"); - - strcpy(g_devNames[4], "/ramdev4"); - strcpy(g_volNames[4], " "); - strcpy(g_mntNames[4], "/drive4"); - - strcpy(g_devNames[5], "/ramdev5"); - strcpy(g_volNames[5], " "); - strcpy(g_mntNames[5], "/drive5"); - - strcpy(g_devNames[6], "/ramdev6"); - strcpy(g_volNames[6], " "); - strcpy(g_mntNames[6], "/drive6"); - - strcpy(g_devNames[7], "/ramdev7"); - strcpy(g_volNames[7], " "); - strcpy(g_mntNames[7], "/drive7"); -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_init_checkfs_test() -{ -} - -/*--------------------------------------------------------------------------------* -** Main -**--------------------------------------------------------------------------------*/ - -void OS_Application_Startup(void) -{ - UT_os_setup(UT_OS_LOG_FILENAME); - - /* UT_OS_LOG_OFF, UT_OS_LOG_MINIMAL, UT_OS_LOG_MODERATE, UT_OS_LOG_EVERYTHING */ - UT_os_set_log_verbose(UT_OS_LOG_EVERYTHING); - - UT_OS_LOG_MACRO("OSAL Unit Test Output File for osfilesys APIs\n") - - OS_API_Init(); - - UT_os_print_volumetable("VOLUME TABLE _AFTER_ OS_API_Init() call"); - - UT_os_init_fs_misc(); - - UT_os_makefs_test(); - UT_os_initfs_test(); - UT_os_removefs_test(); - - UT_os_mount_test(); - UT_os_unmount_test(); - - UT_os_getphysdrivename_test(); - UT_os_translatepath_test(); - - UT_os_init_checkfs_test(); - UT_os_checkfs_test(); - - UT_os_fsblocksfree_test(); - UT_os_fsbytesfree_test(); - - UT_os_teardown("ut_osfilesys"); - - OS_ApplicationExit(g_logInfo.nFailed > 0); -} - -/*================================================================================* -** End of File: ut_osfilesys_test.c -**================================================================================*/ diff --git a/src/unit-tests/osloader-test/CMakeLists.txt b/src/unit-tests/osloader-test/CMakeLists.txt index bf2642390..ce3565797 100644 --- a/src/unit-tests/osloader-test/CMakeLists.txt +++ b/src/unit-tests/osloader-test/CMakeLists.txt @@ -18,6 +18,5 @@ while(MOD GREATER 0) LIBRARY_OUTPUT_DIRECTORY eeprom1) endwhile(MOD GREATER 0) -add_stubs(TEST_STUBS os) -add_osal_ut_exe(osal_loader_UT ${TEST_MODULE_FILES} ${TEST_STUBS}) +add_osal_ut_exe(osal_loader_UT ${TEST_MODULE_FILES}) diff --git a/src/unit-tests/osloader-test/ut_module.c b/src/unit-tests/osloader-test/ut_module.c index 3e59dafe9..b5e8e81ef 100644 --- a/src/unit-tests/osloader-test/ut_module.c +++ b/src/unit-tests/osloader-test/ut_module.c @@ -3,6 +3,7 @@ void MODULE_NAME(void) volatile int i; i = 1; i = i + 1; /* squelch set-but-not-used compiler warning */ + (void)i; return; } 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 5263d0a71..df06fdcea 100644 --- a/src/unit-tests/osloader-test/ut_osloader_module_test.c +++ b/src/unit-tests/osloader-test/ut_osloader_module_test.c @@ -15,10 +15,6 @@ ** Macros **--------------------------------------------------------------------------------*/ -#ifndef OS_INCLUDE_MODULE_LOADER -#define OS_MAX_MODULES 10 -#endif /* !OS_INCLUDE_MODULE_LOADER */ - /*--------------------------------------------------------------------------------* ** Data types **--------------------------------------------------------------------------------*/ @@ -27,8 +23,6 @@ ** External global variables **--------------------------------------------------------------------------------*/ -extern UT_OsLogInfo_t g_logInfo; - /*--------------------------------------------------------------------------------* ** Global variables **--------------------------------------------------------------------------------*/ @@ -49,11 +43,7 @@ void UT_os_sample_test() /* Must declare these variables for each function. They can be renamed. * They're referenced in the macros used to track test cases and their results. */ int32 idx = 0; - UT_OsApiInfo_t apiInfo; - const char* testDesc = NULL; - - /* Call this once at the beginning of the function to initialize the test variables. */ - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------* * For each test case, @@ -75,7 +65,7 @@ void UT_os_sample_test() if (OS_xxx() == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_sample_test_exit_tag; } @@ -87,9 +77,9 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(NULL,...) == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* TODO: Reset the test environment here, if necessary */ @@ -99,9 +89,9 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(aVeryLoooooongName) == OS_ERR_NAME_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* TODO: Reset the test environment here, if necessary */ @@ -111,17 +101,17 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(...) != OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); /* TODO: Reset the test environment here, if necessary */ UT_os_sample_test_exit_tag: /* Call these macros at the very end of the function to close out the test variables * and get it added to the global list being tracked. */ - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_xxx", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } #endif @@ -138,16 +128,13 @@ void UT_os_sample_test() void UT_os_module_load_test() { int i; - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; uint32 test_setup_invalid = 0; uint32 module_id; uint32 module_id2; - char module_name[OS_MAX_API_NAME]; - char module_file_name[OS_MAX_API_NAME]; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + char module_name[UT_OS_NAME_BUFF_SIZE]; + char module_file_name[UT_OS_PATH_BUFF_SIZE]; /*-----------------------------------------------------*/ testDesc = "API Not implemented"; @@ -155,7 +142,7 @@ void UT_os_module_load_test() res = OS_ModuleLoad(0, "TestModule", UT_OS_GENERIC_MODULE_NAME1); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_module_load_test_exit_tag; } @@ -164,28 +151,27 @@ void UT_os_module_load_test() res = OS_ModuleLoad(0, "TestModule", UT_OS_GENERIC_MODULE_NAME1); if (res == OS_INVALID_POINTER) - /* cppcheck-suppress syntaxError */ - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Null-pointer-arg-2"; res = OS_ModuleLoad(&module_id, 0, UT_OS_GENERIC_MODULE_NAME1); if (res == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Null-pointer-arg-3"; res = OS_ModuleLoad(&module_id, "TestModule", 0); if (res == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#4 No-free-IDs"; @@ -201,7 +187,7 @@ void UT_os_module_load_test() if ( res != OS_SUCCESS ) { testDesc = "#4 No-free-IDs - Module Load failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); test_setup_invalid = 1; break; } @@ -211,9 +197,9 @@ void UT_os_module_load_test() { res = OS_ModuleLoad(&module_id, "OneTooMany", UT_OS_GENERIC_MODULE_NAME2); if (res == OS_ERR_NO_FREE_IDS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } /* Reset test environment */ @@ -227,15 +213,15 @@ void UT_os_module_load_test() if ( res != OS_SUCCESS ) { testDesc = "#5 Duplicate-name - Module Load failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_ModuleLoad(&module_id, "DUPLICATE", UT_OS_GENERIC_MODULE_NAME2); if (res == OS_ERR_NAME_TAKEN) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ res = OS_ModuleUnload(module_id2); @@ -244,23 +230,23 @@ void UT_os_module_load_test() /*-----------------------------------------------------*/ testDesc = "#6 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#7 Nominal"; res = OS_ModuleLoad(&module_id, "Good", UT_OS_GENERIC_MODULE_NAME2); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ res = OS_ModuleUnload(module_id); UT_os_module_load_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_ModuleLoad", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -273,20 +259,17 @@ void UT_os_module_load_test() **--------------------------------------------------------------------------------*/ void UT_os_module_unload_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; uint32 module_id = 0; - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - /*-----------------------------------------------------*/ testDesc = "API Not implemented"; res = OS_ModuleUnload(0); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_module_unload_test_exit_tag; } @@ -295,14 +278,14 @@ void UT_os_module_unload_test() res = OS_ModuleUnload(99999); if ( res == OS_ERR_INVALID_ID ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#3 Nominal"; @@ -312,20 +295,20 @@ void UT_os_module_unload_test() if ( res != OS_SUCCESS ) { testDesc = "#3 Nominal - Module Load failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_ModuleUnload(module_id); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } UT_os_module_unload_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_ModuleUnload", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -338,21 +321,18 @@ void UT_os_module_unload_test() **--------------------------------------------------------------------------------*/ void UT_os_module_info_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; uint32 module_id; OS_module_prop_t module_info; - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - /*-----------------------------------------------------*/ testDesc = "API Not implemented"; res = OS_ModuleInfo(0, &module_info); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_module_info_test_exit_tag; } @@ -361,18 +341,18 @@ void UT_os_module_info_test() res = OS_ModuleInfo(0, NULL); if ( res == OS_INVALID_POINTER ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Invalid-ID-arg"; res = OS_ModuleInfo(99999, &module_info); if ( res == OS_ERR_INVALID_ID ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Nominal"; @@ -382,22 +362,22 @@ void UT_os_module_info_test() if ( res != OS_SUCCESS ) { testDesc = "#3 Nominal - Module Load failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { res = OS_ModuleInfo(module_id, &module_info); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); res = OS_ModuleUnload(module_id); } UT_os_module_info_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_ModuleInfo", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*================================================================================* diff --git a/src/unit-tests/osloader-test/ut_osloader_module_test.h b/src/unit-tests/osloader-test/ut_osloader_module_test.h index fff74c98b..e791426b5 100644 --- a/src/unit-tests/osloader-test/ut_osloader_module_test.h +++ b/src/unit-tests/osloader-test/ut_osloader_module_test.h @@ -11,7 +11,7 @@ ** Includes **--------------------------------------------------------------------------------*/ -#include "ut_os_stubs.h" +#include "ut_os_support.h" /*--------------------------------------------------------------------------------* ** Macros 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 a5476d952..3edea3131 100644 --- a/src/unit-tests/osloader-test/ut_osloader_symtable_test.c +++ b/src/unit-tests/osloader-test/ut_osloader_symtable_test.c @@ -23,8 +23,6 @@ ** External global variables **--------------------------------------------------------------------------------*/ -extern UT_OsLogInfo_t g_logInfo; - /*--------------------------------------------------------------------------------* ** Global variables **--------------------------------------------------------------------------------*/ @@ -45,11 +43,7 @@ void UT_os_sample_test() /* Must declare these variables for each function. They can be renamed. * They're referenced in the macros used to track test cases and their results. */ int32 idx = 0; - UT_OsApiInfo_t apiInfo; - const char* testDesc = NULL; - - /* Call this once at the beginning of the function to initialize the test variables. */ - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------* * For each test case, @@ -71,7 +65,7 @@ void UT_os_sample_test() if (OS_xxx() == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_sample_test_exit_tag; } @@ -83,9 +77,9 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(NULL,...) == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* TODO: Reset the test environment here, if necessary */ @@ -95,9 +89,9 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(aVeryLoooooongName) == OS_ERR_NAME_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* TODO: Reset the test environment here, if necessary */ @@ -107,17 +101,17 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(...) != OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); /* TODO: Reset the test environment here, if necessary */ UT_os_sample_test_exit_tag: /* Call these macros at the very end of the function to close out the test variables * and get it added to the global list being tracked. */ - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_xxx", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } #endif @@ -132,21 +126,18 @@ void UT_os_sample_test() void UT_os_symbol_lookup_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; + int32 res = 0; + const char* testDesc; cpuaddr symbol_addr; uint32 module_id = 0; - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - /*-----------------------------------------------------*/ testDesc = "API Not implemented"; res = OS_SymbolLookup(&symbol_addr, "main"); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_symbol_lookup_test_exit_tag; } @@ -155,28 +146,27 @@ void UT_os_symbol_lookup_test() res = OS_SymbolLookup(0, "main"); if ( res == OS_INVALID_POINTER ) - /* cppcheck-suppress syntaxError */ - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Invalid-pointer-arg-2"; res = OS_SymbolLookup(&symbol_addr, 0); if ( res == OS_INVALID_POINTER ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Symbol-not-found"; res = OS_SymbolLookup(&symbol_addr, "ThisSymbolIsNotFound"); if ( res == OS_ERROR ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#4 Nominal"; @@ -185,23 +175,23 @@ void UT_os_symbol_lookup_test() res = OS_ModuleLoad(&module_id, "Mod1", UT_OS_GENERIC_MODULE_NAME2); if ( res != OS_SUCCESS ) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, "#4 Nominal - Module Load failed", UT_OS_TSF) + UT_OS_TEST_RESULT( "#4 Nominal - Module Load failed", UTASSERT_CASETYPE_TSF); } else { res = OS_SymbolLookup(&symbol_addr, "module1"); if (res == OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ res = OS_ModuleUnload(module_id); } UT_os_symbol_lookup_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_SymbolLookup", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -215,11 +205,8 @@ void UT_os_symbol_lookup_test() **--------------------------------------------------------------------------------*/ void UT_os_symbol_table_dump_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + int32 res = 0; + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API Not implemented"; @@ -227,7 +214,7 @@ void UT_os_symbol_table_dump_test() res = OS_SymbolTableDump("/cf/apps/SymbolFile.dat", 32000); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_symbol_table_dump_test_exit_tag; } @@ -236,23 +223,23 @@ void UT_os_symbol_table_dump_test() res = OS_SymbolTableDump(0,10000); if ( res == OS_INVALID_POINTER ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Invalid-path"; res = OS_SymbolTableDump("/this/path/is/invalid.dat", 10000); if ( res == OS_FS_ERR_PATH_INVALID ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#4 Nominal"; @@ -260,13 +247,13 @@ void UT_os_symbol_table_dump_test() /* Setup */ res = OS_SymbolTableDump("/cf/apps/SymbolFile.dat", 32000); if ( res == OS_SUCCESS ) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); UT_os_symbol_table_dump_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_SymbolTableDump", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*================================================================================* diff --git a/src/unit-tests/osloader-test/ut_osloader_symtable_test.h b/src/unit-tests/osloader-test/ut_osloader_symtable_test.h index 653a31380..c8085d95a 100644 --- a/src/unit-tests/osloader-test/ut_osloader_symtable_test.h +++ b/src/unit-tests/osloader-test/ut_osloader_symtable_test.h @@ -11,7 +11,7 @@ ** Includes **--------------------------------------------------------------------------------*/ -#include "ut_os_stubs.h" +#include "ut_os_support.h" /*--------------------------------------------------------------------------------* ** Macros diff --git a/src/unit-tests/osloader-test/ut_osloader_test.c b/src/unit-tests/osloader-test/ut_osloader_test.c index eca277a0f..d2828cd94 100644 --- a/src/unit-tests/osloader-test/ut_osloader_test.c +++ b/src/unit-tests/osloader-test/ut_osloader_test.c @@ -22,8 +22,6 @@ ** External global variables **--------------------------------------------------------------------------------*/ -extern UT_OsLogInfo_t g_logInfo; - /*--------------------------------------------------------------------------------* ** Global variables **--------------------------------------------------------------------------------*/ @@ -42,25 +40,17 @@ extern UT_OsLogInfo_t g_logInfo; void OS_Application_Startup(void) { - UT_os_setup(UT_OS_LOG_FILENAME); - - /* UT_OS_LOG_OFF, UT_OS_LOG_MINIMAL, UT_OS_LOG_MODERATE, UT_OS_LOG_EVERYTHING */ - UT_os_set_log_verbose(UT_OS_LOG_EVERYTHING); - - UT_OS_LOG_MACRO("OSAL Unit Test Output File for osloader APIs\n"); - - OS_API_Init(); - - UT_os_module_load_test(); - UT_os_module_unload_test(); - UT_os_module_info_test(); - - UT_os_symbol_lookup_test(); - UT_os_symbol_table_dump_test(); + if (OS_API_Init() != OS_SUCCESS) + { + UtAssert_Abort("OS_API_Init() failed"); + } - UT_os_teardown("ut_osloader"); + UtTest_Add(UT_os_module_load_test, NULL, NULL, "OS_ModuleLoad"); + UtTest_Add(UT_os_module_unload_test, NULL, NULL, "OS_ModuleUnload"); + UtTest_Add(UT_os_module_info_test, NULL, NULL, "OS_ModuleInfo"); - OS_ApplicationExit(g_logInfo.nFailed > 0); + UtTest_Add(UT_os_symbol_lookup_test, NULL, NULL, "OS_SymbolLookup"); + UtTest_Add(UT_os_symbol_table_dump_test, NULL, NULL, "OS_SymbolTableDump"); } /*================================================================================* diff --git a/src/unit-tests/osloader-test/ut_osloader_test.h b/src/unit-tests/osloader-test/ut_osloader_test.h index 4d134b25b..e0d23552c 100644 --- a/src/unit-tests/osloader-test/ut_osloader_test.h +++ b/src/unit-tests/osloader-test/ut_osloader_test.h @@ -11,7 +11,7 @@ ** Includes **--------------------------------------------------------------------------------*/ -#include "ut_os_stubs.h" +#include "ut_os_support.h" #include "ut_osloader_symtable_test.h" #include "ut_osloader_module_test.h" @@ -19,8 +19,6 @@ ** Macros **--------------------------------------------------------------------------------*/ -#define UT_OS_LOG_FILENAME "ut_osloader_log.txt" - /*--------------------------------------------------------------------------------* ** Data types **--------------------------------------------------------------------------------*/ @@ -37,10 +35,6 @@ ** Function prototypes **--------------------------------------------------------------------------------*/ -#ifdef _ARINC653_OS_ -void UT_main(void); -#endif /* _ARINC653_OS_ */ - /*--------------------------------------------------------------------------------*/ #endif /* _UT_OSLOADER_TEST_H_ */ diff --git a/src/unit-tests/osloader-test/ut_osloader_test_arinc653.c b/src/unit-tests/osloader-test/ut_osloader_test_arinc653.c deleted file mode 100644 index bf4155c97..000000000 --- a/src/unit-tests/osloader-test/ut_osloader_test_arinc653.c +++ /dev/null @@ -1,7 +0,0 @@ -/*--------------------------------------------------------------------------------* -** Main -**--------------------------------------------------------------------------------*/ - -void UT_main() -{ -} diff --git a/src/unit-tests/osloader-test/ut_osloader_test_platforms.h b/src/unit-tests/osloader-test/ut_osloader_test_platforms.h index 8ebc8e04e..fe17b76b3 100644 --- a/src/unit-tests/osloader-test/ut_osloader_test_platforms.h +++ b/src/unit-tests/osloader-test/ut_osloader_test_platforms.h @@ -11,30 +11,21 @@ ** Includes **--------------------------------------------------------------------------------*/ -#ifdef _LINUX_OS_ -#endif /* _LINUX_OS_ */ - -#ifdef OSP_ARINC653 -#endif /* OSP_ARINC653 */ - /*--------------------------------------------------------------------------------* ** Macros **--------------------------------------------------------------------------------*/ -/*--------------------------------------------*/ -#ifdef _LINUX_OS_ -/*--------------------------------------------*/ - -#define UT_OS_GENERIC_MODULE_NAME1 "/cf/MODULE.so" -#define UT_OS_GENERIC_MODULE_NAME2 "/cf/MODULE1.so" -#define UT_OS_SPECIFIC_MODULE_NAME "/cf/MODULE%d.so" - -/*--------------------------------------------*/ -#endif /* _LINUX_OS_ */ -/*--------------------------------------------*/ +/* + * The actual module files that the loader tests attempt to load need + * to be consistent with the system type that is being compiled for. + * + * It can be assumed that the BSP will provide some sort of virtual + * filesystem mapping for the /cf directory, but the file extension + * for a loadable module still differs. + */ /*--------------------------------------------*/ -#ifdef _VXWORKS_OS_ +#if defined(_VXWORKS_OS_) || defined(OSP_ARINC653) /*--------------------------------------------*/ #define UT_OS_GENERIC_MODULE_NAME1 "/cf/apps/MODULE.o" @@ -42,20 +33,22 @@ #define UT_OS_SPECIFIC_MODULE_NAME "/cf/apps/MODULE%d.o" /*--------------------------------------------*/ -#endif /* _VXWORKS_OS_ */ +#elif defined(_RTEMS_OS_) /*--------------------------------------------*/ +#define UT_OS_GENERIC_MODULE_NAME1 "/cf/MODULE.obj" +#define UT_OS_GENERIC_MODULE_NAME2 "/cf/MODULE1.obj" +#define UT_OS_SPECIFIC_MODULE_NAME "/cf/MODULE%d.obj" + /*--------------------------------------------*/ -#ifdef OSP_ARINC653 +#else /* For any other OS assume Linux/POSIX style .so files */ /*--------------------------------------------*/ -#define UT_OS_GENERIC_MODULE_NAME1 "/cf/apps/MODULE.o" -#define UT_OS_GENERIC_MODULE_NAME2 "/cf/apps/MODULE1.o" -#define UT_OS_SPECIFIC_MODULE_NAME "/cf/apps/MODULE%d.o" +#define UT_OS_GENERIC_MODULE_NAME1 "/cf/MODULE.so" +#define UT_OS_GENERIC_MODULE_NAME2 "/cf/MODULE1.so" +#define UT_OS_SPECIFIC_MODULE_NAME "/cf/MODULE%d.so" -/*--------------------------------------------*/ -#endif /* OSP_ARINC653 */ -/*--------------------------------------------*/ +#endif /*--------------------------------------------------------------------------------* ** Data types diff --git a/src/unit-tests/osnetwork-test/CMakeLists.txt b/src/unit-tests/osnetwork-test/CMakeLists.txt index 2f64e8789..32d68ae79 100644 --- a/src/unit-tests/osnetwork-test/CMakeLists.txt +++ b/src/unit-tests/osnetwork-test/CMakeLists.txt @@ -4,6 +4,5 @@ set(TEST_MODULE_FILES ut_osnetwork_misc_test.c ut_osnetwork_test.c) -add_stubs(TEST_STUBS os) -add_osal_ut_exe(osal_network_UT ${TEST_MODULE_FILES} ${TEST_STUBS}) +add_osal_ut_exe(osal_network_UT ${TEST_MODULE_FILES}) diff --git a/src/unit-tests/osnetwork-test/ut_osnetwork_misc_test.c b/src/unit-tests/osnetwork-test/ut_osnetwork_misc_test.c index 866eddaac..d371c058c 100644 --- a/src/unit-tests/osnetwork-test/ut_osnetwork_misc_test.c +++ b/src/unit-tests/osnetwork-test/ut_osnetwork_misc_test.c @@ -22,8 +22,6 @@ ** External global variables **--------------------------------------------------------------------------------*/ -extern UT_OsLogInfo_t g_logInfo; - /*--------------------------------------------------------------------------------* ** Global variables **--------------------------------------------------------------------------------*/ @@ -44,11 +42,7 @@ void UT_os_sample_test() /* Must declare these variables for each function. They can be renamed. * They're referenced in the macros used to track test cases and their results. */ int32 idx = 0; - UT_OsApiInfo_t apiInfo; - const char* testDesc = NULL; - - /* Call this once at the beginning of the function to initialize the test variables. */ - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------* * For each test case, @@ -70,7 +64,7 @@ void UT_os_sample_test() if (OS_xxx() == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_sample_test_exit_tag; } @@ -82,9 +76,9 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(NULL,...) == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* TODO: Reset the test environment here, if necessary */ @@ -94,9 +88,9 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(aVeryLoooooongName) == OS_ERR_NAME_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* TODO: Reset the test environment here, if necessary */ @@ -106,17 +100,17 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(...) != OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); /* TODO: Reset the test environment here, if necessary */ UT_os_sample_test_exit_tag: /* Call these macros at the very end of the function to close out the test variables * and get it added to the global list being tracked. */ - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_xxx", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } #endif @@ -146,46 +140,37 @@ void UT_os_sample_test() **--------------------------------------------------------------------------------*/ void UT_os_networkgetid_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + int32 res = 0; + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API Not implemented"; -#ifdef OS_INCLUDE_NETWORK res = OS_NetworkGetID(); -#else - res = OS_ERR_NOT_IMPLEMENTED; -#endif if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_networkgetid_test_exit_tag; } /*-----------------------------------------------------*/ testDesc = "#1 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#2 Nominal"; -#ifdef OS_INCLUDE_NETWORK res = OS_NetworkGetID(); -#endif - if (res != OS_ERROR) - /* cppcheck-suppress syntaxError */ - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) - else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + + /* NOTE: This API does not return error codes. + * Any return value could be valid */ + UT_OS_LOG("OS_NetworkGetID() return value=%ld", (long)res); + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_MIR); UT_os_networkgetid_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_NetworkGetID", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -226,26 +211,17 @@ void UT_os_networkgetid_test() **--------------------------------------------------------------------------------*/ void UT_os_networkgethostname_test() { - UT_OsApiInfo_t apiInfo; - int32 res = 0, idx = 0; - const char* testDesc = NULL; -#ifdef OS_INCLUDE_NETWORK - char buffer[UT_OS_MD_TEXT_LEN]; -#endif - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + int32 res = 0; + const char* testDesc; + char buffer[UT_OS_IO_BUFF_SIZE]; /*-----------------------------------------------------*/ testDesc = "API Not implemented"; -#ifdef OS_INCLUDE_NETWORK res = OS_NetworkGetHostName(buffer, sizeof(buffer)); -#else - res = OS_ERR_NOT_IMPLEMENTED; -#endif if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_networkgethostname_test_exit_tag; } @@ -253,40 +229,38 @@ void UT_os_networkgethostname_test() /*-----------------------------------------------------*/ testDesc = "#1 Null-pointer-arg"; -#ifdef OS_INCLUDE_NETWORK res = OS_NetworkGetHostName(NULL, 0); if (res == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Zero-name-length-arg"; res = OS_NetworkGetHostName(buffer, 0); if (res == OS_ERROR) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 OS-call-failure"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#4 Nominal"; res = OS_NetworkGetHostName(buffer, sizeof(buffer)); if (res == OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) -#endif + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); UT_os_networkgethostname_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_NetworkGetHostName", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*================================================================================* diff --git a/src/unit-tests/osnetwork-test/ut_osnetwork_misc_test.h b/src/unit-tests/osnetwork-test/ut_osnetwork_misc_test.h index 014b0ce47..6ac059bbf 100644 --- a/src/unit-tests/osnetwork-test/ut_osnetwork_misc_test.h +++ b/src/unit-tests/osnetwork-test/ut_osnetwork_misc_test.h @@ -11,7 +11,7 @@ ** Includes **--------------------------------------------------------------------------------*/ -#include "ut_os_stubs.h" +#include "ut_os_support.h" /*--------------------------------------------------------------------------------* ** Macros diff --git a/src/unit-tests/osnetwork-test/ut_osnetwork_test.c b/src/unit-tests/osnetwork-test/ut_osnetwork_test.c index 45fc36ba1..c66b39a4d 100644 --- a/src/unit-tests/osnetwork-test/ut_osnetwork_test.c +++ b/src/unit-tests/osnetwork-test/ut_osnetwork_test.c @@ -22,8 +22,6 @@ ** External global variables **--------------------------------------------------------------------------------*/ -extern UT_OsLogInfo_t g_logInfo; - /*--------------------------------------------------------------------------------* ** Global variables **--------------------------------------------------------------------------------*/ @@ -42,21 +40,13 @@ extern UT_OsLogInfo_t g_logInfo; void OS_Application_Startup(void) { - UT_os_setup(UT_OS_LOG_FILENAME); - - /* UT_OS_LOG_OFF, UT_OS_LOG_MINIMAL, UT_OS_LOG_MODERATE, UT_OS_LOG_EVERYTHING */ - UT_os_set_log_verbose(UT_OS_LOG_EVERYTHING); - - UT_OS_LOG_MACRO("OSAL Unit Test Output File for osnetwork APIs\n"); - - OS_API_Init(); - - UT_os_networkgetid_test(); - UT_os_networkgethostname_test(); - - UT_os_teardown("ut_osnetwork"); + if (OS_API_Init() != OS_SUCCESS) + { + UtAssert_Abort("OS_API_Init() failed"); + } - OS_ApplicationExit(g_logInfo.nFailed > 0); + UtTest_Add(UT_os_networkgetid_test, NULL, NULL, "OS_NetworkGetID"); + UtTest_Add(UT_os_networkgethostname_test, NULL, NULL, "OS_NetworkGetHostName"); } /*================================================================================* diff --git a/src/unit-tests/osnetwork-test/ut_osnetwork_test.h b/src/unit-tests/osnetwork-test/ut_osnetwork_test.h index 15018ee0f..5026443a8 100644 --- a/src/unit-tests/osnetwork-test/ut_osnetwork_test.h +++ b/src/unit-tests/osnetwork-test/ut_osnetwork_test.h @@ -11,15 +11,13 @@ ** Includes **--------------------------------------------------------------------------------*/ -#include "ut_os_stubs.h" +#include "ut_os_support.h" #include "ut_osnetwork_misc_test.h" /*--------------------------------------------------------------------------------* ** Macros **--------------------------------------------------------------------------------*/ -#define UT_OS_LOG_FILENAME "ut_osnetwork_log.txt" - /*--------------------------------------------------------------------------------* ** Data types **--------------------------------------------------------------------------------*/ @@ -36,10 +34,6 @@ ** Function prototypes **--------------------------------------------------------------------------------*/ -#ifdef _ARINC653_OS_ -void UT_main(void); -#endif /* _ARINC653_OS_ */ - /*--------------------------------------------------------------------------------*/ #endif /* _UT_OSNETWORK_TEST_H_ */ diff --git a/src/unit-tests/osnetwork-test/ut_osnetwork_test_arinc653.c b/src/unit-tests/osnetwork-test/ut_osnetwork_test_arinc653.c deleted file mode 100644 index 45e198785..000000000 --- a/src/unit-tests/osnetwork-test/ut_osnetwork_test_arinc653.c +++ /dev/null @@ -1,3 +0,0 @@ -void UT_main(void) -{ -} diff --git a/src/unit-tests/ostimer-test/CMakeLists.txt b/src/unit-tests/ostimer-test/CMakeLists.txt index 02db3a913..8c0e17884 100644 --- a/src/unit-tests/ostimer-test/CMakeLists.txt +++ b/src/unit-tests/ostimer-test/CMakeLists.txt @@ -4,6 +4,5 @@ set(TEST_MODULE_FILES ut_ostimer_timerio_test.c ut_ostimer_test.c) -add_stubs(TEST_STUBS os) -add_osal_ut_exe(osal_timer_UT ${TEST_MODULE_FILES} ${TEST_STUBS}) +add_osal_ut_exe(osal_timer_UT ${TEST_MODULE_FILES}) diff --git a/src/unit-tests/ostimer-test/ut_ostimer_test.c b/src/unit-tests/ostimer-test/ut_ostimer_test.c index 709f56c9b..4658e6f66 100644 --- a/src/unit-tests/ostimer-test/ut_ostimer_test.c +++ b/src/unit-tests/ostimer-test/ut_ostimer_test.c @@ -22,17 +22,12 @@ ** External global variables **--------------------------------------------------------------------------------*/ -extern UT_OsLogInfo_t g_logInfo; - /*--------------------------------------------------------------------------------* ** Global variables **--------------------------------------------------------------------------------*/ -int32 g_skipTestCase = -1; -const char* g_skipTestCaseResult = " "; - const char* g_timerNames[UT_OS_TIMER_LIST_LEN]; -char g_longTimerName[OS_MAX_API_NAME+5]; +char g_longTimerName[UT_OS_NAME_BUFF_SIZE]; uint32 g_cbLoopCntMax = 5; uint32 g_toleranceVal = 0; @@ -89,15 +84,6 @@ void UT_os_timercallback(uint32 timerId) else deltaTime = prevIntervalTime - currIntervalTime; - if (g_logInfo.verboseLevel == UT_OS_LOG_EVERYTHING) - { - UT_OS_LOG_MACRO("\n"); - UT_OS_LOG_MACRO("OS_TimerSet() - #4 Nominal [Output from timer callback func: ") - UT_OS_LOG_MACRO("current_time=%d.%d, delta_time=%d, tolVal=%d, loopCnt=%d]\n", - (int)currTime.seconds, (int)currTime.microsecs, - (int)deltaTime, (int)g_toleranceVal, (int)loopCnt); - } - if ((deltaTime > g_toleranceVal) && (loopCnt > 1)) res = -1; @@ -185,36 +171,6 @@ void UT_os_setup_timerset_test() g_timerNames[4] = "Set_Nominal"; } -/*--------------------------------------------------------------------------------*/ -/* The test logic must execute in a task for the timers to work properly. */ -void UT_timertest_task(void) -{ - OS_TaskRegister(); - - UT_os_init_timer_misc(); - - UT_os_setup_timercreate_test(); - UT_os_timercreate_test(); - - UT_os_setup_timerdelete_test(); - UT_os_timerdelete_test(); - - UT_os_setup_timergetidbyname_test(); - UT_os_timergetidbyname_test(); - - UT_os_setup_timergetinfo_test(); - UT_os_timergetinfo_test(); - - UT_os_setup_timerset_test(); - UT_OS_LOG_MACRO("\n============================================\n") - UT_os_timerset_test(); - UT_OS_LOG_MACRO("============================================\n") - - UT_os_teardown("ut_ostimer"); - - OS_ApplicationShutdown(true); - OS_ApplicationExit(g_logInfo.nFailed > 0); -} /*--------------------------------------------------------------------------------* ** Main @@ -222,35 +178,39 @@ void UT_timertest_task(void) void OS_Application_Startup(void) { - UT_os_setup(UT_OS_LOG_FILENAME); - - /* UT_OS_LOG_OFF, UT_OS_LOG_MINIMAL, UT_OS_LOG_MODERATE, UT_OS_LOG_EVERYTHING */ - UT_os_set_log_verbose(UT_OS_LOG_EVERYTHING); - - UT_OS_LOG_MACRO("OSAL Unit Test Output File for ostimer APIs\n"); - - UT_os_timerinit_test(); - - OS_API_Init(); - - /* - ** Create the test task. - */ + if (OS_API_Init() != OS_SUCCESS) { - uint32 task_id; - int32 status; - - /* - ** Warning: Running test with a stack size less than 20K may result in issues/test failure - */ - status = OS_TaskCreate( &task_id, "TimerTest", UT_timertest_task, NULL, 32*1024, 100, 0); - if ( status != OS_SUCCESS ) - { - UT_OS_LOG_MACRO("Error creating Timer Test Task 2\n"); - OS_ApplicationExit(status); - } - OS_IdleLoop(); + UtAssert_Abort("OS_API_Init() failed"); } + + UT_os_init_timer_misc(); + + UtTest_Add( + UT_os_timercreate_test, + UT_os_setup_timercreate_test, + NULL, + "OS_TimerCreate"); + UtTest_Add( + UT_os_timerdelete_test, + UT_os_setup_timerdelete_test, + NULL, + "OS_TimerDelete"); + UtTest_Add( + UT_os_timergetidbyname_test, + UT_os_setup_timergetidbyname_test, + NULL, + "OS_TimerGetIdByName"); + UtTest_Add( + UT_os_timergetinfo_test, + UT_os_setup_timergetinfo_test, + NULL, + "OS_TimerGetInfo"); + UtTest_Add( + UT_os_timerset_test, + UT_os_setup_timerset_test, + NULL, + "OS_TimerSet"); + } /*================================================================================* diff --git a/src/unit-tests/ostimer-test/ut_ostimer_test.h b/src/unit-tests/ostimer-test/ut_ostimer_test.h index 7b52cbe6f..27b9eed08 100644 --- a/src/unit-tests/ostimer-test/ut_ostimer_test.h +++ b/src/unit-tests/ostimer-test/ut_ostimer_test.h @@ -11,15 +11,13 @@ ** Includes **--------------------------------------------------------------------------------*/ -#include "ut_os_stubs.h" +#include "ut_os_support.h" #include "ut_ostimer_timerio_test.h" /*--------------------------------------------------------------------------------* ** Macros **--------------------------------------------------------------------------------*/ -#define UT_OS_LOG_FILENAME "ut_ostimer_log.txt" - /*--------------------------------------------------------------------------------* ** Data types **--------------------------------------------------------------------------------*/ diff --git a/src/unit-tests/ostimer-test/ut_ostimer_test_arinc653.c b/src/unit-tests/ostimer-test/ut_ostimer_test_arinc653.c deleted file mode 100644 index e23105b3e..000000000 --- a/src/unit-tests/ostimer-test/ut_ostimer_test_arinc653.c +++ /dev/null @@ -1,217 +0,0 @@ -/*================================================================================* -** File: ut_ostimer_test_arinc653.c -** Owner: Tam Ngo -** Date: May 2013 -**================================================================================*/ - -/*--------------------------------------------------------------------------------* -** Includes -**--------------------------------------------------------------------------------*/ - -#include - -#include "ut_ostimer_test.h" - -/*--------------------------------------------------------------------------------* -** Macros -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Data types -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** External global variables -**--------------------------------------------------------------------------------*/ - -extern UT_OsLogInfo_t g_logInfo; - -/*--------------------------------------------------------------------------------* -** Global variables -**--------------------------------------------------------------------------------*/ - -int32 g_skipTestCase = -1; -char* g_skipTestCaseResult = " "; - -char* g_timerNames[UT_OS_TIMER_LIST_LEN]; -char g_longTimerName[OS_MAX_API_NAME+5]; - -/*--------------------------------------------------------------------------------* -** Local function prototypes -**--------------------------------------------------------------------------------*/ - -void UT_os_timercallback(uint32 timerId); - -void UT_os_init_timer_misc(void); -void UT_os_setup_timercreate_test(void); -void UT_os_setup_timerdelete_test(void); -void UT_os_setup_timergetidbyname_test(void); -void UT_os_setup_timergetinfo_test(void); -void UT_os_setup_timerset_test(void); - -void UT_os_timer_tests(void); - -/*--------------------------------------------------------------------------------* -** Local function definitions -**--------------------------------------------------------------------------------*/ - -void UT_os_timercallback(uint32 timerId) -{ - int deltaTime = 0; - char text[UT_OS_LG_TEXT_LEN]; - static int32 loopCnt = 0; - static uint32 prevIntervalTime = 0; - static uint32 currIntervalTime = 0; - static OS_time_t beginTime = {0,0}, currTime = {0,0}; - - OS_GetLocalTime(&currTime); - - if (currTime.seconds == beginTime.seconds) - currIntervalTime = currTime.microsecs - beginTime.microsecs; - else - currIntervalTime = currTime.microsecs + (1000000 - beginTime.microsecs); - - if (currIntervalTime >= prevIntervalTime) - deltaTime = currIntervalTime - prevIntervalTime; - else - deltaTime = prevIntervalTime - currIntervalTime; - - if (g_logInfo.verboseLevel == UT_OS_LOG_EVERYTHING) - { - memset(text, '\0', sizeof(text)); - UT_os_sprintf(text, "OS_TimerSet() - #4 Nominal [Output from timer callback func: "); - UT_OS_LOG_MACRO(text) - memset(text, '\0', sizeof(text)); - UT_os_sprintf(text, "current_time=%d.%d, delta_time=%d, loopCnt=%d]\n", - (int)currTime.seconds, (int)currTime.microsecs, - (int)deltaTime, (int)loopCnt); - UT_OS_LOG_MACRO(text) - } - - loopCnt++; -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_init_timer_misc() -{ - memset(g_longTimerName, 'Y', sizeof(g_longTimerName)); - g_longTimerName[sizeof(g_longTimerName)-1] = '\0'; -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_setup_timercreate_test() -{ - g_timerNames[0] = "Timer #1"; /* Create_NotImpl */ - g_timerNames[1] = "Timer #1"; /* Create_NullPtr */ - g_timerNames[2] = "Timer #1"; /* Create_LongName */ - g_timerNames[3] = "Timer #1"; /* Create_DuplName */ - g_timerNames[4] = "Timer #1"; /* Create_Full */ - g_timerNames[5] = "Timer #1"; /* Create_InvArg */ - g_timerNames[6] = "Timer #1"; /* Create_UnAvail */ - g_timerNames[7] = "Timer #1"; /* Create_Nominal */ - - g_skipTestCase = 4; - g_skipTestCaseResult = UT_OS_NA; -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_setup_timerdelete_test() -{ - g_timerNames[0] = "Timer #1"; /* Delete_NotImpl */ - g_timerNames[1] = "Timer #1"; /* Delete_InvArg */ - g_timerNames[2] = "Timer #1"; /* Delete_IntErr */ - g_timerNames[3] = "Timer #1"; /* Delete_Nominal */ -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_setup_timergetidbyname_test() -{ - g_timerNames[0] = "Timer #0"; /* GetId_NotImpl */ - g_timerNames[1] = "Timer #0"; /* GetId_NullPtr */ - g_timerNames[2] = "Timer #0"; /* GetId_LongName */ - g_timerNames[3] = "Timer #0"; /* GetId_NotFound */ - g_timerNames[4] = "Timer #0"; /* GetId_Nominal */ -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_setup_timergetinfo_test() -{ - g_timerNames[0] = "Timer #1"; /* GetInfo_NotImpl */ - g_timerNames[1] = "Timer #1"; /* GetInfo_NullPtr */ - g_timerNames[2] = "Timer #1"; /* GetInfo_InvArg */ - g_timerNames[3] = "Timer #1"; /* GetInfo_Nominal */ -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_setup_timerset_test() -{ - g_timerNames[0] = "Timer #0"; /* Set_NotImpl */ - g_timerNames[1] = "Timer #0"; /* Set_InvArg */ - g_timerNames[2] = "Timer #0"; /* Set_IntErr */ - g_timerNames[3] = "Timer #0"; /* Set_ShortIntv */ - g_timerNames[4] = "Timer #0"; /* Set_Nominal */ - - g_skipTestCase = 3; - g_skipTestCaseResult = UT_OS_NA; -} - -/*--------------------------------------------------------------------------------*/ - -void UT_os_timer_tests() -{ - UT_os_init_timer_misc(); - - UT_os_setup_timercreate_test(); - UT_os_timercreate_test(); - - UT_os_setup_timerdelete_test(); - UT_os_timerdelete_test(); - - UT_os_setup_timergetidbyname_test(); - UT_os_timergetidbyname_test(); - - UT_os_setup_timergetinfo_test(); - UT_os_timergetinfo_test(); - - UT_os_setup_timerset_test(); - UT_OS_LOG_MACRO("\n============================================\n") - UT_os_timerset_test(); - UT_OS_LOG_MACRO("============================================\n") - - UT_os_teardown("ut_ostimer"); -} - -/*--------------------------------------------------------------------------------* -** Main -**--------------------------------------------------------------------------------*/ - -void UT_main() -{ - uint32 tId1=0, stackPtr=0; - RETURN_CODE_TYPE arincRet=NO_ERROR; - - UT_os_setup(UT_OS_LOG_FILENAME); - - /* UT_OS_LOG_OFF, UT_OS_LOG_MINIMAL, UT_OS_LOG_MODERATE, UT_OS_LOG_EVERYTHING */ - UT_os_set_log_verbose(UT_OS_LOG_EVERYTHING); - - UT_OS_LOG_MACRO("OSAL Unit Test Output File for ARINC653-implementation of ostimer APIs\n"); - - UT_os_timerinit_test(); - - OS_TaskCreate(&tId1, "ut_ostimer", - (osal_task_entry)&UT_os_timer_tests, - &stackPtr, 0x2000, 110, 0); - - SET_PARTITION_MODE(NORMAL, &arincRet); -} - -/*================================================================================* -** End of File: ut_ostimer_test_arinc653.c -**================================================================================*/ diff --git a/src/unit-tests/ostimer-test/ut_ostimer_test_platforms.h b/src/unit-tests/ostimer-test/ut_ostimer_test_platforms.h deleted file mode 100644 index 8ccfee305..000000000 --- a/src/unit-tests/ostimer-test/ut_ostimer_test_platforms.h +++ /dev/null @@ -1,263 +0,0 @@ -/*================================================================================* -** File: ut_ostimer_test_platforms.h -** Owner: Tam Ngo -** Date: September 2013 -**================================================================================*/ - -#ifndef _UT_OSTIMER_TEST_PLATFORMS_H_ -#define _UT_OSTIMER_TEST_PLATFORMS_H_ - -/*--------------------------------------------------------------------------------* -** Includes -**--------------------------------------------------------------------------------*/ - -#ifdef _LINUX_OS_ -#endif /* _LINUX_OS_ */ - -#ifdef OSP_ARINC653 -#include "apex_api.h" -#endif /* OSP_ARINC653 */ - -/*--------------------------------------------------------------------------------* -** Macros -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------*/ -#if defined(_LINUX_OS_) || defined(_RTEMS_OS_) -/*--------------------------------------------*/ - -#define UT_OS_TIMER_DECLARE_EXTRA_VARIABLES_MACRO - -/*--------------------------------------------------------------------------------*/ - -#define UT_OS_TIMER_SET_SHORT_INTERVAL_ELSE_MACRO \ -{ \ - g_status = 0; \ - g_timerId = g_timerIds[3]; \ - g_timerFirst = 1; \ - g_cbLoopCntMax = 10; \ - startTime = 1000; \ - intervalTime = 5; \ - g_toleranceVal = 0; \ - memset(text, '\0', sizeof(text)); \ - UT_OS_LOG_MACRO("\nOS_TimerSet() - #3 Interval-too-short (clk_accuracy=%d)\n", \ - (int)g_clkAccuracy); \ - res = OS_TimerSet(g_timerIds[3], startTime, intervalTime); \ - if (res == OS_SUCCESS) \ - { \ - while (!g_status) \ - OS_TaskDelay(1); \ - if (g_status < 0) \ - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) \ - else \ - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) \ - } \ - else \ - { \ - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) \ - } \ - /* Reset test environment */ \ - OS_TimerDelete(g_timerIds[3]); \ -} - -/*--------------------------------------------------------------------------------*/ - -#define UT_OS_TIMER_SET_NOMINAL_ELSE_MACRO \ -{ \ - g_status = 0; \ - g_timerId = g_timerIds[4]; \ - g_timerFirst = 1; \ - g_cbLoopCntMax = 10; \ - startTime = 1000; \ - intervalTime = 500000; \ - g_toleranceVal = intervalTime / 20; /* 5% */ \ - memset(text, '\0', sizeof(text)); \ - UT_OS_LOG_MACRO("\nOS_TimerSet() - #1 Nominal condition (clk_accuracy=%d)\n", \ - (int)g_clkAccuracy); \ - res = OS_TimerSet(g_timerIds[4], startTime, intervalTime); \ - if (res == OS_SUCCESS) \ - { \ - while (!g_status) \ - OS_TaskDelay(1); \ - if (g_status > 0) \ - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) \ - else \ - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) \ - } \ - else \ - { \ - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) \ - } \ - /* Reset test environment */ \ - OS_TimerDelete(g_timerIds[4]); \ -} - -/*--------------------------------------------*/ -#endif /* _LINUX_OS_ */ -/*--------------------------------------------*/ - -/*--------------------------------------------*/ -#ifdef _VXWORKS_OS_ -/*--------------------------------------------*/ - -#define UT_OS_TIMER_DECLARE_EXTRA_VARIABLES_MACRO \ - extern uint32 g_cbLoopCntMax; \ - extern uint32 g_toleranceVal; \ - extern uint32 g_timerFirst; \ - extern int32 g_status; \ - extern uint32 g_timerId; - -/*--------------------------------------------------------------------------------*/ - -#define UT_OS_TIMER_SET_SHORT_INTERVAL_ELSE_MACRO \ -{ \ - g_status = 0; \ - g_timerId = g_timerIds[3]; \ - g_timerFirst = 1; \ - g_cbLoopCntMax = 10; \ - startTime = 1000; \ - intervalTime = 5; \ - g_toleranceVal = 0; \ - memset(text, '\0', sizeof(text)); \ - UT_os_sprintf(text, "\nOS_TimerSet() - #3 Interval-too-short (clk_accuracy=%d)\n", \ - (int)g_clkAccuracy); \ - UT_OS_LOG_MACRO(text) \ - res = OS_TimerSet(g_timerIds[3], startTime, intervalTime); \ - if (res == OS_SUCCESS) \ - { \ - while (!g_status) \ - OS_TaskDelay(1); \ - if (g_status < 0) \ - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) \ - else \ - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) \ - } \ - else \ - { \ - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) \ - } \ - /* Reset test environment */ \ - OS_TimerDelete(g_timerIds[3]); \ -} - -/*--------------------------------------------------------------------------------*/ - -#define UT_OS_TIMER_SET_NOMINAL_ELSE_MACRO \ -{ \ - g_status = 0; \ - g_timerId = g_timerIds[4]; \ - g_timerFirst = 1; \ - g_cbLoopCntMax = 10; \ - startTime = 1000; \ - intervalTime = 500000; \ - g_toleranceVal = intervalTime / 20; /* 5% */ \ - memset(text, '\0', sizeof(text)); \ - UT_os_sprintf(text, "\nOS_TimerSet() - #1 Nominal condition (clk_accuracy=%d)\n", \ - (int)g_clkAccuracy); \ - UT_OS_LOG_MACRO(text) \ - res = OS_TimerSet(g_timerIds[4], startTime, intervalTime); \ - if (res == OS_SUCCESS) \ - { \ - while (!g_status) \ - OS_TaskDelay(1); \ - if (g_status > 0) \ - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) \ - else \ - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) \ - } \ - else \ - { \ - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) \ - } \ - /* Reset test environment */ \ - OS_TimerDelete(g_timerIds[4]); \ -} - -/*--------------------------------------------*/ -#endif /* _VXWORKS_OS_ */ -/*--------------------------------------------*/ - -/*--------------------------------------------*/ -#ifdef OSP_ARINC653 -/*--------------------------------------------*/ - -#define UT_OS_TIMER_DECLARE_EXTRA_VARIABLES_MACRO - -/*--------------------------------------------------------------------------------*/ - -#define UT_OS_TIMER_SET_SHORT_INTERVAL_ELSE_MACRO \ -{ \ - /* Do nothing for now */ \ -} - -/*--------------------------------------------------------------------------------*/ - -#define UT_OS_TIMER_SET_NOMINAL_ELSE_MACRO \ -{ \ - RETURN_CODE_TYPE arincRes = NO_ERROR; \ - startTime = 1000; \ - intervalTime = 500000; \ - res = OS_TimerSet(g_timerIds[4], startTime, intervalTime); \ - if (res == OS_SUCCESS) \ - { \ - testDesc = "#4 Nominal - Manual inspection required"; \ - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_MIR) \ - } \ - else \ - { \ - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) \ - } \ - /* Reset test environment */ \ - PERIODIC_WAIT(&arincRes); \ - OS_TaskDelay(intervalTime * 500); \ - OS_TimerDelete(g_timerIds[4]); \ -} - -/*--------------------------------------------*/ -#endif /* OSP_ARINC653 */ -/*--------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Data types -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** External global variables -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------*/ -#if defined(_LINUX_OS_) || defined(_RTEMS_OS_) -/*--------------------------------------------*/ - -extern uint32 g_cbLoopCntMax; -extern uint32 g_toleranceVal; -extern uint32 g_timerFirst; -extern int32 g_status; -extern uint32 g_timerId; - -/*--------------------------------------------*/ -#endif /* _LINUX_OS_ */ -/*--------------------------------------------*/ - -/*--------------------------------------------*/ -#ifdef OSP_ARINC653 -/*--------------------------------------------*/ -/*--------------------------------------------*/ -#endif /* OSP_ARINC653 */ -/*--------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Global variables -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Function prototypes -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------*/ - -#endif /* _UT_OSTIMER_TEST_PLATFORMS_H_ */ - -/*================================================================================* -** End of File: ut_ostimer_test_platforms.h -**================================================================================*/ diff --git a/src/unit-tests/ostimer-test/ut_ostimer_timerio_test.c b/src/unit-tests/ostimer-test/ut_ostimer_timerio_test.c index 7a4ba90df..adee67e59 100644 --- a/src/unit-tests/ostimer-test/ut_ostimer_timerio_test.c +++ b/src/unit-tests/ostimer-test/ut_ostimer_timerio_test.c @@ -9,7 +9,6 @@ **--------------------------------------------------------------------------------*/ #include "ut_ostimer_timerio_test.h" -#include "ut_ostimer_test_platforms.h" /*--------------------------------------------------------------------------------* ** Macros @@ -23,15 +22,14 @@ ** External global variables **--------------------------------------------------------------------------------*/ -extern UT_OsLogInfo_t g_logInfo; - extern char* g_timerNames[UT_OS_TIMER_LIST_LEN]; -extern char g_longTimerName[OS_MAX_API_NAME+5]; - -extern int32 g_skipTestCase; -extern char* g_skipTestCaseResult; +extern char g_longTimerName[UT_OS_NAME_BUFF_SIZE]; -UT_OS_TIMER_DECLARE_EXTRA_VARIABLES_MACRO +extern uint32 g_cbLoopCntMax; +extern uint32 g_toleranceVal; +extern uint32 g_timerFirst; +extern int32 g_status; +extern uint32 g_timerId; /*--------------------------------------------------------------------------------* ** External function prototypes @@ -62,11 +60,7 @@ void UT_os_sample_test() /* Must declare these variables for each function. They can be renamed. * They're referenced in the macros used to track test cases and their results. */ int32 idx = 0; - UT_OsApiInfo_t apiInfo; - const char* testDesc = NULL; - - /* Call this once at the beginning of the function to initialize the test variables. */ - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; /*-----------------------------------------------------* * For each test case, @@ -88,7 +82,7 @@ void UT_os_sample_test() if (OS_xxx() == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_sample_test_exit_tag; } @@ -100,9 +94,9 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(NULL,...) == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* TODO: Reset the test environment here, if necessary */ @@ -112,9 +106,9 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(aVeryLoooooongName) == OS_ERR_NAME_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* TODO: Reset the test environment here, if necessary */ @@ -124,17 +118,15 @@ void UT_os_sample_test() /* TODO: Setup the test environment here, if necessary */ if (OS_xxx(...) != OS_SUCCESS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); /* TODO: Reset the test environment here, if necessary */ UT_os_sample_test_exit_tag: - /* Call these macros at the very end of the function to close out the test variables - * and get it added to the global list being tracked. */ - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_xxx", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } #endif @@ -168,11 +160,8 @@ void UT_os_sample_test() *--------------------------------------------------------------------------------*/ void UT_os_timerinit_test() { - int32 res=0, idx=0; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + int32 res=0; + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "#1 Init-not-call-first"; @@ -180,14 +169,14 @@ void UT_os_timerinit_test() res = OS_TimerCreate(&g_timerIds[0], "Timer #0", &g_clkAccuracy, &UT_os_timercallback); if (res != OS_SUCCESS) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); } else { /* Reset test environment */ OS_TimerDelete(g_timerIds[0]); - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } /*-----------------------------------------------------*/ @@ -197,27 +186,26 @@ void UT_os_timerinit_test() if (res == OS_ERR_NOT_IMPLEMENTED) { testDesc = "API not implemented"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); } else if (res == OS_SUCCESS) { res = OS_TimerCreate(&g_timerIds[0], "Timer #0", &g_clkAccuracy, &UT_os_timercallback); if (res == OS_SUCCESS) - /* cppcheck-suppress syntaxError */ - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ OS_TimerDelete(g_timerIds[0]); } else { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_TimerAPIInit", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -291,12 +279,9 @@ void UT_os_timerinit_test() **--------------------------------------------------------------------------------*/ void UT_os_timercreate_test() { - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - int32 res=0, idx=0, i=0, j=0; - char tmpStr[UT_OS_XS_TEXT_LEN]; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + const char* testDesc; + int32 res=0, i=0, j=0; + char tmpStr[UT_OS_NAME_BUFF_SIZE]; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -304,7 +289,7 @@ void UT_os_timercreate_test() res = OS_TimerCreate(&g_timerIds[0], g_timerNames[0], &g_clkAccuracy, &UT_os_timercallback); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_timercreate_test_exit_tag; } @@ -320,18 +305,18 @@ void UT_os_timercreate_test() OS_INVALID_POINTER) && (OS_TimerCreate(&g_timerIds[1], g_timerNames[1], NULL, &UT_os_timercallback) == OS_INVALID_POINTER)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Name-too-long"; if (OS_TimerCreate(&g_timerIds[2], g_longTimerName, &g_clkAccuracy, &UT_os_timercallback) == OS_ERR_NAME_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Name-taken"; @@ -340,9 +325,9 @@ void UT_os_timercreate_test() OS_SUCCESS) && (OS_TimerCreate(&g_timerIds[4], g_timerNames[3], &g_clkAccuracy, &UT_os_timercallback) == OS_ERR_NAME_TAKEN)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ OS_TimerDelete(g_timerIds[3]); @@ -350,53 +335,46 @@ void UT_os_timercreate_test() /*-----------------------------------------------------*/ testDesc = "#4 No-free-IDs"; - if (g_skipTestCase == 4) + for (i=0; i <= OS_MAX_TIMERS; i++) + { + memset(tmpStr, '\0', sizeof(tmpStr)); + UT_os_sprintf(tmpStr, "Timer #%d", (int)i); + res = OS_TimerCreate(&g_timerIds[i], tmpStr, &g_clkAccuracy, &UT_os_timercallback); + if (res != OS_SUCCESS) + break; + } + + if (i < OS_MAX_TIMERS) + { + testDesc = "#4 No-free-IDs - Timer-created failed"; + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); + } + else if (res == OS_ERR_NO_FREE_IDS) { - testDesc = "#4 No-free-IDs - Test case not applicable on platform"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, g_skipTestCaseResult) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); } else { - for (i=0; i <= OS_MAX_TIMERS; i++) - { - memset(tmpStr, '\0', sizeof(tmpStr)); - UT_os_sprintf(tmpStr, "Timer #%d", (int)i); - res = OS_TimerCreate(&g_timerIds[i], tmpStr, &g_clkAccuracy, &UT_os_timercallback); - if (res != OS_SUCCESS) - break; - } - - if (i < OS_MAX_TIMERS) - { - testDesc = "#4 No-free-IDs - Timer-created failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) - } - else if (i == OS_MAX_TIMERS) - { - if (res == OS_ERR_NO_FREE_IDS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) - else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) - } - - /* Reset test environment */ - for (j=0; j < i; j++) - OS_TimerDelete(g_timerIds[j]); + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } + /* Reset test environment */ + for (j=0; j < i; j++) + OS_TimerDelete(g_timerIds[j]); + /*-----------------------------------------------------*/ testDesc = "#5 Invalid-arg"; if (OS_TimerCreate(&g_timerIds[5], g_timerNames[5], &g_clkAccuracy, NULL) == OS_TIMER_ERR_INVALID_ARGS) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#6 Timer-unavailable"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#7 Nominal"; @@ -407,18 +385,18 @@ void UT_os_timercreate_test() if ((OS_TimerGetIdByName(&g_timerIds[8], g_timerNames[7]) == OS_SUCCESS) && (g_timerIds[7] == g_timerIds[8]) && (OS_TimerDelete(g_timerIds[7]) == OS_SUCCESS)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } else { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } UT_os_timercreate_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_TimerCreate", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -465,11 +443,8 @@ void UT_os_timercreate_test() **--------------------------------------------------------------------------------*/ void UT_os_timerdelete_test() { - int32 res=0, idx=0; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + int32 res=0; + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -477,7 +452,7 @@ void UT_os_timerdelete_test() res = OS_TimerDelete(99999); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_timerdelete_test_exit_tag; } @@ -485,14 +460,14 @@ void UT_os_timerdelete_test() testDesc = "#1 Invalid-id-arg"; if (OS_TimerDelete(99999) == OS_ERR_INVALID_ID) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Internal-error"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#3 Nominal"; @@ -501,7 +476,7 @@ void UT_os_timerdelete_test() if (res != OS_SUCCESS) { testDesc = "#3 Nominal - Timer-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_timerdelete_test_exit_tag; } @@ -510,21 +485,21 @@ void UT_os_timerdelete_test() if ((OS_TimerGetIdByName(&g_timerIds[4], g_timerNames[3]) == OS_ERR_NAME_NOT_FOUND) && (OS_TimerCreate(&g_timerIds[3], g_timerNames[3], &g_clkAccuracy, &UT_os_timercallback) == OS_SUCCESS)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } else { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } /* Reset test environment */ OS_TimerDelete(g_timerIds[3]); UT_os_timerdelete_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_TimerDelete", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -580,58 +555,71 @@ void UT_os_timerdelete_test() **--------------------------------------------------------------------------------*/ void UT_os_timerset_test() { - int32 res=0, idx=0; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - char text[UT_OS_LG_TEXT_LEN]; + int32 res=0; + const char* testDesc; uint32 startTime=0, intervalTime=0; - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - /*-----------------------------------------------------*/ testDesc = "API not implemented"; res = OS_TimerSet(99999, startTime, intervalTime); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_timerset_test_exit_tag; } /*-----------------------------------------------------*/ testDesc = "#1 Invalid-id-arg"; - res = OS_TimerSet(99999, startTime, intervalTime); + res = OS_TimerSet(99999, 10000, 10000); if (res == OS_ERR_INVALID_ID) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Internal-error"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_UOF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_INFO); /*-----------------------------------------------------*/ testDesc = "#3 Interval-too-short"; - if (g_skipTestCase == 3) + res = OS_TimerCreate(&g_timerIds[3], g_timerNames[3], &g_clkAccuracy, &UT_os_timercallback); + if (res != OS_SUCCESS) { - testDesc = "#3 Interval-too-short - Test case not applicable on platform"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, g_skipTestCaseResult) + testDesc = "#3 Interval-too-short - Timer-create failed"; + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { - res = OS_TimerCreate(&g_timerIds[3], g_timerNames[3], &g_clkAccuracy, &UT_os_timercallback); - if (res != OS_SUCCESS) + g_status = 0; + g_timerId = g_timerIds[3]; + g_timerFirst = 1; + g_cbLoopCntMax = 10; + startTime = 1000; + intervalTime = 5; + g_toleranceVal = 0; + + UT_OS_LOG("\nOS_TimerSet() - #3 Interval-too-short (clk_accuracy=%d)\n", + (int)g_clkAccuracy); + res = OS_TimerSet(g_timerIds[3], startTime, intervalTime); + if (res == OS_SUCCESS) { - testDesc = "#3 Interval-too-short - Timer-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + while (!g_status) + OS_TaskDelay(1); + if (g_status < 0) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); + else + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } else { - UT_OS_TIMER_SET_SHORT_INTERVAL_ELSE_MACRO + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } + /* Reset test environment */ + OS_TimerDelete(g_timerIds[3]); } /*-----------------------------------------------------*/ @@ -641,17 +629,41 @@ void UT_os_timerset_test() if (res != OS_SUCCESS) { testDesc = "#4 Nominal - Timer-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_timerset_test_exit_tag; } else { - UT_OS_TIMER_SET_NOMINAL_ELSE_MACRO + g_status = 0; + g_timerId = g_timerIds[4]; + g_timerFirst = 1; + g_cbLoopCntMax = 10; + startTime = 1000; + intervalTime = 500000; + g_toleranceVal = intervalTime / 20; /* 5% */ + UT_OS_LOG("\nOS_TimerSet() - #1 Nominal condition (clk_accuracy=%d)\n", + (int)g_clkAccuracy); + res = OS_TimerSet(g_timerIds[4], startTime, intervalTime); + if (res == OS_SUCCESS) + { + while (!g_status) + OS_TaskDelay(1); + if (g_status > 0) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); + else + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); + } + else + { + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); + } + /* Reset test environment */ + OS_TimerDelete(g_timerIds[4]); } UT_os_timerset_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_TimerSet", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -698,11 +710,8 @@ void UT_os_timerset_test() **--------------------------------------------------------------------------------*/ void UT_os_timergetidbyname_test() { - int32 res=0, idx=0; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; - - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) + int32 res=0; + const char* testDesc; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -710,7 +719,7 @@ void UT_os_timergetidbyname_test() res = OS_TimerGetIdByName(&g_timerIds[0], g_timerNames[0]); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_timergetidbyname_test_exit_tag; } @@ -719,25 +728,25 @@ void UT_os_timergetidbyname_test() if ((OS_TimerGetIdByName(NULL, g_timerNames[1]) == OS_INVALID_POINTER) && (OS_TimerGetIdByName(&g_timerIds[1], NULL) == OS_INVALID_POINTER)) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#2 Name-too-long"; if (OS_TimerGetIdByName(&g_timerIds[2], g_longTimerName) == OS_ERR_NAME_TOO_LONG) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#3 Name-not-found"; if (OS_TimerGetIdByName(&g_timerIds[3], g_timerNames[3]) == OS_ERR_NAME_NOT_FOUND) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ testDesc = "#4 Nominal"; @@ -746,22 +755,22 @@ void UT_os_timergetidbyname_test() if (res != OS_SUCCESS) { testDesc = "#4 Nominal - Timer-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); goto UT_os_timergetidbyname_test_exit_tag; } res = OS_TimerGetIdByName(&g_timerIds[5], g_timerNames[4]); if ((res == OS_SUCCESS) && (g_timerIds[4] == g_timerIds[5])) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ OS_TimerDelete(g_timerIds[4]); UT_os_timergetidbyname_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_TimerGetIdByName", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*--------------------------------------------------------------------------------* @@ -803,20 +812,17 @@ void UT_os_timergetidbyname_test() **--------------------------------------------------------------------------------*/ void UT_os_timergetinfo_test() { - int32 res=0, idx=0; - UT_OsApiInfo_t apiInfo; - const char* testDesc=NULL; + int32 res=0; + const char* testDesc; OS_timer_prop_t timerProps; - UT_OS_CLEAR_API_INFO_MACRO(apiInfo, idx) - /*-----------------------------------------------------*/ testDesc = "API not implemented"; res = OS_TimerGetInfo(99999, &timerProps); if (res == OS_ERR_NOT_IMPLEMENTED) { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_NA) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_NA); goto UT_os_timergetinfo_test_exit_tag; } @@ -827,14 +833,14 @@ void UT_os_timergetinfo_test() if (res != OS_SUCCESS) { testDesc = "#1 Null-pointer-arg - Timer-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { if (OS_TimerGetInfo(g_timerIds[1], NULL) == OS_INVALID_POINTER) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /* Reset test environment */ OS_TimerDelete(g_timerIds[1]); @@ -844,9 +850,9 @@ void UT_os_timergetinfo_test() testDesc = "#2 Invalid-id-arg"; if (OS_TimerGetInfo(99999, &timerProps) == OS_ERR_INVALID_ID) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); /*-----------------------------------------------------*/ @@ -856,7 +862,7 @@ void UT_os_timergetinfo_test() if (res != OS_SUCCESS) { testDesc = "#3 Nominal - Timer-create failed"; - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_TSF) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_TSF); } else { @@ -865,13 +871,13 @@ void UT_os_timergetinfo_test() if (res == OS_SUCCESS) { if (strcmp(timerProps.name, g_timerNames[3]) == 0) - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_PASSED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_PASS); else - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } else { - UT_OS_SET_TEST_RESULT_MACRO(apiInfo, idx, testDesc, UT_OS_FAILED) + UT_OS_TEST_RESULT( testDesc, UTASSERT_CASETYPE_FAILURE); } /* Reset test environment */ @@ -879,8 +885,8 @@ void UT_os_timergetinfo_test() } UT_os_timergetinfo_test_exit_tag: - UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(apiInfo, "OS_TimerGetInfo", idx) - UT_OS_LOG_API_MACRO(apiInfo) + return; + } /*================================================================================* diff --git a/src/unit-tests/ostimer-test/ut_ostimer_timerio_test.h b/src/unit-tests/ostimer-test/ut_ostimer_timerio_test.h index 9776ddb3f..827cfb8b0 100644 --- a/src/unit-tests/ostimer-test/ut_ostimer_timerio_test.h +++ b/src/unit-tests/ostimer-test/ut_ostimer_timerio_test.h @@ -11,7 +11,7 @@ ** Includes **--------------------------------------------------------------------------------*/ -#include "ut_os_stubs.h" +#include "ut_os_support.h" /*--------------------------------------------------------------------------------* ** Macros diff --git a/src/unit-tests/shared/shared.mak b/src/unit-tests/shared/shared.mak deleted file mode 100644 index 958ebd9a1..000000000 --- a/src/unit-tests/shared/shared.mak +++ /dev/null @@ -1,25 +0,0 @@ -############################################################################### -# File: osal.mak -# -# Purpose: -# Compile the OS Abstraction layer library. -# -# History: -# 2004/04/12 A. Cudmore : Initial revision for SDO. -# 2004/05/24 P. Kutt : Modified for new directory structure; rewrote comments. -# -############################################################################### - -# Subsystem produced by this makefile. -TARGET = shared.o - -#============================================================================== -# Object files required to build subsystem. - -# OBJS=ut_oscore_stubs.o ut_osfile_stubs.o ut_osfilesys_stubs.o ut_osloader_stubs.o ut_osnetwork_stubs.o ut_os_stubs.o ut_ostimer_stubs.o -OBJS=ut_os_stubs.o -#============================================================================== -# Source files required to build subsystem; used to generate dependencies. - -SOURCES = $(OBJS:.o=.c) - diff --git a/src/unit-tests/shared/ut_os_stubs.c b/src/unit-tests/shared/ut_os_stubs.c deleted file mode 100644 index 4877b2456..000000000 --- a/src/unit-tests/shared/ut_os_stubs.c +++ /dev/null @@ -1,344 +0,0 @@ -/*================================================================================* -** File: ut_os_stubs.c -** Owner: Tam Ngo -** Date: May 2013 -**================================================================================*/ - -#include "ut_os_stubs.h" - -/*--------------------------------------------------------------------------------* -** Macros -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Data types -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** External global variables -**--------------------------------------------------------------------------------*/ - -/* As defined in osfilesys.c */ -extern OS_VolumeInfo_t OS_VolumeTable[NUM_TABLE_ENTRIES]; - -/*--------------------------------------------------------------------------------* -** Global variables -**--------------------------------------------------------------------------------*/ - -UT_OsLogInfo_t g_logInfo; - -/*--------------------------------------------------------------------------------* -** Sets up test environment -**--------------------------------------------------------------------------------*/ -void UT_os_setup(const char* logFileName) -{ - g_logInfo.nPassed = 0; - g_logInfo.nFailed = 0; - g_logInfo.nMir = 0; - g_logInfo.nNa = 0; - g_logInfo.nUof = 0; - g_logInfo.nTsf = 0; - - g_logInfo.totalTstCnt = 0; - - g_logInfo.apiCnt = 0; - memset(g_logInfo.apis, 0x00, sizeof(g_logInfo.apis)); - - g_logInfo.verboseLevel = 0; - -#ifndef OS_USE_EMBEDDED_PRINTF - g_logInfo.logFD = NULL; - if (logFileName != NULL) - { - g_logInfo.logFD = fopen(logFileName, "w"); - if (g_logInfo.logFD == NULL) - fprintf(stderr, "Error: Can't open file %s\n", logFileName); - } -#endif /* !OS_USE_EMBEDDED_PRINTF */ -} - -/*--------------------------------------------------------------------------------* -** Tears down test setup -**--------------------------------------------------------------------------------*/ -void UT_os_teardown(const char* testSuiteName) -{ - UT_os_log_test_summaries(testSuiteName); - UT_os_log_test_results(testSuiteName); - -#ifndef OS_USE_EMBEDDED_PRINTF - if (g_logInfo.logFD != NULL) - { - fflush(g_logInfo.logFD); - fclose(g_logInfo.logFD); - g_logInfo.logFD = NULL; - } -#endif /* !OS_USE_EMBEDDED_PRINTF */ - - OS_printf("\n%s HAS %d tests total.\n", testSuiteName, (int)g_logInfo.totalTstCnt); - OS_printf("%s PASSED %d tests.\n", testSuiteName, (int)g_logInfo.nPassed); - OS_printf("%s FAILED %d tests.\n", testSuiteName, (int)g_logInfo.nFailed); - - if (g_logInfo.nMir > 0) - { - OS_printf("%s HAS %d tests requiring manual inspection.\n", - testSuiteName, (int)g_logInfo.nMir); - } - - if (g_logInfo.nUof > 0) - { - OS_printf("%s SKIPPED %d tests relating to OS-call-failure.\n", - testSuiteName, (int)g_logInfo.nUof); - } - - if (g_logInfo.nNa > 0) - { - OS_printf("%s SKIPPED %d tests not applicable to the platform.\n", - testSuiteName, (int)g_logInfo.nNa); - } - - if (g_logInfo.nTsf > 0) - { - OS_printf("%s SKIPPED %d tests failing test setup.\n", - testSuiteName, (int)g_logInfo.nTsf); - } - - OS_printf("\n"); -} - -/*--------------------------------------------------------------------------------* -** Logs an API test descriptions -**--------------------------------------------------------------------------------*/ -void UT_os_log_api(UT_OsApiInfo_t* apiPtr) -{ - if (apiPtr != NULL) - { - int32 i = 0; - UT_OsApiInfo_t* apiInfo = NULL; - UT_OsTestDesc_t* testInfo = NULL; - UT_OsTestDesc_t* testPtr = NULL; - - apiInfo = &(g_logInfo.apis[g_logInfo.apiCnt]); - memset(apiInfo, 0x00, sizeof(UT_OsApiInfo_t)); - - strncpy(apiInfo->name, apiPtr->name, strlen(apiPtr->name)); - - apiInfo->tstCnt = apiPtr->tstCnt; - g_logInfo.totalTstCnt += apiInfo->tstCnt; - - for (i=0; i < apiInfo->tstCnt; i++) - { - testPtr = &(apiPtr->tests[i]); - testInfo = &(apiInfo->tests[i]); - - memset(testInfo, 0x00, sizeof(UT_OsTestDesc_t)); - - strncpy(testInfo->name, testPtr->name, strlen(testPtr->name)); - strncpy(testInfo->result, testPtr->result, strlen(testPtr->result)); - - if (strcmp(testInfo->result, UT_OS_PASSED) == 0) - g_logInfo.nPassed++; - else if (strcmp(testInfo->result, UT_OS_FAILED) == 0) - g_logInfo.nFailed++; - else if (strcmp(testInfo->result, UT_OS_MIR) == 0) - g_logInfo.nMir++; - else if (strcmp(testInfo->result, UT_OS_NA) == 0) - g_logInfo.nNa++; - else if (strcmp(testInfo->result, UT_OS_UOF) == 0) - g_logInfo.nUof++; - else if (strcmp(testInfo->result, UT_OS_TSF) == 0) - g_logInfo.nTsf++; - } - - g_logInfo.apiCnt++; - } -} - -/*--------------------------------------------------------------------------------* -** Set verbose level for logging -**--------------------------------------------------------------------------------*/ -void UT_os_set_log_verbose(uint32 vLevel) -{ - switch (vLevel) - { - case UT_OS_LOG_OFF: - case UT_OS_LOG_MINIMAL: - case UT_OS_LOG_MODERATE: - case UT_OS_LOG_EVERYTHING: - g_logInfo.verboseLevel = vLevel; - break; - - default: - g_logInfo.verboseLevel = UT_OS_LOG_EVERYTHING; - break; - } -} - -/*--------------------------------------------------------------------------------* -** Set return code -**--------------------------------------------------------------------------------*/ -void UT_os_set_return_code(UT_OsReturnCode_t* ret, int32 count, int32 value) -{ - if (ret != NULL) - { - ret->count = count; - ret->value = value; - } -} - -/*--------------------------------------------------------------------------------* -** Log test summaries -**--------------------------------------------------------------------------------*/ -void UT_os_log_test_summaries(const char* testSuiteName) -{ - const char* tstName = testSuiteName; - - if (tstName == NULL) - tstName = " "; - - UT_OS_LOG_MACRO("\n========================================================\n"); - UT_OS_LOG_MACRO("%s TOTAL APIs: %d\n", tstName, (int)g_logInfo.apiCnt); - UT_OS_LOG_MACRO("%s TOTAL TEST CASES: %d\n\n", tstName, (int)g_logInfo.totalTstCnt); - UT_OS_LOG_MACRO("%s PASSED %3d tests.\n", tstName, (int)g_logInfo.nPassed); - UT_OS_LOG_MACRO("%s FAILED %3d tests.\n", tstName, (int)g_logInfo.nFailed); - - UT_OS_LOG_MACRO("\n%s contains %2d tests that are untested OS-call-failure.\n", - tstName, (int)g_logInfo.nUof); - UT_OS_LOG_MACRO("%s contains %2d tests that are manual-inspection-required.\n", - tstName, (int)g_logInfo.nMir); - UT_OS_LOG_MACRO("\n%s contains %2d tests that are not-applicable.\n", - tstName, (int)g_logInfo.nNa); - - if (g_logInfo.nTsf > 0) - { - UT_OS_LOG_MACRO("\n%s contains %2d tests that are test-setup-failure.\n", - tstName, (int)g_logInfo.nTsf); - } - - UT_OS_LOG_MACRO("========================================================\n") -} - -/*--------------------------------------------------------------------------------* -** Print log info -**--------------------------------------------------------------------------------*/ -void UT_os_log_test_results(const char* testSuiteName) -{ - int32 i = 0, j = 0; - UT_OsApiInfo_t* apiPtr = NULL; - const char* tstName = testSuiteName; - - if (tstName == NULL) - tstName = " "; - - if (g_logInfo.verboseLevel >= UT_OS_LOG_MODERATE) - { - UT_OS_LOG_MACRO("\n--------------------------------------------------------\n"); - UT_OS_LOG_MACRO("%s TOTAL APIs: %d\n", tstName, (int)g_logInfo.apiCnt); - UT_OS_LOG_MACRO("%s TOTAL TEST CASES: %d\n", tstName, (int)g_logInfo.totalTstCnt); - UT_OS_LOG_MACRO("--------------------------------------------------------"); - - for (i=0; i < g_logInfo.apiCnt; i++) - { - apiPtr = &(g_logInfo.apis[i]); - UT_OS_LOG_MACRO("\n %s: %d\n", apiPtr->name, (int)apiPtr->tstCnt); - for (j=0; j < apiPtr->tstCnt; j++) - { - UT_OS_LOG_MACRO(" %s [%s]\n", apiPtr->tests[j].name, - apiPtr->tests[j].result); - } - } - } - - UT_os_log_test_result_category("PASSED", UT_OS_PASSED, g_logInfo.nPassed); - UT_os_log_test_result_category("FAILED", UT_OS_FAILED, g_logInfo.nFailed); - UT_os_log_test_result_category("MANUAL-INSPECTION-REQUIRED", UT_OS_MIR, g_logInfo.nMir); - UT_os_log_test_result_category("NOT-APPLICABLE", UT_OS_NA, g_logInfo.nNa); - UT_os_log_test_result_category("UNTESTED-OS-CALL-FAILURE", UT_OS_UOF, g_logInfo.nUof); - - if (g_logInfo.nTsf > 0) - { - UT_os_log_test_result_category("TEST-SETUP-FAILURE", UT_OS_TSF, g_logInfo.nTsf); - } - - if (g_logInfo.verboseLevel != UT_OS_LOG_OFF) - { - UT_OS_LOG_MACRO("\n\n"); - } -} - -/*--------------------------------------------------------------------------------* -** Print a test-result category -**--------------------------------------------------------------------------------*/ -void UT_os_log_test_result_category(const char* catName, const char* catKey, uint32 nCases) -{ - int32 i = 0, j = 0; - UT_OsApiInfo_t* apiPtr = NULL; - const char* inCatKey = catKey; - char txtStr[UT_OS_LG_TEXT_LEN]; - const char* inCatName = catName; - - if (inCatKey == NULL) - inCatKey = " "; - - if (inCatName == NULL) - inCatName = " "; - - if (g_logInfo.verboseLevel >= UT_OS_LOG_MODERATE) - { - UT_OS_LOG_MACRO("\n--------------------------------------------------------\n"); - UT_OS_LOG_MACRO(" TOTAL TEST CASES %s -> %d\n", inCatName, (int)nCases); - UT_OS_LOG_MACRO("--------------------------------------------------------\n"); - - for (i=0; i < g_logInfo.apiCnt; i++) - { - apiPtr = &(g_logInfo.apis[i]); - for (j=0; j < apiPtr->tstCnt; j++) - { - if (strcmp(apiPtr->tests[j].result, inCatKey) == 0) - { - memset(txtStr, '\0', sizeof(txtStr)); - UT_OS_LOG_MACRO(" %s [ ] %s - %s \n", - inCatKey, apiPtr->name, apiPtr->tests[j].name); - } - } - } - } -} - -/*--------------------------------------------------------------------------------* -** Print OS_VolumeTable[] -**--------------------------------------------------------------------------------*/ -void UT_os_print_volumetable(const char* outputDesc) -{ -#ifdef UT_VERBOSE - int j; - - if (outputDesc) - UT_OS_LOG_MACRO("%s",outputDesc) - - UT_OS_LOG_MACRO("\n--------------------------------------------------------------") - UT_OS_LOG_MACRO("-------------------------------------------------------------\n") - UT_OS_LOG_MACRO(" %-8s%-16s%-32s%-14s%-18s%-8s%-8s%-10s", "DEVNAME", "PHYSDEV", "VOLNAME", "MOUNTPNT", "VOLATILE?","FREE?","MOUNTED?","BLOCKSIZE"); - UT_OS_LOG_MACRO("\n--------------------------------------------------------------") - UT_OS_LOG_MACRO("-------------------------------------------------------------\n") - - for (j=0; j < NUM_TABLE_ENTRIES; j++) - { - UT_OS_LOG_MACRO(" %-8s%-16s%-32s%-14s%-18d%-8d%-8d%-10d\n", - OS_VolumeTable[j].DeviceName, - OS_VolumeTable[j].PhysDevName, - OS_VolumeTable[j].VolumeName, - OS_VolumeTable[j].MountPoint, - (int)OS_VolumeTable[j].VolatileFlag, - (int)OS_VolumeTable[j].FreeFlag, - (int)OS_VolumeTable[j].IsMounted, - (int)OS_VolumeTable[j].BlockSize); - } - - UT_OS_LOG_MACRO("\n") -#endif /* UT_VERBOSE */ -} - - -/*================================================================================* -** End of File: ut_os_stubs.c -**================================================================================*/ diff --git a/src/unit-tests/shared/ut_os_stubs.h b/src/unit-tests/shared/ut_os_stubs.h deleted file mode 100644 index ec4f20b54..000000000 --- a/src/unit-tests/shared/ut_os_stubs.h +++ /dev/null @@ -1,187 +0,0 @@ -/*================================================================================* -** File: ut_os_stubs.h -** Owner: Tam Ngo -** Date: May 2013 -**================================================================================*/ - -#ifndef _UT_OS_STUBS_H_ -#define _UT_OS_STUBS_H_ - -/*--------------------------------------------------------------------------------* -** Includes -**--------------------------------------------------------------------------------*/ - -/* If the embedded printf is not being used, then stdio is required */ -#ifndef OS_USE_EMBEDDED_PRINTF -#include -#endif - -#include - -#include -#include - -#include "common_types.h" -#include "osapi.h" -#include "osconfig.h" - -/*--------------------------------------------------------------------------------* -** Macros -**--------------------------------------------------------------------------------*/ - -/* Only use by developers for debugging; comment out when not debugging */ -/*#define OS_LOG_TO_STDOUT_TOO*/ - -#define UT_OS_LOG_OFF 0 -#define UT_OS_LOG_MINIMAL 1 -#define UT_OS_LOG_MODERATE 2 -#define UT_OS_LOG_EVERYTHING 3 - -#define UT_OS_PASSED "PASSED" -#define UT_OS_FAILED "FAILED" -#define UT_OS_MIR "_MIR_ " /* Manual Inspection Required */ -#define UT_OS_NA "__NA__" /* Not Applicable */ -#define UT_OS_UOF "_UOF_ " /* Untested OS-call Failure */ -#define UT_OS_TSF "_TSF_ " /* Test Setup Failure */ - -#define UT_OS_XS_LIST_LEN 25 -#define UT_OS_SM_LIST_LEN 50 -#define UT_OS_MD_LIST_LEN 100 -#define UT_OS_LG_LIST_LEN 200 - -#define UT_OS_XS_TEXT_LEN 25 -#define UT_OS_SM_TEXT_LEN 75 -#define UT_OS_MD_TEXT_LEN 125 -#define UT_OS_LG_TEXT_LEN 250 - -/*--------------------------------------------------------------------------------*/ - -#define UT_OS_CLEAR_API_INFO_MACRO(VAR1, TSTIDX) \ - memset(&(VAR1), 0x00, sizeof(UT_OsApiInfo_t)); \ - TSTIDX = 0; - -/*--------------------------------------------------------------------------------*/ - -#define UT_OS_SET_API_NAME_AND_TEST_COUNT_MACRO(VAR1, APINAME, TSTCNT) \ -{ \ - memset(VAR1.name, '\0', sizeof(VAR1.name)); \ - strncpy(VAR1.name, APINAME, strlen(APINAME)); \ - VAR1.tstCnt = TSTCNT; \ -} - -/*--------------------------------------------------------------------------------*/ - -#define UT_OS_SET_TEST_RESULT_MACRO(VAR1, TSTIDX, TSTNAME, TSTRESULT) \ -{ \ - memset(&(VAR1.tests[TSTIDX]), 0x00, sizeof(UT_OsTestDesc_t)); \ - strncpy(VAR1.tests[TSTIDX].name, TSTNAME, strlen(TSTNAME)); \ - strncpy(VAR1.tests[TSTIDX].result, TSTRESULT, strlen(TSTRESULT)); \ - (TSTIDX)++; \ -} - -/*--------------------------------------------------------------------------------*/ - -#define UT_OS_LOG_API_MACRO(VAR1) \ - UT_os_log_api(&VAR1); - -/*--------------------------------------------------------------------------------*/ - -#ifdef OS_USE_EMBEDDED_PRINTF -#define UT_os_printf OS_printf -#define UT_os_sprintf OS_sprintf -#else -#define UT_os_printf printf -#define UT_os_sprintf sprintf -#endif /* OS_USE_EMBEDDED_PRINTF */ - -/*--------------------------------------------------------------------------------*/ - -#ifdef OS_USE_EMBEDDED_PRINTF -#define UT_OS_LOG_MACRO(...) UT_os_printf(__VA_ARGS__); -#else -#ifdef OS_LOG_TO_STDOUT_TOO -#define UT_OS_LOG_MACRO(...) \ - UT_os_printf(__VA_ARGS__); \ - if (g_logInfo.logFD != NULL) \ - fprintf(g_logInfo.logFD, __VA_ARGS__); -#else -#define UT_OS_LOG_MACRO(...) \ - if (g_logInfo.logFD != NULL) \ - fprintf(g_logInfo.logFD, __VA_ARGS__); -#endif /* OS_LOG_TO_STDOUT_TOO */ -#endif /* OS_USE_EMBEDDED_PRINTF */ - -/*--------------------------------------------------------------------------------* -** Data types -**--------------------------------------------------------------------------------*/ - -typedef struct -{ - char name[UT_OS_SM_TEXT_LEN]; - char result[UT_OS_SM_TEXT_LEN]; -} UT_OsTestDesc_t; - -typedef struct -{ - char name[UT_OS_SM_TEXT_LEN]; - uint32 tstCnt; - UT_OsTestDesc_t tests[UT_OS_XS_LIST_LEN]; -} UT_OsApiInfo_t; - -typedef struct -{ -#ifndef OS_USE_EMBEDDED_PRINTF - FILE* logFD; -#endif /* !OS_USE_EMBEDDED_PRINTF */ - uint32 verboseLevel; - uint32 apiCnt; - UT_OsApiInfo_t apis[UT_OS_LG_LIST_LEN]; - uint32 totalTstCnt; - uint32 nPassed; - uint32 nFailed; - uint32 nMir; - uint32 nNa; - uint32 nUof; - uint32 nTsf; -} UT_OsLogInfo_t; - -typedef struct -{ - int32 count; - int32 value; -} UT_OsReturnCode_t; - -/*--------------------------------------------------------------------------------* -** External global variables -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Global variables -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Function prototypes -**--------------------------------------------------------------------------------*/ - -void UT_os_setup(const char* logFileName); -void UT_os_teardown(const char* testSuiteName); - -void UT_os_log_api(UT_OsApiInfo_t* apiPtr); - -void UT_os_set_log_verbose(uint32 verboseLevel); -void UT_os_set_return_code(UT_OsReturnCode_t* ret, int32 count, int32 value); - -void UT_os_log_test_summaries(const char* testSuiteName); -void UT_os_log_test_results(const char* testSuiteName); -void UT_os_log_test_result_category(const char* catName, const char* catKey, uint32 nCases); - -void UT_os_print_fdtable(const char* outputDesc); -void UT_os_print_volumetable(const char* outputDesc); - -/*--------------------------------------------------------------------------------*/ - -#endif /* _UT_OS_STUBS_H_ */ - -/*================================================================================* -** End of File: ut_os_stubs.h -**================================================================================*/ diff --git a/src/unit-tests/shared/ut_oscore_stubs.c b/src/unit-tests/shared/ut_oscore_stubs.c deleted file mode 100644 index d0b780b98..000000000 --- a/src/unit-tests/shared/ut_oscore_stubs.c +++ /dev/null @@ -1,48 +0,0 @@ -/*================================================================================* -** File: ut_oscore_stubs.c -** Owner: Tam Ngo -** Date: March 2013 -**================================================================================*/ - -/*--------------------------------------------------------------------------------* -** Includes -**--------------------------------------------------------------------------------*/ - -#include "ut_os_stubs.h" - -/*--------------------------------------------------------------------------------* -** Macros -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Data types -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** External global variables -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Global variables -**--------------------------------------------------------------------------------*/ - -UT_OsReturnCode_t g_apiInit = {0,0}; - -/*--------------------------------------------------------------------------------* -** Local function prototypes -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Function definitions -**--------------------------------------------------------------------------------*/ - -int32 OS_API_Init() -{ - return (g_apiInit.value); -} - -/*--------------------------------------------------------------------------------*/ - -/*================================================================================* -** End of File: ut_oscore_stubs.c -**================================================================================*/ diff --git a/src/unit-tests/shared/ut_osfile_stubs.c b/src/unit-tests/shared/ut_osfile_stubs.c deleted file mode 100644 index c686ad0fb..000000000 --- a/src/unit-tests/shared/ut_osfile_stubs.c +++ /dev/null @@ -1,223 +0,0 @@ -/*================================================================================* -** File: ut_osfile_stubs.c -** Owner: Tam Ngo -** Date: March 2013 -**================================================================================*/ - -/*--------------------------------------------------------------------------------* -** Includes -**--------------------------------------------------------------------------------*/ - -#include "ut_os_stubs.h" - -/*--------------------------------------------------------------------------------* -** Macros -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Data types -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** External global variables -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Global variables -**--------------------------------------------------------------------------------*/ - -UT_OsReturnCode_t g_osFsInit = {0,0}; -UT_OsReturnCode_t g_fileCreate = {0,0}; -UT_OsReturnCode_t g_fileOpen = {0,0}; -UT_OsReturnCode_t g_fileClose = {0,0}; -UT_OsReturnCode_t g_fileRead = {0,0}; -UT_OsReturnCode_t g_fileWrite = {0,0}; -UT_OsReturnCode_t g_fileChmod = {0,0}; -UT_OsReturnCode_t g_fileStat = {0,0}; -UT_OsReturnCode_t g_fileSeek = {0,0}; -UT_OsReturnCode_t g_fileRemove = {0,0}; -UT_OsReturnCode_t g_fileRename = {0,0}; -UT_OsReturnCode_t g_fileCopy = {0,0}; -UT_OsReturnCode_t g_fileMove = {0,0}; -UT_OsReturnCode_t g_fileOpenCheck = {0,0}; - -UT_OsReturnCode_t g_shellOutputToFile = {0,0}; -UT_OsReturnCode_t g_getFdInfo = {0,0}; -UT_OsReturnCode_t g_closeAllFiles = {0,0}; -UT_OsReturnCode_t g_closeFileByName = {0,0}; - -UT_OsReturnCode_t g_dirMake = {0,0}; -UT_OsReturnCode_t g_dirOpen = {0,0}; -UT_OsReturnCode_t g_dirClose = {0,0}; -UT_OsReturnCode_t g_dirRead = {0,0}; -UT_OsReturnCode_t g_dirRewind = {0,0}; -UT_OsReturnCode_t g_dirRemove = {0,0}; - -/*--------------------------------------------------------------------------------* -** Local function prototypes -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Function definitions -**--------------------------------------------------------------------------------*/ - -int32 OS_FS_Init(void) -{ - return (g_osFsInit.value); -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_creat(const char* path, int32 access) -{ - return (g_fileCreate.value); -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_open(const char* path, int32 access, uint32 mode) -{ - return (g_fileOpen.value); -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_close(int32 filedes) -{ - return (g_fileClose.value); -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_read(int32 filedes, void* buffer, uint32 nbytes) -{ - return (g_fileRead.value); -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_write(int32 filedes, void* buffer, uint32 nbytes) -{ - return (g_fileWrite.value); -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_chmod(const char* path, uint32 access) -{ - return (g_fileChmod.value); -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_stat(const char* path, os_fstat_t* filestats) -{ - return (g_fileStat.value); -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_lseek(int32 filedes, int32 offset, uint32 whence) -{ - return (g_fileSeek.value); -} -/*--------------------------------------------------------------------------------*/ - -int32 OS_remove(const char *path) -{ - return (g_fileRemove.value); -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_rename(const char* old, const char* new) -{ - return (g_fileRename.value); -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_cp(const char* src, const char* dest) -{ - return (g_fileCopy.value); -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_mv(const char* src, const char* dest) -{ - return (g_fileMove.value); -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_ShellOutputToFile(char* Cmd, int32 OS_fd) -{ - return (g_shellOutputToFile.value); -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_FileOpenCheck(char* filename) -{ - return (g_fileOpenCheck.value); -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_CloseFileByName(char* filename) -{ - return (g_closeFileByName.value); -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_CloseAllFiles(void) -{ - return (g_closeAllFiles.value); -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_mkdir(const char* path, uint32 access) -{ - return (g_dirMake.value); -} - -/*--------------------------------------------------------------------------------*/ - -os_dirp_t OS_opendir(const char* path) -{ - return ((os_dirp_t)g_dirOpen.value); -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_closedir(os_dirp_t directory) -{ - return (g_dirClose.value); -} - -/*--------------------------------------------------------------------------------*/ - -os_dirent_t* OS_readdir(os_dirp_t directory) -{ - return ((os_dirent_t*)g_dirRead.value); -} - -/*--------------------------------------------------------------------------------*/ - -void OS_rewinddir(os_dirp_t directory ) -{ -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_rmdir(const char* path) -{ - return (g_dirRemove.value); -} - -/*================================================================================* -** End of File: ut_osfile_stubs.c -**================================================================================*/ diff --git a/src/unit-tests/shared/ut_osfilesys_stubs.c b/src/unit-tests/shared/ut_osfilesys_stubs.c deleted file mode 100644 index 52eff002b..000000000 --- a/src/unit-tests/shared/ut_osfilesys_stubs.c +++ /dev/null @@ -1,113 +0,0 @@ -/*================================================================================* -** File: ut_osfilesys_stubs.c -** Owner: Tam Ngo -** Date: March 2013 -**================================================================================*/ - -/*--------------------------------------------------------------------------------* -** Includes -**--------------------------------------------------------------------------------*/ - -#include "ut_os_stubs.h" - -/*--------------------------------------------------------------------------------* -** Macros -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Data types -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** External global variables -**--------------------------------------------------------------------------------*/ - -/* As defined in osfilesys.c */ -extern OS_VolumeInfo_t OS_VolumeTable [NUM_TABLE_ENTRIES]; - -/*--------------------------------------------------------------------------------* -** Global variables -**--------------------------------------------------------------------------------*/ - -UT_OsReturnCode_t g_fsMake = {0,0}; -UT_OsReturnCode_t g_fsRemove = {0,0}; -UT_OsReturnCode_t g_fsInit = {0,0}; -UT_OsReturnCode_t g_fsMount = {0,0}; -UT_OsReturnCode_t g_fsUnmount = {0,0}; -UT_OsReturnCode_t g_fsBlocksFree = {0,0}; -UT_OsReturnCode_t g_fsBytesFree = {0,0}; -UT_OsReturnCode_t g_fsGetPhysDriveName = {0,0}; -UT_OsReturnCode_t g_fsTranslatePath = {0,0}; - -/*--------------------------------------------------------------------------------* -** Local function prototypes -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Function definitions -**--------------------------------------------------------------------------------*/ - -int32 OS_mkfs(char* address, char* devname,char* volname, uint32 blocksize, uint32 numblocks) -{ - return (g_fsMake.value); -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_rmfs(char* devname) -{ - return (g_fsRemove.value); -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_initfs(char* address,char* devname, char* volname, uint32 blocksize, uint32 numblocks) -{ - return (g_fsInit.value); -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_mount(const char* devname, char* mountpoint) -{ - return (g_fsMount.value); -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_unmount(const char* mountpoint) -{ - return (g_fsUnmount.value); -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_fsBlocksFree(const char* name) -{ - return (g_fsBlocksFree.value); -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_fsBytesFree(const char* name, uint64* bytes_free) -{ - return (g_fsBytesFree.value); -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_FS_GetPhysDriveName(char* PhysDriveName, char* MountPoint) -{ - return (g_fsGetPhysDriveName.value); -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_TranslatePath(const char* VirtualPath, char* LocalPath) -{ - return (g_fsTranslatePath.value); -} - -/*================================================================================* -** End of File: ut_osfilesys_stubs.c -**================================================================================*/ diff --git a/src/unit-tests/shared/ut_osnetwork_stubs.c b/src/unit-tests/shared/ut_osnetwork_stubs.c deleted file mode 100644 index eba8d27cd..000000000 --- a/src/unit-tests/shared/ut_osnetwork_stubs.c +++ /dev/null @@ -1,54 +0,0 @@ -/*================================================================================* -** File: ut_osnetwork_stubs.c -** Owner: Tam Ngo -** Date: March 2013 -**================================================================================*/ - -/*--------------------------------------------------------------------------------* -** Includes -**--------------------------------------------------------------------------------*/ - -#include "ut_os_stubs.h" - -/*--------------------------------------------------------------------------------* -** Macros -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Data types -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** External global variables -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Global variables -**--------------------------------------------------------------------------------*/ - -UT_OsReturnCode_t g_networkGetId = {0,0}; -UT_OsReturnCode_t g_networkGetName = {0,0}; - -/*--------------------------------------------------------------------------------* -** Local function prototypes -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Function definitions -**--------------------------------------------------------------------------------*/ - -int32 OS_NetworkGetID() -{ - return (g_networkGetId.value); -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_NetworkGetHostName(char* host_name, uint32 name_len) -{ - return (g_networkGetName.value); -} - -/*================================================================================* -** End of File: ut_osnetwork_stubs.c -**================================================================================*/ diff --git a/src/unit-tests/shared/ut_ostimer_stubs.c b/src/unit-tests/shared/ut_ostimer_stubs.c deleted file mode 100644 index 026cf6070..000000000 --- a/src/unit-tests/shared/ut_ostimer_stubs.c +++ /dev/null @@ -1,108 +0,0 @@ -/*================================================================================* -** File: ut_ostimer_stubs.c -** Owner: Tam Ngo -** Date: March 2013 -**================================================================================*/ - -/*--------------------------------------------------------------------------------* -** Includes -**--------------------------------------------------------------------------------*/ - -#include "ut_os_stubs.h" - -/*--------------------------------------------------------------------------------* -** Macros -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Data types -**--------------------------------------------------------------------------------*/ - -/* As defined in ostimer.c */ -typedef struct -{ - uint32 free; - char name[OS_MAX_API_NAME]; - uint32 creator; - uint32 start_time; - uint32 interval_time; - uint32 accuracy; - OS_TimerCallback_t callback_ptr; - uint32 host_timerid; -} OS_timer_record_t; - -/*--------------------------------------------------------------------------------* -** External global variables -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Global variables -**--------------------------------------------------------------------------------*/ - -UT_OsReturnCode_t g_timerInit = {0,0}; -UT_OsReturnCode_t g_timerCreate = {0,0}; -UT_OsReturnCode_t g_timerDelete = {0,0}; -UT_OsReturnCode_t g_timerSet = {0,0}; -UT_OsReturnCode_t g_timerGetId = {0,0}; -UT_OsReturnCode_t g_timerGetInfo = {0,0}; - -/* As defined in ostimer.c */ -OS_timer_record_t OS_timer_table[OS_MAX_TIMERS]; -uint32 os_clock_accuracy; - -#ifdef _LINUX_OS_ -pthread_mutex_t OS_timer_table_mut; -#endif - -/*--------------------------------------------------------------------------------* -** Local function prototypes -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Function definitions -**--------------------------------------------------------------------------------*/ - -int32 OS_TimerAPIInit(void) -{ - return (g_timerInit.value); -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_TimerCreate(uint32* timer_id, const char* timer_name, - uint32* clock_accuracy, OS_TimerCallback_t callback_ptr) -{ - return (g_timerCreate.value); -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_TimerDelete(uint32 timer_id) -{ - return (g_timerDelete.value); -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_TimerSet(uint32 timer_id, uint32 start_msec, uint32 interval_msec) -{ - return (g_timerSet.value); -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_TimerGetIdByName(uint32* timer_id, const char* timer_name) -{ - return (g_timerGetId.value); -} - -/*--------------------------------------------------------------------------------*/ - -int32 OS_TimerGetInfo(uint32 timer_id, OS_timer_prop_t* timer_prop) -{ - return (g_timerGetInfo.value); -} - -/*================================================================================* -** End of File: ut_ostimer_stubs.c -**================================================================================*/ diff --git a/src/unit-tests/shared/ut_psp_voltab_stubs.c b/src/unit-tests/shared/ut_psp_voltab_stubs.c deleted file mode 100644 index 012631f88..000000000 --- a/src/unit-tests/shared/ut_psp_voltab_stubs.c +++ /dev/null @@ -1,69 +0,0 @@ -/*================================================================================* -** File: ut_psp_voltab_stubs.c -** Owner: Tam Ngo -** Date: March 2013 -**================================================================================*/ - -/*--------------------------------------------------------------------------------* -** Includes -**--------------------------------------------------------------------------------*/ - -#include "ut_os_stubs.h" - -/*--------------------------------------------------------------------------------* -** Macros -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Data types -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** External global variables -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Global variables -**--------------------------------------------------------------------------------*/ - -/* -** OSAL volume table. This is the only file in the PSP that still has the -** OS_ naming convention, since it belongs to the OSAL. -*/ -OS_VolumeInfo_t OS_VolumeTable [NUM_TABLE_ENTRIES] = -{ -/* DevName PhysDev VolType Volatile? Free? IsMounted? VolName MountPnt BlockSz */ -{"/ramdev0", "./ram0", FS_BASED, true, true, false, " ", " ", 0 }, -{"/ramdev1", "./ram1", FS_BASED, true, true, false, " ", " ", 0 }, -{"/ramdev2", "./ram2", FS_BASED, true, true, false, " ", " ", 0 }, -{"/ramdev3", "./ram3", FS_BASED, true, true, false, " ", " ", 0 }, -{"/ramdev4", "./ram4", FS_BASED, true, true, false, " ", " ", 0 }, - -/* -** The following entry is a "pre-mounted" path to a non-volatile device -*/ -/* DevName PhysDev VolType Volatile? Free? IsMounted? VolName MountPnt BlockSz */ -{"/eedev0", "./eeprom1", FS_BASED, false, false, true, "CF", "/cf", 512 }, - -/* DevName PhysDev VolType Volatile? Free? IsMounted? VolName MountPnt BlockSz */ -{"/ramdev5", "./ram5", FS_BASED, true, true, false, " ", " ", 0 }, -{"/ramdev6", "./ram6", FS_BASED, true, true, false, " ", " ", 0 }, -{"/ramdev7", "./ram7", FS_BASED, true, true, false, " ", " ", 0 }, -{"/ramdev8", "./ram8", FS_BASED, true, true, false, " ", " ", 0 }, -{"/ramdev9", "./ram9", FS_BASED, true, true, false, " ", " ", 0 }, -{"/ramdev10", "./ram10", FS_BASED, true, true, false, " ", " ", 0 }, -{"/ramdev11", "./ram11", FS_BASED, true, true, false, " ", " ", 0 }, -{"/ramdev12", "./ram12", FS_BASED, true, true, false, " ", " ", 0 } -}; - -/*--------------------------------------------------------------------------------* -** Local function prototypes -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Function definitions -**--------------------------------------------------------------------------------*/ - -/*================================================================================* -** End of File: ut_psp_voltab_stubs.c -**================================================================================*/ diff --git a/src/unit-tests/shared/ut_psp_voltab_stubs_arinc653.c b/src/unit-tests/shared/ut_psp_voltab_stubs_arinc653.c deleted file mode 100644 index 3bb1bde39..000000000 --- a/src/unit-tests/shared/ut_psp_voltab_stubs_arinc653.c +++ /dev/null @@ -1,62 +0,0 @@ -/*================================================================================* -** File: ut_psp_voltab_stubs.c -** Owner: Tam Ngo -** Date: March 2013 -**================================================================================*/ - -/*--------------------------------------------------------------------------------* -** Includes -**--------------------------------------------------------------------------------*/ - -#include "ut_os_stubs.h" - -/*--------------------------------------------------------------------------------* -** Macros -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Data types -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** External global variables -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Global variables -**--------------------------------------------------------------------------------*/ - -/* -** OSAL volume table. This is the only file in the PSP that still has the -** OS_ naming convention, since it belongs to the OSAL. -*/ -OS_VolumeInfo_t OS_VolumeTable [NUM_TABLE_ENTRIES] = -{ -/* DevName PhysDev VolType Volatile? Free? IsMounted? VolName MountPnt BlockSz */ -{"/ramdev0", "/ram0", RAM_DISK, true, true, false, " ", " ", 0 }, -{"/ramdev1", "/ram1", RAM_DISK, true, true, false, " ", " ", 0 }, -{"/ramdev2", "/ram2", RAM_DISK, true, true, false, " ", " ", 0 }, -{"/ramdev3", "/ram3", RAM_DISK, true, true, false, " ", " ", 0 }, -{"/ramdev4", "/ram4", RAM_DISK, true, true, false, " ", " ", 0 }, -{"/ramdev5", "/ram5", RAM_DISK, true, true, false, " ", " ", 0 }, -{"/ramdev6", "/ram6", RAM_DISK, true, true, false, " ", " ", 0 }, -{"/ramdev7", "/ram7", RAM_DISK, true, true, false, " ", " ", 0 }, -{"/ramdev8", "/ram8", RAM_DISK, true, true, false, " ", " ", 0 }, -{"/ramdev9", "/ram9", RAM_DISK, true, true, false, " ", " ", 0 }, -{"/ramdev10", "/ram10", RAM_DISK, true, true, false, " ", " ", 0 }, -{"/ramdev11", "/ram11", RAM_DISK, true, true, false, " ", " ", 0 }, -{"/ramdev12", "/ram12", RAM_DISK, true, true, false, " ", " ", 0 }, -{"/ramdev13", "/ram13", RAM_DISK, true, true, false, " ", " ", 0 } -}; - -/*--------------------------------------------------------------------------------* -** Local function prototypes -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Function definitions -**--------------------------------------------------------------------------------*/ - -/*================================================================================* -** End of File: ut_psp_voltab_stubs.c -**================================================================================*/ diff --git a/src/unit-tests/shared/ut_psp_voltab_stubs_vxworks.c b/src/unit-tests/shared/ut_psp_voltab_stubs_vxworks.c deleted file mode 100644 index d3b67177c..000000000 --- a/src/unit-tests/shared/ut_psp_voltab_stubs_vxworks.c +++ /dev/null @@ -1,68 +0,0 @@ -/*================================================================================* -** File: ut_psp_voltab_stubs.c -** Owner: Tam Ngo -** Date: March 2013 -**================================================================================*/ - -/*--------------------------------------------------------------------------------* -** Includes -**--------------------------------------------------------------------------------*/ - -#include "ut_os_stubs.h" - -/*--------------------------------------------------------------------------------* -** Macros -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Data types -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** External global variables -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Global variables -**--------------------------------------------------------------------------------*/ - -/* -** OSAL volume table. This is the only file in the PSP that still has the -** OS_ naming convention, since it belongs to the OSAL. -*/ -OS_VolumeInfo_t OS_VolumeTable [NUM_TABLE_ENTRIES] = -{ -/* DevName PhysDev VolType Volatile? Free? IsMounted? VolName MountPnt BlockSz */ -{"/ramdev0", "/ram0", RAM_DISK, true, true, false, " ", " ", 0 }, -{"/ramdev1", "/ram1", RAM_DISK, true, true, false, " ", " ", 0 }, -{"/ramdev2", "/ram2", RAM_DISK, true, true, false, " ", " ", 0 }, -{"/ramdev3", "/ram3", RAM_DISK, true, true, false, " ", " ", 0 }, -{"/ramdev4", "/ram4", RAM_DISK, true, true, false, " ", " ", 0 }, -{"/ramdev5", "/ram5", RAM_DISK, true, true, false, " ", " ", 0 }, -{"/ramdev6", "/ram6", RAM_DISK, true, true, false, " ", " ", 0 }, -{"/ramdev7", "/ram7", RAM_DISK, true, true, false, " ", " ", 0 }, -{"/ramdev8", "/ram8", RAM_DISK, true, true, false, " ", " ", 0 }, -{"/ramdev9", "/ram9", RAM_DISK, true, true, false, " ", " ", 0 }, -{"/ramdev10", "/ram10", RAM_DISK, true, true, false, " ", " ", 0 }, -{"/ramdev11", "/ram11", RAM_DISK, true, true, false, " ", " ", 0 }, -{"/ramdev12", "/ram12", RAM_DISK, true, true, false, " ", " ", 0 }, -#if defined(UT_OS_USE_RAM) -{"/cf", "/ram0/cf", FS_BASED, false, false, true, "CF", "/cf", 1024 } -#elif defined(UT_OS_USE_ATA) -{"/cf", "/ata0a/cf", FS_BASED, false, false, true, "CF", "/cf", 1024 } -#else -{"/ramdev13", "/ram13", RAM_DISK, true, true, false, " ", " ", 0 }, -#endif -}; - -/*--------------------------------------------------------------------------------* -** Local function prototypes -**--------------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------------* -** Function definitions -**--------------------------------------------------------------------------------*/ - -/*================================================================================* -** End of File: ut_psp_voltab_stubs.c -**================================================================================*/