diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..cff0ba693 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,30 @@ +dist: bionic +sudo: required +language: + - c +compiler: + - gcc +addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - cmake + +before_install: + - sudo apt-get install cppcheck + +script: + # Check versions + - cppcheck --version + + #cppcheck flight software osal/src/bsp, osal/src/os + - cppcheck --force --inline-suppr --std=c99 --language=c --error-exitcode=1 --enable=warning,performance,portability,style --suppress=variableScope --inconclusive src/bsp src/os 2>cppcheck_flight_osal.txt + - | + if [[ -s cppcheck_flight_osal.txt ]]; then + echo "You must fix cppcheck errors before submitting a pull request" + echo "" + cat cppcheck_flight_osal.txt + exit -1 + fi + diff --git a/src/bsp/mcf5235-rtems/config/osconfig.h b/src/bsp/mcf5235-rtems/config/osconfig.h deleted file mode 100644 index 5e3f207a8..000000000 --- a/src/bsp/mcf5235-rtems/config/osconfig.h +++ /dev/null @@ -1,136 +0,0 @@ -/****************************************************************************** -** File: osconfig.h -** -** Purpose: -** This header file contains the OS API configuration parameters. -** -** Author: A. Cudmore -** -** Notes: -** -******************************************************************************/ - -#ifndef _osconfig_ -#define _osconfig_ - -/* -** Platform Configuration Parameters for the OS API -*/ - -#define OS_MAX_TASKS 64 -#define OS_MAX_QUEUES 64 -#define OS_MAX_COUNT_SEMAPHORES 20 -#define OS_MAX_BIN_SEMAPHORES 20 -#define OS_MAX_MUTEXES 20 - -/* -** Maximum length for an absolute path name -*/ -#define OS_MAX_PATH_LEN 64 - -/* -** Maximum length for a local or host path/filename. -** This parameter can consist of the OSAL filename/path + -** the host OS physical volume name or path. -*/ -#define OS_MAX_LOCAL_PATH_LEN (OS_MAX_PATH_LEN + OS_FS_PHYS_NAME_LEN) - -/* -** The maxium length allowed for a object (task,queue....) name -*/ -#define OS_MAX_API_NAME 20 - -/* -** The maximum length for a file name -*/ -#define OS_MAX_FILE_NAME 20 - -/* -** These defines are for OS_printf -*/ -#define OS_BUFFER_SIZE 172 -#define OS_BUFFER_MSG_DEPTH 100 - -/* This #define turns on a utility task that - * will read the statements to print from - * the OS_printf function. If you want OS_printf - * to print the text out itself, comment this out - * - * NOTE: The Utility Task #defines only have meaning - * on the VxWorks operating systems - */ - -#define OS_UTILITY_TASK_ON - - -#ifdef OS_UTILITY_TASK_ON - #define OS_UTILITYTASK_STACK_SIZE 2048 - /* some room is left for other lower priority tasks */ - #define OS_UTILITYTASK_PRIORITY 245 -#endif - - -/* -** the size of a command that can be passed to the underlying OS -*/ -#define OS_MAX_CMD_LEN 1000 - -/* -** This define will include the OS network API. -** It should be turned off for targtets that do not have a network stack or -** device ( like the basic RAD750 vxWorks BSP ) -*/ -#undef OS_INCLUDE_NETWORK - -/* -** This is the maximum number of open file descriptors allowed at a time -*/ -#define OS_MAX_NUM_OPEN_FILES 50 - -/* -** This defines the filethe input command of OS_ShellOutputToFile -** is written to in the VxWorks6 port -*/ -#define OS_SHELL_CMD_INPUT_FILE_NAME "/ram/OS_ShellCmd.in" - -/* -** This define sets the queue implentation of the Linux port to use sockets -** commenting this out makes the Linux port use the POSIX message queues. -*/ -/* #define OSAL_SOCKET_QUEUE */ - -/* -** Module loader/symbol table is optional -*/ -#undef OS_INCLUDE_MODULE_LOADER - -#ifdef OS_INCLUDE_MODULE_LOADER - /* - ** This define sets the size of the OS Module Table, which keeps track of the loaded modules in - ** the running system. This define must be set high enough to support the maximum number of - ** loadable modules in the system. If the the table is filled up at runtime, a new module load - ** would fail. - */ - #define OS_MAX_MODULES 10 - - /* - ** The Static Loader define is used for switching between the Dynamic and Static loader implementations. - */ - /* #define OS_STATIC_LOADER */ - -#endif - - -/* -** This define sets the maximum symbol name string length. It is used in implementations that -** support the symbols and symbol lookup. -*/ -#define OS_MAX_SYM_LEN 64 - - -/* -** This define sets the maximum number of timers available -*/ -#define OS_MAX_TIMERS 5 - -#endif diff --git a/src/bsp/mcf5235-rtems/make/compiler-opts.mak b/src/bsp/mcf5235-rtems/make/compiler-opts.mak deleted file mode 100644 index f186d4bc6..000000000 --- a/src/bsp/mcf5235-rtems/make/compiler-opts.mak +++ /dev/null @@ -1,79 +0,0 @@ -############################################################################### -## compiler-opts.mak - compiler definitions and options for building the OSAL -## -## Target: m5235BCC Coldfire board with RTEMS and CEXP dynamic loader -## -## Modifications: -## -############################################################################### -## -## Warning Level Configuration -## -## WARNINGS=-Wall -ansi -pedantic -Wstrict-prototypes -WARNINGS = -Wall - -SYSINCS = - -## -## Target Defines for the OS, Hardware Arch, etc.. -## -TARGET_DEFS = -D_RTEMS_OS_ -D_m68k_ -D$(OS) -DM5235BCC -D_EMBED_ - -## -## Endian Defines -## -ENDIAN_DEFS=-D_EB -DENDIAN=_EB -DSOFTWARE_BIG_BIT_ORDER - -## -## Compiler Architecture Switches ( double check arch switch -m52xx, m523x etc.. ) -## -ARCH_OPTS = --pipe -fomit-frame-pointer -m528x -B$(RTEMS_BSP_BASE)/m68k-rtems4.10/mcf5235/lib/ -specs bsp_specs -qrtems - -APP_COPTS = -APP_ASOPTS = - -## -## Extra Cflags for Assembly listings, etc. -## -LIST_OPTS = -Wa,-a=$*.lis - -## -## gcc options for dependancy generation -## -COPTS_D = $(APP_COPTS) $(ENDIAN_DEFS) $(TARGET_DEFS) $(ARCH_OPTS) $(SYSINCS) $(WARNINGS) - -## -## General gcc options that apply to compiling and dependency generation. -## -COPTS=$(LIST_OPTS) $(COPTS_D) - -## -## Extra defines and switches for assembly code -## -ASOPTS = $(APP_ASOPTS) -P -xassembler-with-cpp - -##--------------------------------------------------------- -## Application file extention type -## This is the defined application extention. -## Known extentions: Mac OS X: .bundle, Linux: .so, RTEMS: -## .s3r, vxWorks: .o etc.. -##--------------------------------------------------------- -APP_EXT = nxe - -#################################################### -## Host Development System and Toolchain defintions -## -## Host OS utils -## -RM=rm -f -CP=cp - -## -## Compiler tools -## -COMPILER = m68k-rtems4.10-gcc -ASSEMBLER = m68k-rtems4.10-gcc -LINKER = m68k-rtems4.10-ld -AR = m68k-rtems4.10-ar -NM = m68k-rtems4.10-nm -OBJCPY = m68k-rtems4.10-objcopy diff --git a/src/bsp/mcf5235-rtems/make/link-rules.mak b/src/bsp/mcf5235-rtems/make/link-rules.mak deleted file mode 100644 index 95e6c6853..000000000 --- a/src/bsp/mcf5235-rtems/make/link-rules.mak +++ /dev/null @@ -1,33 +0,0 @@ -############################################################################### -# File: link-rules.mak -# -# Purpose: -# Makefile for linking code and producing the OSAL Core executable image. -# -# History: -# -############################################################################### - -CORE_INSTALL_FILES = $(EXE_TARGET) - -## -## Linker flags that are needed -## -LDFLAGS = - -## -## Libraries to link in -## -LIBS = - - -## -## Application Link Rule -## -$(APPTARGET).$(APP_EXT): $(OBJS) - $(COMPILER) --pipe -B$(RTEMS_BSP_BASE)/m68k-rtems4.10/mcf5235/lib/ -specs bsp_specs -qrtems \ - -g -Wall -O2 -g -fomit-frame-pointer -g -m528x \ - -o $(APPTARGET).$(APP_EXT) \ - $(OBJS) $(CORE_OBJS) - $(OBJCPY) -O binary --strip-all $(APPTARGET).$(APP_EXT) $(APPTARGET).exe - diff --git a/src/bsp/mcf5235-rtems/src/bsp.mak b/src/bsp/mcf5235-rtems/src/bsp.mak deleted file mode 100644 index 5cca973cc..000000000 --- a/src/bsp/mcf5235-rtems/src/bsp.mak +++ /dev/null @@ -1,20 +0,0 @@ -############################################################################### -# File: bsp.mak -# -# Purpose: -# Compile Board Support Package routines -# History: -# -############################################################################### - -# Subsystem produced by this makefile. -TARGET = bsp.o - -#============================================================================== -# Object files required to build subsystem. -OBJS = bsp_start.o bsp_voltab.o bsp_loader.o - -#============================================================================== -# Source files required to build subsystem; used to generate dependencies. -SOURCES = bsp_start.c bsp_voltab.c bsp_loader.c - diff --git a/src/bsp/mcf5235-rtems/src/bsp_loader.c b/src/bsp/mcf5235-rtems/src/bsp_loader.c deleted file mode 100644 index 74ae79e22..000000000 --- a/src/bsp/mcf5235-rtems/src/bsp_loader.c +++ /dev/null @@ -1,28 +0,0 @@ -/****************************************************************************** -** File: bsp_loader.c -** -** -** This is governed by the NASA Open Source Agreement and may be used, -** distributed and modified only pursuant to the terms of that agreement. -** -** Copyright (c) 2004-2006, United States government as represented by the -** administrator of the National Aeronautics Space Administration. -** All rights reserved. -** -** -** Purpose: -** Include the Static loader. This is not part of the OSAL, so it cannot be -** included in the source. This file allows the static loader to be included -** if it's available. If not, simply undef the OS_STATIC_LOADER define -** in osconfig.h -** -** History: -** -******************************************************************************/ -#include "osapi.h" - -#ifdef OS_STATIC_LOADER - #include "LzmaDec.c" - #include "loadstaticloadfile.c" -#endif - diff --git a/src/bsp/mcf5235-rtems/src/bsp_start.c b/src/bsp/mcf5235-rtems/src/bsp_start.c deleted file mode 100644 index 4f2e82652..000000000 --- a/src/bsp/mcf5235-rtems/src/bsp_start.c +++ /dev/null @@ -1,194 +0,0 @@ -/****************************************************************************** -** File: os_bspstart.c -** -** -** This is governed by the NASA Open Source Agreement and may be used, -** distributed and modified only pursuant to the terms of that agreement. -** -** Copyright (c) 2004-2006, United States government as represented by the -** administrator of the National Aeronautics Space Administration. -** All rights reserved. -** -** -** Purpose: -** OSAL BSP main entry point. -** -** History: -** 2004/09/23 J.P. Swinski | Initial version, -** 2004/10/01 P.Kutt | Replaced OS API task delay with VxWorks functions -** since OS API is initialized later. -** -******************************************************************************/ - -#define _USING_RTEMS_INCLUDES_ - -/* -** Include Files -*/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* -** OSAL includes -*/ -#include "common_types.h" -#include "osapi.h" - -/* -** Defines -*/ -#define RTEMS_DRIVER_AUTO_MAJOR (0) -#define RTEMS_NUMBER_OF_RAMDISKS 1 - - -/* -** External Declarations -*/ -void OS_Application_Startup(void); - -/* -** Global data -*/ - -/* - * The RAM Disk configuration. - */ -rtems_ramdisk_config rtems_ramdisk_configuration[RTEMS_NUMBER_OF_RAMDISKS]; - -/* - * The number of RAM Disk configurations. -*/ -size_t rtems_ramdisk_configuration_size = RTEMS_NUMBER_OF_RAMDISKS; - -/* -** RAM Disk IO op table. -*/ -rtems_driver_address_table rtems_ramdisk_io_ops = -{ - initialization_entry: ramdisk_initialize, - open_entry: rtems_blkdev_generic_open, - close_entry: rtems_blkdev_generic_close, - read_entry: rtems_blkdev_generic_read, - write_entry: rtems_blkdev_generic_write, - control_entry: rtems_blkdev_generic_ioctl -}; - -/****************************************************************************** -** Function: OS_BSPMain() -** -** Purpose: -** vxWorks/BSP Application entry point. -** -** Arguments: -** (none) -** -** Return: -** (none) -*/ - -void OS_BSPMain( void ) -{ - - /* - ** Call OSAL entry point. - */ - OS_Application_Startup(); - - /* - ** Just sleep while OSAL code runs - */ - for ( ;; ) - sleep(1); - -} - -rtems_task Init( - rtems_task_argument ignored -) -{ - int status; - int mode; - - printf("\n\n"); - printf( "\n\n*** RTEMS Info ***\n" ); - printf("%s", _Copyright_Notice ); - printf("%s\n\n", _RTEMS_version ); - printf(" Workspace base %08X\n", (unsigned int)Configuration.work_space_start ); - printf(" Workspace size %d\n", (int) Configuration.work_space_size ); - printf(" Workspace top %08X\n", (unsigned int)(Configuration.work_space_start - + Configuration.work_space_size) ); - printf("\n"); - printf( "*** End RTEMS info ***\n\n" ); - - /* - ** Create the RTEMS Root file system - */ - printf("Creating Root file system\n"); - status = rtems_create_root_fs(); - - - /* - ** create the directory mountpoints - */ - mode = S_IFDIR |S_IRWXU | S_IRWXG | S_IRWXO; - status = mkdir("/drive0", mode); - status = mkdir("/drive1", mode); - status = mkdir("/ram", mode); /* For symtest mountpoint */ - - - /* - ** Call OSAL entry point - */ - OS_BSPMain(); - - printf( "*** END OF OSAL TEST ***\n" ); - - exit( 0 ); -} - -/* configuration information */ - -/* -** RTEMS OS Configuration defintions -*/ -#define TASK_INTLEVEL 0 -#define CONFIGURE_INIT -#define CONFIGURE_INIT_TASK_ATTRIBUTES (RTEMS_FLOATING_POINT | RTEMS_PREEMPT | RTEMS_NO_TIMESLICE | RTEMS_ASR | RTEMS_INTERRUPT_LEVEL(TASK_INTLEVEL)) -#define CONFIGURE_INIT_TASK_STACK_SIZE (20*1024) -#define CONFIGURE_INIT_TASK_PRIORITY 120 - -#define CONFIGURE_MAXIMUM_TASKS 64 -#define CONFIGURE_MAXIMUM_TIMERS 10 -#define CONFIGURE_MAXIMUM_SEMAPHORES 64 -#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 64 - -#define CONFIGURE_EXECUTIVE_RAM_SIZE (1024*1024) - -#define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER -#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER - -#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM -#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 100 - -#define CONFIGURE_FILESYSTEM_RFS -#define CONFIGURE_FILESYSTEM_IMFS - -#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK - -#define CONFIGURE_MICROSECONDS_PER_TICK 10000 - -#define CONFIGURE_MAXIMUM_DRIVERS 10 - -#include - - diff --git a/src/bsp/mcf5235-rtems/src/bsp_voltab.c b/src/bsp/mcf5235-rtems/src/bsp_voltab.c deleted file mode 100644 index fff98276f..000000000 --- a/src/bsp/mcf5235-rtems/src/bsp_voltab.c +++ /dev/null @@ -1,63 +0,0 @@ -/* -** File : bsp_voltab.c -** Author : Nicholas Yanchik / GSFC Code 582 -** -** This is governed by the NASA Open Source Agreement and may be used, -** distributed and modified only pursuant to the terms of that agreement. -** -** Copyright (c) 2004-2006, United States government as represented by the -** administrator of the National Aeronautics Space Administration. -** All rights reserved. -** -** -** BSP Volume table for file systems -*/ - -/**************************************************************************************** - INCLUDE FILES -****************************************************************************************/ -#include "common_types.h" -#include "osapi.h" - - -/* -** OSAL Disk volume table. -** Note for RTEMS, there is only one RAM_DISK device supported right now. -** This is due to the static configuration of the driver structures ( see bsp_start.c ) -*/ -OS_VolumeInfo_t OS_VolumeTable [NUM_TABLE_ENTRIES] = -{ -/* Dev Name Phys Dev Vol Type Volatile? Free? IsMounted? Volname MountPt BlockSz */ - -/* RAM Disk */ -{"/ramdev0", "/dev/rda", RAM_DISK, true, true, false, " ", " ", 0 }, - - -/* non-volatile Disk -- Auto-Mapped to an existing CF disk */ -{"/eedev0", "/", FS_BASED, false, false, true, "CF", "/", 512 }, - -/* -** Spare RAM disks to be used for SSR and other RAM disks -*/ -{"/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 }, -{"/ramdev5", "/ram5", FS_BASED, true, true, false, " ", " ", 0 }, - -/* -** Hard disk mappings -*/ -{"/ssrdev0", "/hd:0/SSR1", FS_BASED, true, true, false, " ", " ", 0 }, -{"/ssrdev1", "/hd:0/SSR2", FS_BASED, true, true, false, " ", " ", 0 }, -{"/ssrdev2", "/hd:0/SSR3", FS_BASED, true, true, false, " ", " ", 0 }, - -{"unused", "unused", FS_BASED, true, true, false, " ", " ", 0 }, -{"unused", "unused", FS_BASED, true, true, false, " ", " ", 0 }, -{"unused", "unused", FS_BASED, true, true, false, " ", " ", 0 }, -{"unused", "unused", FS_BASED, true, true, false, " ", " ", 0 } - -}; - - - diff --git a/src/bsp/mcf5235-rtems/src/rtems-support/debug.sh b/src/bsp/mcf5235-rtems/src/rtems-support/debug.sh deleted file mode 100644 index a0819c0f7..000000000 --- a/src/bsp/mcf5235-rtems/src/rtems-support/debug.sh +++ /dev/null @@ -1 +0,0 @@ -sudo /opt/rtems-4.10/bin/m68k-rtems4.10-gdb --command=gdb-init test1.nxe diff --git a/src/bsp/mcf5235-rtems/src/rtems-support/gdb-init b/src/bsp/mcf5235-rtems/src/rtems-support/gdb-init deleted file mode 100644 index 5c8d427d3..000000000 --- a/src/bsp/mcf5235-rtems/src/rtems-support/gdb-init +++ /dev/null @@ -1,54 +0,0 @@ -# -# Connect to the target. -# -target remote | m68k-bdm-gdbserver pipe /dev/bdmcf0 - -# -# The console loop in the Axman dbug monitor. Found by trial and error -# with the debugger. -# -hb *0xffe254c0 - -# -# Show the exception stack frame. -# -define show-exception-sframe - set $frsr = *(unsigned short *)((unsigned long)$sp + 2) - set $frpc = *(unsigned long *)((unsigned long)$sp + 4) - set $frfvo = *(unsigned short *)((unsigned long)$sp + 0) - set $frcode = $frfvo >> 12 - set $frvect = ($frfvo & 0xFFF) >> 2 - set $frstatus = ((($frfvo >> 10) & 3) << 2) | ($frfvo & 3) - printf "EXCEPTION -- SR:0x%X PC:0x%X FRAME:0x%x VECTOR:%d STATUS:%d\n", $frsr, $frpc, $frcode, $frvect, $frstatus - if $frstatus == 4 - printf " Fault Type: Error on instruction fetch" - end - if $frstatus == 8 - printf " Fault Type: Error on operand write" - end - if $frstatus == 12 - printf " Fault Type: Error on operand read" - end - if $frstatus == 9 - printf " Fault Type: Attempted write to write-protected space" - end -end - -# -# Run to initialise the RAM. The target will stop when the -# breakpoint is hit. Load the program. -# -c -load - -# -# Break on an exception. -# -b _uhoh - -# -# Travel to main then stop. -# -tb Init -c - diff --git a/src/bsp/mcf5235-rtems/src/rtems-support/write-flash.sh b/src/bsp/mcf5235-rtems/src/rtems-support/write-flash.sh deleted file mode 100644 index e24453f4f..000000000 --- a/src/bsp/mcf5235-rtems/src/rtems-support/write-flash.sh +++ /dev/null @@ -1 +0,0 @@ -sudo bdmflash /dev/bdmcf0 0xffe00000 1 2 write o-optimize/osal.exe 0x0 diff --git a/src/bsp/genppc-vxworks6.4/config/osconfig.h b/src/bsp/mcp750-vxworks/config/osconfig.h similarity index 100% rename from src/bsp/genppc-vxworks6.4/config/osconfig.h rename to src/bsp/mcp750-vxworks/config/osconfig.h diff --git a/src/bsp/genppc-vxworks6.4/make/compiler-opts.mak b/src/bsp/mcp750-vxworks/make/compiler-opts.mak similarity index 100% rename from src/bsp/genppc-vxworks6.4/make/compiler-opts.mak rename to src/bsp/mcp750-vxworks/make/compiler-opts.mak diff --git a/src/bsp/genppc-vxworks6.4/make/link-rules.mak b/src/bsp/mcp750-vxworks/make/link-rules.mak similarity index 100% rename from src/bsp/genppc-vxworks6.4/make/link-rules.mak rename to src/bsp/mcp750-vxworks/make/link-rules.mak diff --git a/src/bsp/genppc-vxworks6.4/src/bsp.mak b/src/bsp/mcp750-vxworks/src/bsp.mak similarity index 100% rename from src/bsp/genppc-vxworks6.4/src/bsp.mak rename to src/bsp/mcp750-vxworks/src/bsp.mak diff --git a/src/bsp/genppc-vxworks6.4/src/bsp_start.c b/src/bsp/mcp750-vxworks/src/bsp_start.c similarity index 100% rename from src/bsp/genppc-vxworks6.4/src/bsp_start.c rename to src/bsp/mcp750-vxworks/src/bsp_start.c diff --git a/src/bsp/genppc-vxworks6.4/src/bsp_voltab.c b/src/bsp/mcp750-vxworks/src/bsp_voltab.c similarity index 100% rename from src/bsp/genppc-vxworks6.4/src/bsp_voltab.c rename to src/bsp/mcp750-vxworks/src/bsp_voltab.c diff --git a/src/bsp/genppc-vxworks6.4/ut-src/bsp_ut.c b/src/bsp/mcp750-vxworks/ut-src/bsp_ut.c similarity index 100% rename from src/bsp/genppc-vxworks6.4/ut-src/bsp_ut.c rename to src/bsp/mcp750-vxworks/ut-src/bsp_ut.c diff --git a/src/bsp/genppc-vxworks6.4/ut-src/bsp_ut_voltab.c b/src/bsp/mcp750-vxworks/ut-src/bsp_ut_voltab.c similarity index 100% rename from src/bsp/genppc-vxworks6.4/ut-src/bsp_ut_voltab.c rename to src/bsp/mcp750-vxworks/ut-src/bsp_ut_voltab.c diff --git a/src/bsp/sis-rtems/config/osconfig.h b/src/bsp/sis-rtems/config/osconfig.h deleted file mode 100644 index ab71409d4..000000000 --- a/src/bsp/sis-rtems/config/osconfig.h +++ /dev/null @@ -1,137 +0,0 @@ -/****************************************************************************** -** File: osconfig.h -** -** Purpose: -** This header file contains the OS API configuration parameters. -** -** Author: A. Cudmore -** -** Notes: -** -******************************************************************************/ - -#ifndef _osconfig_ -#define _osconfig_ - -/* -** Platform Configuration Parameters for the OS API -*/ - -#define OS_MAX_TASKS 64 -#define OS_MAX_QUEUES 64 -#define OS_MAX_COUNT_SEMAPHORES 20 -#define OS_MAX_BIN_SEMAPHORES 20 -#define OS_MAX_MUTEXES 20 - -/* -** Maximum length for an absolute path name -*/ -#define OS_MAX_PATH_LEN 64 - -/* -** Maximum length for a local or host path/filename. -** This parameter can consist of the OSAL filename/path + -** the host OS physical volume name or path. -*/ -#define OS_MAX_LOCAL_PATH_LEN (OS_MAX_PATH_LEN + OS_FS_PHYS_NAME_LEN) - - -/* -** The maxium length allowed for a object (task,queue....) name -*/ -#define OS_MAX_API_NAME 20 - -/* -** The maximum length for a file name -*/ -#define OS_MAX_FILE_NAME 20 - -/* -** These defines are for OS_printf -*/ -#define OS_BUFFER_SIZE 172 -#define OS_BUFFER_MSG_DEPTH 100 - -/* This #define turns on a utility task that - * will read the statements to print from - * the OS_printf function. If you want OS_printf - * to print the text out itself, comment this out - * - * NOTE: The Utility Task #defines only have meaning - * on the VxWorks operating systems - */ - -#define OS_UTILITY_TASK_ON - - -#ifdef OS_UTILITY_TASK_ON - #define OS_UTILITYTASK_STACK_SIZE 2048 - /* some room is left for other lower priority tasks */ - #define OS_UTILITYTASK_PRIORITY 245 -#endif - - -/* -** the size of a command that can be passed to the underlying OS -*/ -#define OS_MAX_CMD_LEN 1000 - -/* -** This define will include the OS network API. -** It should be turned off for targtets that do not have a network stack or -** device ( like the basic RAD750 vxWorks BSP ) -*/ -#undef OS_INCLUDE_NETWORK - -/* -** This is the maximum number of open file descriptors allowed at a time -*/ -#define OS_MAX_NUM_OPEN_FILES 50 - -/* -** This defines the filethe input command of OS_ShellOutputToFile -** is written to in the VxWorks6 port -*/ -#define OS_SHELL_CMD_INPUT_FILE_NAME "/ram/OS_ShellCmd.in" - -/* -** This define sets the queue implentation of the Linux port to use sockets -** commenting this out makes the Linux port use the POSIX message queues. -*/ -/* #define OSAL_SOCKET_QUEUE */ - -/* -** Module loader/symbol table is optional -*/ -#undef OS_INCLUDE_MODULE_LOADER - -#ifdef OS_INCLUDE_MODULE_LOADER - /* - ** This define sets the size of the OS Module Table, which keeps track of the loaded modules in - ** the running system. This define must be set high enough to support the maximum number of - ** loadable modules in the system. If the the table is filled up at runtime, a new module load - ** would fail. - */ - #define OS_MAX_MODULES 10 - - /* - ** The Static Loader define is used for switching between the Dynamic and Static loader implementations. - */ - /* #define OS_STATIC_LOADER */ - -#endif - - -/* -** This define sets the maximum symbol name string length. It is used in implementations that -** support the symbols and symbol lookup. -*/ -#define OS_MAX_SYM_LEN 64 - - -/* -** This define sets the maximum number of timers available -*/ -#define OS_MAX_TIMERS 5 - -#endif diff --git a/src/bsp/sis-rtems/make/compiler-opts.mak b/src/bsp/sis-rtems/make/compiler-opts.mak deleted file mode 100644 index e0e4b313c..000000000 --- a/src/bsp/sis-rtems/make/compiler-opts.mak +++ /dev/null @@ -1,87 +0,0 @@ -############################################################################### -## compiler-opts.mak - compiler definitions and options for building the OSAL -## -## Target: m5235BCC Coldfire board with RTEMS and CEXP dynamic loader -## -## Modifications: -## -############################################################################### -## -## Warning Level Configuration -## -## WARNINGS=-Wall -ansi -pedantic -Wstrict-prototypes -WARNINGS = -Wall - -SYSINCS = - -## -## Target Defines for the OS, Hardware Arch, etc.. -## -TARGET_DEFS = -D_RTEMS_OS_ -D__SPARC__ -D$(OS) -DSPARC_SIS -D_EMBED_ - -## -## Endian Defines -## -ENDIAN_DEFS=-D_EB -DENDIAN=_EB -DSOFTWARE_BIG_BIT_ORDER - -## -## Compiler Architecture Switches ( double check arch switch -m52xx, m523x etc.. ) -## -ARCH_OPTS = --pipe -mcpu=cypress -B$(RTEMS_BSP_BASE)/sparc-rtems4.10/sis/lib/ -specs bsp_specs -qrtems - -## -## Application specific compiler switches -## -ifeq ($(BUILD_TYPE),CFE_APP) - APP_COPTS = - APP_ASOPTS = -else - APP_COPTS = - APP_ASOPTS = -endif - -## -## Extra Cflags for Assembly listings, etc. -## -LIST_OPTS = -Wa,-a=$*.lis - -## -## gcc options for dependancy generation -## -COPTS_D = $(APP_COPTS) $(ENDIAN_DEFS) $(TARGET_DEFS) $(ARCH_OPTS) $(SYSINCS) $(WARNINGS) - -## -## General gcc options that apply to compiling and dependency generation. -## -COPTS=$(LIST_OPTS) $(COPTS_D) - -## -## Extra defines and switches for assembly code -## -ASOPTS = $(APP_ASOPTS) -P -xassembler-with-cpp - -##--------------------------------------------------------- -## Application file extention type -## This is the defined application extention. -## Known extentions: Mac OS X: .bundle, Linux: .so, RTEMS: -## .s3r, vxWorks: .o etc.. -##--------------------------------------------------------- -APP_EXT = nxe - -#################################################### -## Host Development System and Toolchain defintions -## -## Host OS utils -## -RM=rm -f -CP=cp - -## -## Compiler tools -## -COMPILER = sparc-rtems4.10-gcc -ASSEMBLER = sparc-rtems4.10-gcc -LINKER = sparc-rtems4.10-ld -AR = sparc-rtems4.10-ar -NM = sparc-rtems4.10-nm -OBJCPY = sparc-rtems4.10-objcopy diff --git a/src/bsp/sis-rtems/make/link-rules.mak b/src/bsp/sis-rtems/make/link-rules.mak deleted file mode 100644 index 3cba33812..000000000 --- a/src/bsp/sis-rtems/make/link-rules.mak +++ /dev/null @@ -1,32 +0,0 @@ -############################################################################### -# File: link-rules.mak -# -# Purpose: -# Makefile for linking code and producing the OSAL Core executable image. -# -# History: -# -############################################################################### - -CORE_INSTALL_FILES = $(EXE_TARGET) - -## -## Linker flags that are needed -## -LDFLAGS = - -## -## Libraries to link in -## -LIBS = - - -## -## Application Link Rule -## -$(APPTARGET).$(APP_EXT): $(OBJS) - $(COMPILER) --pipe -B$(RTEMS_BSP_BASE)/sparc-rtems4.10/sis/lib/ -specs bsp_specs -qrtems \ - -g -Wall -O2 -g -mcpu=cypress \ - -o $(APPTARGET).$(APP_EXT) \ - $(OBJS) $(CORE_OBJS) - diff --git a/src/bsp/sis-rtems/src/bsp.mak b/src/bsp/sis-rtems/src/bsp.mak deleted file mode 100644 index 999e76c7a..000000000 --- a/src/bsp/sis-rtems/src/bsp.mak +++ /dev/null @@ -1,20 +0,0 @@ -############################################################################### -# File: bsp.mak -# -# Purpose: -# Compile Board Support Package routines -# History: -# -############################################################################### - -# Subsystem produced by this makefile. -TARGET = bsp.o - -#============================================================================== -# Object files required to build subsystem. -OBJS = bsp_start.o bsp_voltab.o bsp_loader.o - -#============================================================================== -# Source files required to build subsystem; used to generate dependencies. -SOURCES = bsp_start.c bsp_voltab.c bsp_loader.c - diff --git a/src/bsp/sis-rtems/src/bsp_loader.c b/src/bsp/sis-rtems/src/bsp_loader.c deleted file mode 100644 index 74ae79e22..000000000 --- a/src/bsp/sis-rtems/src/bsp_loader.c +++ /dev/null @@ -1,28 +0,0 @@ -/****************************************************************************** -** File: bsp_loader.c -** -** -** This is governed by the NASA Open Source Agreement and may be used, -** distributed and modified only pursuant to the terms of that agreement. -** -** Copyright (c) 2004-2006, United States government as represented by the -** administrator of the National Aeronautics Space Administration. -** All rights reserved. -** -** -** Purpose: -** Include the Static loader. This is not part of the OSAL, so it cannot be -** included in the source. This file allows the static loader to be included -** if it's available. If not, simply undef the OS_STATIC_LOADER define -** in osconfig.h -** -** History: -** -******************************************************************************/ -#include "osapi.h" - -#ifdef OS_STATIC_LOADER - #include "LzmaDec.c" - #include "loadstaticloadfile.c" -#endif - diff --git a/src/bsp/sis-rtems/src/bsp_start.c b/src/bsp/sis-rtems/src/bsp_start.c deleted file mode 100644 index 747d4b5d5..000000000 --- a/src/bsp/sis-rtems/src/bsp_start.c +++ /dev/null @@ -1,193 +0,0 @@ -/****************************************************************************** -** File: os_bspstart.c -** -** -** This is governed by the NASA Open Source Agreement and may be used, -** distributed and modified only pursuant to the terms of that agreement. -** -** Copyright (c) 2004-2006, United States government as represented by the -** administrator of the National Aeronautics Space Administration. -** All rights reserved. -** -** -** Purpose: -** OSAL BSP main entry point. -** -** History: -** 2004/09/23 J.P. Swinski | Initial version, -** 2004/10/01 P.Kutt | Replaced OS API task delay with VxWorks functions -** since OS API is initialized later. -** -******************************************************************************/ - -#define _USING_RTEMS_INCLUDES_ - -/* -** Include Files -*/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* -** OSAL includes -*/ -#include "common_types.h" -#include "osapi.h" - -/* -** Defines -*/ -#define RTEMS_DRIVER_AUTO_MAJOR (0) -#define RTEMS_NUMBER_OF_RAMDISKS 1 - - -/* -** External Declarations -*/ -void OS_Application_Startup(void); - -/* -** Global data -*/ - -/* - * The RAM Disk configuration. - */ -rtems_ramdisk_config rtems_ramdisk_configuration[RTEMS_NUMBER_OF_RAMDISKS]; - -/* - * The number of RAM Disk configurations. -*/ -size_t rtems_ramdisk_configuration_size = RTEMS_NUMBER_OF_RAMDISKS; - -/* -** RAM Disk IO op table. -*/ -rtems_driver_address_table rtems_ramdisk_io_ops = -{ - initialization_entry: ramdisk_initialize, - open_entry: rtems_blkdev_generic_open, - close_entry: rtems_blkdev_generic_close, - read_entry: rtems_blkdev_generic_read, - write_entry: rtems_blkdev_generic_write, - control_entry: rtems_blkdev_generic_ioctl -}; - -/****************************************************************************** -** Function: OS_BSPMain() -** -** Purpose: -** vxWorks/BSP Application entry point. -** -** Arguments: -** (none) -** -** Return: -** (none) -*/ - -void OS_BSPMain( void ) -{ - /* - ** Call OSAL entry point. - */ - OS_Application_Startup(); - - /* - ** Just sleep while OSAL code runs - */ - for ( ;; ) - sleep(1); - -} - -rtems_task Init( - rtems_task_argument ignored -) -{ - int status; - int mode; - - printf("\n\n"); - printf( "\n\n*** RTEMS Info ***\n" ); - printf("%s", _Copyright_Notice ); - printf("%s\n\n", _RTEMS_version ); - printf(" Workspace base %08X\n", (unsigned int)Configuration.work_space_start ); - printf(" Workspace size %d\n", (int) Configuration.work_space_size ); - printf(" Workspace top %08X\n", (unsigned int)(Configuration.work_space_start - + Configuration.work_space_size) ); - printf("\n"); - printf( "*** End RTEMS info ***\n\n" ); - - /* - ** Create the RTEMS Root file system - */ - printf("Creating Root file system\n"); - status = rtems_create_root_fs(); - - - /* - ** create the directory mountpoints - */ - mode = S_IFDIR |S_IRWXU | S_IRWXG | S_IRWXO; - status = mkdir("/drive0", mode); - status = mkdir("/drive1", mode); - status = mkdir("/ram", mode); /* For symtest mountpoint */ - - - /* - ** Call OSAL entry point - */ - OS_BSPMain(); - - printf( "*** END OF OSAL TEST ***\n" ); - - exit( 0 ); -} - -/* configuration information */ - -/* -** RTEMS OS Configuration defintions -*/ -#define TASK_INTLEVEL 0 -#define CONFIGURE_INIT -#define CONFIGURE_INIT_TASK_ATTRIBUTES (RTEMS_FLOATING_POINT | RTEMS_PREEMPT | RTEMS_NO_TIMESLICE | RTEMS_ASR | RTEMS_INTERRUPT_LEVEL(TASK_INTLEVEL)) -#define CONFIGURE_INIT_TASK_STACK_SIZE (20*1024) -#define CONFIGURE_INIT_TASK_PRIORITY 120 - -#define CONFIGURE_MAXIMUM_TASKS 64 -#define CONFIGURE_MAXIMUM_TIMERS 10 -#define CONFIGURE_MAXIMUM_SEMAPHORES 64 -#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 64 - -#define CONFIGURE_EXECUTIVE_RAM_SIZE (1024*1024) - -#define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER -#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER - -#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM -#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 100 - -#define CONFIGURE_FILESYSTEM_RFS -#define CONFIGURE_FILESYSTEM_IMFS - -#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK - -#define CONFIGURE_MICROSECONDS_PER_TICK 10000 - -#define CONFIGURE_MAXIMUM_DRIVERS 10 - -#include - - diff --git a/src/bsp/sis-rtems/src/bsp_voltab.c b/src/bsp/sis-rtems/src/bsp_voltab.c deleted file mode 100644 index fff98276f..000000000 --- a/src/bsp/sis-rtems/src/bsp_voltab.c +++ /dev/null @@ -1,63 +0,0 @@ -/* -** File : bsp_voltab.c -** Author : Nicholas Yanchik / GSFC Code 582 -** -** This is governed by the NASA Open Source Agreement and may be used, -** distributed and modified only pursuant to the terms of that agreement. -** -** Copyright (c) 2004-2006, United States government as represented by the -** administrator of the National Aeronautics Space Administration. -** All rights reserved. -** -** -** BSP Volume table for file systems -*/ - -/**************************************************************************************** - INCLUDE FILES -****************************************************************************************/ -#include "common_types.h" -#include "osapi.h" - - -/* -** OSAL Disk volume table. -** Note for RTEMS, there is only one RAM_DISK device supported right now. -** This is due to the static configuration of the driver structures ( see bsp_start.c ) -*/ -OS_VolumeInfo_t OS_VolumeTable [NUM_TABLE_ENTRIES] = -{ -/* Dev Name Phys Dev Vol Type Volatile? Free? IsMounted? Volname MountPt BlockSz */ - -/* RAM Disk */ -{"/ramdev0", "/dev/rda", RAM_DISK, true, true, false, " ", " ", 0 }, - - -/* non-volatile Disk -- Auto-Mapped to an existing CF disk */ -{"/eedev0", "/", FS_BASED, false, false, true, "CF", "/", 512 }, - -/* -** Spare RAM disks to be used for SSR and other RAM disks -*/ -{"/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 }, -{"/ramdev5", "/ram5", FS_BASED, true, true, false, " ", " ", 0 }, - -/* -** Hard disk mappings -*/ -{"/ssrdev0", "/hd:0/SSR1", FS_BASED, true, true, false, " ", " ", 0 }, -{"/ssrdev1", "/hd:0/SSR2", FS_BASED, true, true, false, " ", " ", 0 }, -{"/ssrdev2", "/hd:0/SSR3", FS_BASED, true, true, false, " ", " ", 0 }, - -{"unused", "unused", FS_BASED, true, true, false, " ", " ", 0 }, -{"unused", "unused", FS_BASED, true, true, false, " ", " ", 0 }, -{"unused", "unused", FS_BASED, true, true, false, " ", " ", 0 }, -{"unused", "unused", FS_BASED, true, true, false, " ", " ", 0 } - -}; - - - diff --git a/src/bsp/sparc-vxworks6.7/config/osconfig.h b/src/bsp/sparc-vxworks6.7/config/osconfig.h deleted file mode 100644 index df917fb43..000000000 --- a/src/bsp/sparc-vxworks6.7/config/osconfig.h +++ /dev/null @@ -1,137 +0,0 @@ -/****************************************************************************** -** File: osconfig.h -** -** Purpose: -** This header file contains the OS API configuration parameters. -** -** Author: A. Cudmore -** -** Notes: -** -******************************************************************************/ - -#ifndef _osconfig_ -#define _osconfig_ - -/* -** Platform Configuration Parameters for the OS API -*/ - -#define OS_MAX_TASKS 64 -#define OS_MAX_QUEUES 64 -#define OS_MAX_COUNT_SEMAPHORES 20 -#define OS_MAX_BIN_SEMAPHORES 20 -#define OS_MAX_MUTEXES 20 - -/* -** Maximum length for an absolute path name -*/ -#define OS_MAX_PATH_LEN 84 - -/* -** Maximum length for a local or host path/filename. -** This parameter can consist of the OSAL filename/path + -** the host OS physical volume name or path. -*/ -#define OS_MAX_LOCAL_PATH_LEN (OS_MAX_PATH_LEN + OS_FS_PHYS_NAME_LEN) - - -/* -** The maxium length allowed for a object (task,queue....) name -*/ -#define OS_MAX_API_NAME 20 - -/* -** The maximum length for a file name -*/ -#define OS_MAX_FILE_NAME 40 - -/* -** These defines are for OS_printf -*/ -#define OS_BUFFER_SIZE 172 -#define OS_BUFFER_MSG_DEPTH 100 - -/* This #define turns on a utility task that - * will read the statements to print from - * the OS_printf function. If you want OS_printf - * to print the text out itself, comment this out - * - * NOTE: The Utility Task #defines only have meaning - * on the VxWorks operating systems - */ - -#define OS_UTILITY_TASK_ON - - -#ifdef OS_UTILITY_TASK_ON - #define OS_UTILITYTASK_STACK_SIZE 2048 - /* some room is left for other lower priority tasks */ - #define OS_UTILITYTASK_PRIORITY 245 -#endif - - -/* -** the size of a command that can be passed to the underlying OS -*/ -#define OS_MAX_CMD_LEN 1000 - -/* -** This define will include the OS network API. -** It should be turned off for targtets that do not have a network stack or -** device ( like the basic RAD750 vxWorks BSP ) -*/ -#define OS_INCLUDE_NETWORK - -/* -** This is the maximum number of open file descriptors allowed at a time -*/ -#define OS_MAX_NUM_OPEN_FILES 20 - -/* -** This defines the filethe input command of OS_ShellOutputToFile -** is written to in the VxWorks6 port -*/ -#define OS_SHELL_CMD_INPUT_FILE_NAME "/drive3/OS_ShellCmd.in" - -/* -** This define sets the queue implentation of the Linux port to use sockets -** commenting this out makes the Linux port use the POSIX message queues. -*/ -/* #define OSAL_SOCKET_QUEUE */ - -/* -** Module loader/symbol table is optional -*/ -#define OS_INCLUDE_MODULE_LOADER - -#ifdef OS_INCLUDE_MODULE_LOADER - /* - ** This define sets the size of the OS Module Table, which keeps track of the loaded modules in - ** the running system. This define must be set high enough to support the maximum number of - ** loadable modules in the system. If the the table is filled up at runtime, a new module load - ** would fail. - */ - #define OS_MAX_MODULES 10 - - /* - ** The Static Loader define is used for switching between the Dynamic and Static loader implementations. - */ - /* #define OS_STATIC_LOADER */ - -#endif - - -/* -** This define sets the maximum symbol name string length. It is used in implementations that -** support the symbols and symbol lookup. -*/ -#define OS_MAX_SYM_LEN 64 - - -/* -** This define sets the maximum number of timers available -*/ -#define OS_MAX_TIMERS 5 - -#endif diff --git a/src/bsp/sparc-vxworks6.7/make/compiler-opts.mak b/src/bsp/sparc-vxworks6.7/make/compiler-opts.mak deleted file mode 100644 index 7f655dfb9..000000000 --- a/src/bsp/sparc-vxworks6.7/make/compiler-opts.mak +++ /dev/null @@ -1,118 +0,0 @@ -############################################################################## -## compiler-opts.mak - compiler definitions and options for building the cFE -## -## Target: SPARC V8 GR-UT699 vxWorks 6.x -## -## Modifications: -## -############################################################################### -## -## Warning Level Configuration -## -## WARNINGS=-Wall -ansi -pedantic -Wstrict-prototypes -WARNINGS = -Wall -std=c99 - -## -## A fix for Windows systems on vxWorks 6.4 -## When generating dependancies, the Windows GCC cannot seem to deal -## with the Windows style path separators in the WIND_BASE macro. -## -FIXED_WIND_BASE = $(subst \,/,$(WIND_BASE)) - - -## -## vxWorks system includes -- including Gaisler drivers/libraries -## -VXINCDIR = $(FIXED_WIND_BASE)/target/h \ -$(FIXED_WIND_BASE)/target/h/wrn/coreip \ -$(FIXED_WIND_BASE)/target/h/drv \ -$(FIXED_WIND_BASE)/target/h/drv/os_ext \ -$(FIXED_WIND_BASE)/target/src/config \ -$(FIXED_WIND_BASE)/target/src/drv \ -$(FIXED_WIND_BASE)/target/config/comps/src \ -$(FIXED_WIND_BASE)/target/config/comps/src/dosfs2 \ - -SYSINCS = $(VXINCDIR:%=-I%) - -## -## Target Defines for the OS, Hardware Arch, etc.. -## -TARGET_DEFS += -D_VXWORKS_OS_ -D__SPARC__ $(CFE_SB_NET) -D$(OS) -D_EMBED_ \ - -DTOOL_FAMILY=gnu -DTOOL=gnuv8 -D_WRS_KERNEL -DCPU=SPARC \ - "-D_VSB_CONFIG_FILE=<../lib/h/config/vsbConfig.h>" - -# IF SMP Mode, Append SMP Compiler Directives (Kernel mode is not binary compatible, user-mode is) -ifeq (${OS_MODE},SMP) - TARGET_DEFS := $(TARGET_DEFS) -DVXBUILD=SMP -D_WRS_VX_SMP -D_WRS_CONFIG_SMP -endif -## -## Endian Defines -## -ENDIAN_DEFS=-D_EB -DENDIAN=_EB -DSOFTWARE_BIG_BIT_ORDER - -## -## Compiler Architecture Switches -## -##ARCH_OPTS = -mv8 -mfpu -m32 -fno-builtin -fvolatile -mfaster-structs -Wcast-align -#ARCH_OPTS = -m32 -fno-builtin -fvolatile -Wcast-align -mtune=ut699 -ARCH_OPTS = -fno-builtin -fvolatile -Wcast-align -m32 -mtune=ut699 -mv8 -ffloat-int-mode - -## -## Application specific compiler switches -## -ifeq ($(BUILD_TYPE),CFE_APP) -# cc1: error: unrecognized command line option "-mlongcall" by sparc gcc -## APP_COPTS = -mlongcall - APP_ASOPTS = -else - APP_COPTS = - APP_ASOPTS = -endif - -## -## Extra Cflags for Assembly listings, etc. -## -LIST_OPTS = -Wa,-a=$*.lis - -## -## gcc options for dependancy generation -## -COPTS_D = $(APP_COPTS) $(ENDIAN_DEFS) $(TARGET_DEFS) $(ARCH_OPTS) $(SYSINCS) $(WARNINGS) - -## -## General gcc options that apply to compiling and dependency generation. -## -COPTS=$(LIST_OPTS) $(COPTS_D) - - -## -## Extra defines and switches for assembly code -## -ASOPTS = $(APP_ASOPTS) -P -xassembler-with-cpp - -##--------------------------------------------------------- -## Application file extention type -## This is the defined application extention. -## Known extentions: Mac OS X: .bundle, Linux: .so, RTEMS: -## .s3r, vxWorks: .o etc.. -##--------------------------------------------------------- -APP_EXT = o - -#################################################### -## Host Development System and Toolchain defintions -## -## Host OS utils -## -RM=rm -f -CP=cp - -## -## Compiler tools -## -COMPILER = sparc-wrs-vxworks-gcc -ASSEMBLER = sparc-wrs-vxworks-gcc -LINKER = sparc-wrs-vxworks-ld -AR = sparc-wrs-vxworks-ar -NM = sparc-wrs-vxworks-nm -OBJCPY = sparc-wrs-vxworks-objcopy -TABLE_BIN = elf2cfetbl diff --git a/src/bsp/sparc-vxworks6.7/make/link-rules.mak b/src/bsp/sparc-vxworks6.7/make/link-rules.mak deleted file mode 100644 index 08b45aa88..000000000 --- a/src/bsp/sparc-vxworks6.7/make/link-rules.mak +++ /dev/null @@ -1,35 +0,0 @@ -############################################################################### -# File: link-rules.mak -# -# Purpose: -# Makefile for linking code and producing the OSAL Core executable image. -# -# History: -# -############################################################################### -## -## Executable target. This is target specific -## - -## -## Linker flags that are needed -## -LDFLAGS = - -## -## Libraries to link in -## -LIBS = - -## -## OSAL Core Link Rule -## -$(EXE_TARGET): $(CORE_OBJS) - $(COMPILER) $(DEBUG_FLAGS) -r -nostdlib -o $(EXE_TARGET) $(CORE_OBJS) - -## -## Application Link Rule -## -$(APPTARGET).$(APP_EXT): $(OBJS) - $(LINKER) -r $(OBJS) $(CORE_OBJS) -o $@ - diff --git a/src/bsp/sparc-vxworks6.7/make/ut-modules.mak b/src/bsp/sparc-vxworks6.7/make/ut-modules.mak deleted file mode 100644 index b440787e2..000000000 --- a/src/bsp/sparc-vxworks6.7/make/ut-modules.mak +++ /dev/null @@ -1,29 +0,0 @@ - -CC = sparc-wrs-vxworks-gcc - -# This section is common to all vxworks platforms -CFLGS = -fno-builtin -fvolatile -O0 -m32 -CFLGS += -Wall -g -CFLGS += -D_EB -DENDIAN=_EB -DSOFTWARE_BIG_BIT_ORDER -CFLGS += -D_VXWORKS_OS_ -Dvxworks6 -D_EMBED_ -DTOOL_FAMILY=gnu -D_WRS_KERNEL - -# Uncomment this section for Sparc platform -CFLGS += -D__SPARC__ -DTOOL=gnuv8 -DCPU=SPARC -CFLGS += -mtune=ut699 -mv8 -ffloat-int-mode - -default: - -mkdir eeprom1 - $(CC) $(CFLGS) -DMODULE_NAME=module0 -o eeprom1/MODULE0.o $(OSAL_SRC)/unit-tests/osloader-test/ut_module.c - $(CC) $(CFLGS) -DMODULE_NAME=module1 -o eeprom1/MODULE1.o $(OSAL_SRC)/unit-tests/osloader-test/ut_module.c - $(CC) $(CFLGS) -DMODULE_NAME=module2 -o eeprom1/MODULE2.o $(OSAL_SRC)/unit-tests/osloader-test/ut_module.c - $(CC) $(CFLGS) -DMODULE_NAME=module3 -o eeprom1/MODULE3.o $(OSAL_SRC)/unit-tests/osloader-test/ut_module.c - $(CC) $(CFLGS) -DMODULE_NAME=module4 -o eeprom1/MODULE4.o $(OSAL_SRC)/unit-tests/osloader-test/ut_module.c - $(CC) $(CFLGS) -DMODULE_NAME=module5 -o eeprom1/MODULE5.o $(OSAL_SRC)/unit-tests/osloader-test/ut_module.c - $(CC) $(CFLGS) -DMODULE_NAME=module6 -o eeprom1/MODULE6.o $(OSAL_SRC)/unit-tests/osloader-test/ut_module.c - $(CC) $(CFLGS) -DMODULE_NAME=module7 -o eeprom1/MODULE7.o $(OSAL_SRC)/unit-tests/osloader-test/ut_module.c - $(CC) $(CFLGS) -DMODULE_NAME=module8 -o eeprom1/MODULE8.o $(OSAL_SRC)/unit-tests/osloader-test/ut_module.c - $(CC) $(CFLGS) -DMODULE_NAME=module9 -o eeprom1/MODULE9.o $(OSAL_SRC)/unit-tests/osloader-test/ut_module.c - $(CC) $(CFLGS) -DMODULE_NAME=module10 -o eeprom1/MODULE10.o $(OSAL_SRC)/unit-tests/osloader-test/ut_module.c - -clean: - -rm -f eeprom1/*.o diff --git a/src/bsp/sparc-vxworks6.7/src/bsp.mak b/src/bsp/sparc-vxworks6.7/src/bsp.mak deleted file mode 100644 index f1ebaf8cd..000000000 --- a/src/bsp/sparc-vxworks6.7/src/bsp.mak +++ /dev/null @@ -1,21 +0,0 @@ -############################################################################### -# File: bsp.mak -# -# Purpose: -# Compile Board Support Package routines -# -# History: -# -############################################################################### - -# Subsystem produced by this makefile. -TARGET = bsp.o - -#============================================================================== -# Object files required to build subsystem. -OBJS = bsp_start.o bsp_voltab.o - -#============================================================================== -# Source files required to build subsystem; used to generate dependencies. -SOURCES = bsp_start.c bsp_voltab.c - diff --git a/src/bsp/sparc-vxworks6.7/src/bsp_start.c b/src/bsp/sparc-vxworks6.7/src/bsp_start.c deleted file mode 100644 index 177825684..000000000 --- a/src/bsp/sparc-vxworks6.7/src/bsp_start.c +++ /dev/null @@ -1,76 +0,0 @@ -/****************************************************************************** -** File: bsp_start.c -** -** This is governed by the NASA Open Source Agreement and may be used, -** distributed and modified only pursuant to the terms of that agreement. -** -** Copyright (c) 2004-2006, United States government as represented by the -** administrator of the National Aeronautics Space Administration. -** All rights reserved. -** -** Purpose: -** -** OSAL main entry point. -** -** History: -** -******************************************************************************/ - -/* -** Include Files -*/ -#include -#include -#include -#include "vxWorks.h" -#include "sysLib.h" -#include "taskLib.h" - -/* -** OSAL includes -*/ -#include "common_types.h" -#include "osapi.h" - -/* -** External Declarations -*/ -void OS_Application_Startup(void); - -/****************************************************************************** -** Function: OS_BSPMain() -** -** Purpose: -** vxWorks/BSP Application entry point. -** -** Arguments: -** (none) -** -** Return: -** (none) -*/ - -void OS_BSPMain( void ) -{ - int TicksPerSecond; - - /* - ** Delay for one second. - */ - TicksPerSecond = sysClkRateGet(); - (void) taskDelay( TicksPerSecond ); - - OS_printf("Starting Up OSAPI App.\n"); - - /* - ** Call OSAL entry point. - */ - OS_Application_Startup(); - - /* - ** Exit the main thread. - ** in VxWorks we can delete all of the OS tasks if we want. - */ - -} - diff --git a/src/bsp/sparc-vxworks6.7/src/bsp_voltab.c b/src/bsp/sparc-vxworks6.7/src/bsp_voltab.c deleted file mode 100644 index bb25283b9..000000000 --- a/src/bsp/sparc-vxworks6.7/src/bsp_voltab.c +++ /dev/null @@ -1,60 +0,0 @@ -/* -** File : bsp_voltab.c -** Author : Nicholas Yanchik / GSFC Code 582 -** -** This is governed by the NASA Open Source Agreement and may be used, -** distributed and modified only pursuant to the terms of that agreement. -** -** Copyright (c) 2004-2006, United States government as represented by the -** administrator of the National Aeronautics Space Administration. -** All rights reserved. -** -** -** BSP Volume table for file systems -*/ - -/**************************************************************************************** - INCLUDE FILES -****************************************************************************************/ -#include "common_types.h" -#include "osapi.h" - - -/* -** volume table. -*/ -OS_VolumeInfo_t OS_VolumeTable [NUM_TABLE_ENTRIES] = -{ -/* Dev Name Phys Dev Vol Type Volatile? Free? IsMounted? Volname MountPt BlockSz */ - -/* RAM Disk */ -{"/ramdev0", " ", RAM_DISK, true, true, false, " ", " ", 0 }, - -/* non-volatile Disk -- Auto-Mapped to an existing CF disk */ -{"/eedev0", "CF:0", FS_BASED, false, false, true, "CF", "/cf", 512 }, - -/* -** Spare RAM disks to be used for SSR and other RAM disks -*/ -{"/ramdev1", " ", RAM_DISK, true, true, false, " ", " ", 0 }, -{"/ramdev2", " ", RAM_DISK, true, true, false, " ", " ", 0 }, -{"/ramdev3", " ", RAM_DISK, true, true, false, " ", " ", 0 }, -{"/ramdev4", " ", RAM_DISK, true, true, false, " ", " ", 0 }, -{"/ramdev5", " ", RAM_DISK, true, true, false, " ", " ", 0 }, - -/* -** Hard disk mappings -*/ -{"/ssrdev0", "/hd:0/SSR1", FS_BASED, true, true, false, " ", " ", 0 }, -{"/ssrdev1", "/hd:0/SSR2", FS_BASED, true, true, false, " ", " ", 0 }, -{"/ssrdev2", "/hd:0/SSR3", FS_BASED, true, true, false, " ", " ", 0 }, - -{"unused", "unused", FS_BASED, true, true, false, " ", " ", 0 }, -{"unused", "unused", FS_BASED, true, true, false, " ", " ", 0 }, -{"unused", "unused", FS_BASED, true, true, false, " ", " ", 0 }, -{"unused", "unused", FS_BASED, true, true, false, " ", " ", 0 } - -}; - - - diff --git a/src/bsp/sparc-vxworks6.7/ut-src/bsp_ut.c b/src/bsp/sparc-vxworks6.7/ut-src/bsp_ut.c deleted file mode 100644 index 9d7cda8f3..000000000 --- a/src/bsp/sparc-vxworks6.7/ut-src/bsp_ut.c +++ /dev/null @@ -1,253 +0,0 @@ -/****************************************************************************** -** File: bsp_ut.c -** -** -** This is governed by the NASA Open Source Agreement and may be used, -** distributed and modified only pursuant to the terms of that agreement. -** -** Copyright (c) 2004-2015, United States government as represented by the -** administrator of the National Aeronautics Space Administration. -** All rights reserved. -** -** -** Purpose: -** BSP unit test implementation functions. -** -** History: -** Created on: Feb 10, 2015 -** -******************************************************************************/ - -/* - * NOTE - This entire source file is only relevant for unit testing. - * It should not be included in a "normal" BSP build. - */ - -#include -#include -#include -#include -#include -#include - -#include "utbsp.h" -#include "uttest.h" - - -/* -** External Declarations -*/ -extern void OS_Application_Startup(void); - - -/* -** Local Variables -*/ -static uint32 CurrVerbosity = (2 << UTASSERT_CASETYPE_PASS) - 1; - -void UT_BSP_Setup(const char *Name) -{ - int mode; - - UT_BSP_DoText(UTASSERT_CASETYPE_BEGIN, Name); - - /* - ** Create local directories for "disk" mount points - ** See bsp_voltab for the values - ** - ** N/A for an embedded target. These will already be setup - ** in the kernel config and created when the board is booted - */ - -} - -void UT_BSP_StartTestSegment(uint32 SegmentNumber, const char *SegmentName) -{ - char ReportBuffer[128]; - - snprintf(ReportBuffer,sizeof(ReportBuffer), "%02u %s", (unsigned int)SegmentNumber, SegmentName); - UT_BSP_DoText(UTASSERT_CASETYPE_BEGIN, ReportBuffer); -} - -void UT_BSP_DoText(uint8 MessageType, const char *OutputMessage) -{ - const char *Prefix; - - if ((CurrVerbosity >> MessageType) & 1) - { - switch(MessageType) - { - case UTASSERT_CASETYPE_ABORT: - Prefix = "ABORT"; - break; - case UTASSERT_CASETYPE_FAILURE: - Prefix = "\x1b[31m FAIL\x1b[0m"; - break; - case UTASSERT_CASETYPE_MIR: - Prefix = "MIR"; - break; - case UTASSERT_CASETYPE_TSF: - Prefix = "TSF"; - break; - case UTASSERT_CASETYPE_TTF: - Prefix = "TTF"; - break; - case UTASSERT_CASETYPE_NA: - Prefix = "N/A"; - break; - case UTASSERT_CASETYPE_BEGIN: - printf("\n"); /* add a bit of extra whitespace between tests */ - Prefix = "BEGIN"; - break; - case UTASSERT_CASETYPE_END: - Prefix = "END"; - break; - case UTASSERT_CASETYPE_PASS: - Prefix = "PASS"; - break; - case UTASSERT_CASETYPE_INFO: - Prefix = "INFO"; - break; - case UTASSERT_CASETYPE_DEBUG: - Prefix = "DEBUG"; - break; - default: - Prefix = "OTHER"; - break; - } - printf("[%5s] %s\n",Prefix,OutputMessage); - } - - /* - * If any ABORT (major failure) message is thrown, - * then actually call abort() to stop the test and dump a core - */ - if (MessageType == UTASSERT_CASETYPE_ABORT) - { - abort(); - } -} - -void UT_BSP_DoReport(const char *File, uint32 LineNum, uint32 SegmentNum, uint32 TestSeq, uint8 MessageType, const char *SubsysName, const char *ShortDesc) -{ - uint32 FileLen; - const char *BasePtr; - char ReportBuffer[128]; - - FileLen = strlen(File); - BasePtr = File + FileLen; - while (FileLen > 0) - { - --BasePtr; - --FileLen; - if (*BasePtr == '/' || *BasePtr == '\\') - { - ++BasePtr; - break; - } - } - - snprintf(ReportBuffer,sizeof(ReportBuffer), "%02u.%03u %s:%u - %s", - (unsigned int)SegmentNum, (unsigned int)TestSeq, - BasePtr, (unsigned int)LineNum, ShortDesc); - - UT_BSP_DoText(MessageType, ReportBuffer); -} - -void UT_BSP_DoTestSegmentReport(const char *SegmentName, const UtAssert_TestCounter_t *TestCounters) -{ - char ReportBuffer[128]; - - snprintf(ReportBuffer,sizeof(ReportBuffer), - "%02u %-20s TOTAL::%-4u PASS::%-4u FAIL::%-4u MIR::%-4u TSF::%-4u N/A::%-4u\n", - (unsigned int)TestCounters->TestSegmentCount, - SegmentName, - (unsigned int)TestCounters->TotalTestCases, - (unsigned int)TestCounters->CaseCount[UTASSERT_CASETYPE_PASS], - (unsigned int)TestCounters->CaseCount[UTASSERT_CASETYPE_FAILURE], - (unsigned int)TestCounters->CaseCount[UTASSERT_CASETYPE_MIR], - (unsigned int)TestCounters->CaseCount[UTASSERT_CASETYPE_TSF], - (unsigned int)TestCounters->CaseCount[UTASSERT_CASETYPE_NA]); - - - UT_BSP_DoText(UTASSERT_CASETYPE_END, ReportBuffer); -} - -void UT_BSP_EndTest(const UtAssert_TestCounter_t *TestCounters) -{ - int status = 0; - - /* - * Only output a "summary" if there is more than one test Segment. - * Otherwise it is a duplicate of the report already given. - */ - if (TestCounters->TestSegmentCount > 1) - { - UT_BSP_DoTestSegmentReport("SUMMARY", TestCounters); - } - - printf("COMPLETE: %u tests Segment(s) executed\n\n", (unsigned int)TestCounters->TestSegmentCount); - - /* - * The Linux UT BSP allows at least a 7 bit status code to be returned to the OS (i.e. the exit status - * of the process). This is useful to report pass/fail. Because we have multiple bits, we can make - * descriptive exit status codes to indicate what went wrong. Anything nonzero represents failure. - * - * Consider Failures as well as "TSF" (setup failures) to be grounds for returning nonzero (bad) status. - * Also the lack of ANY test cases should produce a bad status. - * - * "MIR" results should not produce a bad status -- these may have worked fine, we do not know. - * - * Likewise "N/A" tests are simply not applicable, so we just ignore them. - */ - - if (TestCounters->TotalTestCases == 0) - { - status |= 0x01; - } - - if (TestCounters->CaseCount[UTASSERT_CASETYPE_FAILURE] > 0) - { - status |= 0x02; - } - - if (TestCounters->CaseCount[UTASSERT_CASETYPE_TSF] > 0) - { - status |= 0x04; - } - - /* this function cannot return an exit code using exit() on VxWorks - * the status cannot be returned without changing the function - * prototype in ut_assert/inc/utbsp.h */ -} - -/****************************************************************************** -** Function: UT_main() -** -** Purpose: -** BSP Unit Test Application entry point. -** -** Arguments: -** (none) -** -** Return: -** (none) -*/ - -void UT_main(void) -{ - UT_BSP_Setup("SPARC-VxWorks UNIT TEST"); - - /* - ** Call application specific entry point. - */ - OS_Application_Startup(); - - /* - ** In unit test mode, call the UtTest_Run function (part of UT Assert library) - */ - UtTest_Run(); - UT_BSP_EndTest(UtAssert_GetCounters()); - -} - diff --git a/src/bsp/sparc-vxworks6.7/ut-src/bsp_ut_voltab.c b/src/bsp/sparc-vxworks6.7/ut-src/bsp_ut_voltab.c deleted file mode 100644 index 61756df6a..000000000 --- a/src/bsp/sparc-vxworks6.7/ut-src/bsp_ut_voltab.c +++ /dev/null @@ -1,51 +0,0 @@ -/* -** File : bsp_voltab.c -** -** This is governed by the NASA Open Source Agreement and may be used, -** distributed and modified only pursuant to the terms of that agreement. -** -** Copyright (c) 2004-2006, United States government as represented by the -** administrator of the National Aeronautics Space Administration. -** All rights reserved. -** -** -** Author : Nicholas Yanchik / GSFC Code 582 -** -** BSP Volume table for file systems -*/ - -/**************************************************************************************** - INCLUDE FILES -****************************************************************************************/ -#include "common_types.h" -#include "osapi.h" - - -/* -** volume table. -*/ -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_ATA) -{"/cf", "/ata0a/cf", FS_BASED, false, false, true, "CF", "/cf", 1024 } -#elif defined(UT_OS_USE_RAM) -{"/cf", "/ram0/cf", RAM_DISK, false, false, true, "CF", "/cf", 1024 } -#else -{"/ramdev13", "/ram13", RAM_DISK, true, true, false, " ", " ", 0 }, -#endif -}; - diff --git a/src/os/inc/osapi-os-core.h b/src/os/inc/osapi-os-core.h index 61ce966b5..44b9574e6 100644 --- a/src/os/inc/osapi-os-core.h +++ b/src/os/inc/osapi-os-core.h @@ -972,7 +972,7 @@ int32 OS_ExcDisable (int32 ExceptionNumber); * @returns OS_SUCCESS on success, or appropriate error code * OS_ERR_NOT_IMPLEMENTED on platforms that do not support this function */ -int32 OS_FPUExcAttachHandler (uint32 ExceptionNumber, void * ExceptionHandler , +int32 OS_FPUExcAttachHandler (uint32 ExceptionNumber, osal_task_entry ExceptionHandler, int32 parameter); /*-------------------------------------------------------------------------------------*/ diff --git a/src/os/inc/osapi-os-net.h b/src/os/inc/osapi-os-net.h index 9039a604e..aade7932c 100644 --- a/src/os/inc/osapi-os-net.h +++ b/src/os/inc/osapi-os-net.h @@ -65,6 +65,20 @@ typedef enum OS_SocketType_MAX } OS_SocketType_t; +/** + * Storage buffer for generic network address + * + * This is a union type that helps to ensure a minimum + * alignment value for the data storage, such that it can + * be cast to the system-specific type without + * increasing alignment requirements. + */ +typedef union +{ + uint8 Buffer[OS_SOCKADDR_MAX_LEN]; /**< Ensures length of at least OS_SOCKADDR_MAX_LEN */ + uint32 AlignU32; /**< Ensures uint32 alignment */ + void* AlignPtr; /**< Ensures pointer alignment */ +} OS_SockAddrData_t; /** * Encapsulates a generic network address @@ -76,7 +90,7 @@ typedef enum typedef struct { uint32 ActualLength; /**< Length of the actual address data */ - char AddrData[OS_SOCKADDR_MAX_LEN]; /**< Abstract Address data */ + OS_SockAddrData_t AddrData; /**< Abstract Address data */ } OS_SockAddr_t; /** diff --git a/src/os/portable/os-impl-bsd-sockets.c b/src/os/portable/os-impl-bsd-sockets.c index a32bcd1ca..e24ffe970 100644 --- a/src/os/portable/os-impl-bsd-sockets.c +++ b/src/os/portable/os-impl-bsd-sockets.c @@ -197,7 +197,7 @@ int32 OS_SocketBind_Impl(uint32 sock_id, const OS_SockAddr_t *Addr) socklen_t addrlen; const struct sockaddr *sa; - sa = (const struct sockaddr *)Addr->AddrData; + sa = (const struct sockaddr *)&Addr->AddrData; switch(sa->sa_family) { @@ -257,7 +257,7 @@ int32 OS_SocketConnect_Impl(uint32 sock_id, const OS_SockAddr_t *Addr, int32 tim uint32 operation; const struct sockaddr *sa; - sa = (const struct sockaddr *)Addr->AddrData; + sa = (const struct sockaddr *)&Addr->AddrData; switch(sa->sa_family) { case AF_INET: @@ -352,7 +352,7 @@ int32 OS_SocketAccept_Impl(uint32 sock_id, uint32 connsock_id, OS_SockAddr_t *Ad else { addrlen = Addr->ActualLength; - OS_impl_filehandle_table[connsock_id].fd = accept(OS_impl_filehandle_table[sock_id].fd, (struct sockaddr *)Addr->AddrData, &addrlen); + OS_impl_filehandle_table[connsock_id].fd = accept(OS_impl_filehandle_table[sock_id].fd, (struct sockaddr *)&Addr->AddrData, &addrlen); if (OS_impl_filehandle_table[connsock_id].fd < 0) { return_code = OS_ERROR; @@ -405,7 +405,7 @@ int32 OS_SocketRecvFrom_Impl(uint32 sock_id, void *buffer, uint32 buflen, OS_Soc else { addrlen = OS_SOCKADDR_MAX_LEN; - sa = (struct sockaddr *)RemoteAddr->AddrData; + sa = (struct sockaddr *)&RemoteAddr->AddrData; } operation = OS_STREAM_STATE_READABLE; @@ -484,7 +484,7 @@ int32 OS_SocketSendTo_Impl(uint32 sock_id, const void *buffer, uint32 buflen, co socklen_t addrlen; const struct sockaddr *sa; - sa = (const struct sockaddr *)RemoteAddr->AddrData; + sa = (const struct sockaddr *)&RemoteAddr->AddrData; switch(sa->sa_family) { case AF_INET: @@ -546,7 +546,7 @@ int32 OS_SocketAddrInit_Impl(OS_SockAddr_t *Addr, OS_SocketDomain_t Domain) OS_SockAddr_Accessor_t *Accessor; memset(Addr, 0, sizeof(OS_SockAddr_t)); - Accessor = (OS_SockAddr_Accessor_t *)Addr->AddrData; + Accessor = (OS_SockAddr_Accessor_t *)&Addr->AddrData; switch(Domain) { @@ -590,7 +590,7 @@ int32 OS_SocketAddrToString_Impl(char *buffer, uint32 buflen, const OS_SockAddr_ const void *addrbuffer; const OS_SockAddr_Accessor_t *Accessor; - Accessor = (const OS_SockAddr_Accessor_t *)Addr->AddrData; + Accessor = (const OS_SockAddr_Accessor_t *)&Addr->AddrData; switch(Accessor->sockaddr.sa_family) { @@ -629,7 +629,7 @@ int32 OS_SocketAddrFromString_Impl(OS_SockAddr_t *Addr, const char *string) void *addrbuffer; OS_SockAddr_Accessor_t *Accessor; - Accessor = (OS_SockAddr_Accessor_t *)Addr->AddrData; + Accessor = (OS_SockAddr_Accessor_t *)&Addr->AddrData; switch(Accessor->sockaddr.sa_family) { @@ -668,7 +668,7 @@ int32 OS_SocketAddrGetPort_Impl(uint16 *PortNum, const OS_SockAddr_t *Addr) in_port_t sa_port; const OS_SockAddr_Accessor_t *Accessor; - Accessor = (const OS_SockAddr_Accessor_t *)Addr->AddrData; + Accessor = (const OS_SockAddr_Accessor_t *)&Addr->AddrData; switch(Accessor->sockaddr.sa_family) { @@ -705,7 +705,7 @@ int32 OS_SocketAddrSetPort_Impl(OS_SockAddr_t *Addr, uint16 PortNum) OS_SockAddr_Accessor_t *Accessor; sa_port = htons(PortNum); - Accessor = (OS_SockAddr_Accessor_t *)Addr->AddrData; + Accessor = (OS_SockAddr_Accessor_t *)&Addr->AddrData; switch(Accessor->sockaddr.sa_family) { diff --git a/src/os/portable/os-impl-posix-dl.c b/src/os/portable/os-impl-posix-dl.c index 23aba192a..3a419a405 100644 --- a/src/os/portable/os-impl-posix-dl.c +++ b/src/os/portable/os-impl-posix-dl.c @@ -51,6 +51,7 @@ */ typedef struct { + /* cppcheck-suppress unusedStructMember */ void *dl_handle; } OS_impl_module_internal_record_t; @@ -150,7 +151,7 @@ int32 OS_SymbolLookup_Impl( cpuaddr *SymbolAddress, const char *SymbolName ) * See description in os-impl.h for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_ModuleLoad_Impl ( uint32 module_id, char *translated_path ) +int32 OS_ModuleLoad_Impl ( uint32 module_id, const char *translated_path ) { int32 status = OS_ERROR; diff --git a/src/os/posix/os-posix.h b/src/os/posix/os-posix.h index 0fbeed7a2..2321621ca 100644 --- a/src/os/posix/os-posix.h +++ b/src/os/posix/os-posix.h @@ -107,7 +107,7 @@ int32 OS_Posix_StreamAPI_Impl_Init(void); int32 OS_Posix_DirAPI_Impl_Init(void); int32 OS_Posix_FileSysAPI_Impl_Init(void); -int32 OS_Posix_InternalTaskCreate_Impl (pthread_t *thr, uint32 priority, size_t stacksz, PthreadFuncPtr_t Entry, void *entry_arg); +int32 OS_Posix_InternalTaskCreate_Impl (pthread_t *pthr, uint32 priority, size_t stacksz, PthreadFuncPtr_t entry, void *entry_arg); diff --git a/src/os/posix/osapi.c b/src/os/posix/osapi.c index c41cda190..5445275a0 100644 --- a/src/os/posix/osapi.c +++ b/src/os/posix/osapi.c @@ -160,7 +160,7 @@ const OS_ErrorTable_Entry_t OS_IMPL_ERROR_NAME_TABLE[] = { { 0, NULL } }; /* * Local Function Prototypes */ -static void OS_CompAbsDelayTime( uint32 milli_second , struct timespec * tm); +static void OS_CompAbsDelayTime( uint32 msecs , struct timespec * tm); static int OS_PriorityRemap(uint32 InputPri); @@ -2327,7 +2327,7 @@ static int OS_PriorityRemap(uint32 InputPri) * See prototype in os-impl.h for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_FPUExcAttachHandler_Impl(uint32 ExceptionNumber, void * ExceptionHandler, +int32 OS_FPUExcAttachHandler_Impl(uint32 ExceptionNumber, osal_task_entry ExceptionHandler, int32 parameter) { /* @@ -2382,7 +2382,7 @@ int32 OS_FPUExcSetMask_Impl(uint32 mask) /* ** Not implemented in linux. */ - return(OS_SUCCESS); + return(OS_ERR_NOT_IMPLEMENTED); } /* end OS_FPUExcSetMask_Impl */ @@ -2400,7 +2400,7 @@ int32 OS_FPUExcGetMask_Impl(uint32 *mask) ** Not implemented in linux. */ *mask = 0; - return(OS_SUCCESS); + return(OS_ERR_NOT_IMPLEMENTED); } /* end OS_FPUExcGetMask_Impl */ /********************************************************************/ diff --git a/src/os/rtems/osapi.c b/src/os/rtems/osapi.c index 56ce59f83..7e4be24f8 100644 --- a/src/os/rtems/osapi.c +++ b/src/os/rtems/osapi.c @@ -1469,7 +1469,8 @@ int32 OS_IntAttachHandler_Impl (uint32 InterruptNumber, osal_task_entry Interru *-----------------------------------------------------------------*/ int32 OS_IntUnlock_Impl (int32 IntLevel) { - rtems_interrupt_enable ( (rtems_interrupt_level) IntLevel); + rtems_interrupt_level rtems_int_level = IntLevel; + rtems_interrupt_local_enable ( rtems_int_level ); return (OS_SUCCESS); } /* end OS_IntUnlock_Impl */ @@ -1487,7 +1488,21 @@ int32 OS_IntLock_Impl (void) { rtems_interrupt_level rtems_int_level; - rtems_interrupt_disable(rtems_int_level) ; + /* + * NOTE: rtems_interrupt_local_disable() is a macro + * that sets the rtems_int_level value. + * + * This code assumes that the value is also storable + * in an int32. + * + * This uses the "local" version which operates on + * the current CPU in case of a multi-processor environment. + * + * This should be identical to rtems_interrupt_disable in + * a single-processor config, but that call is not + * implemented in multi-processor configs. + */ + rtems_interrupt_local_disable(rtems_int_level) ; return ( (int32) rtems_int_level) ; } /* end OS_IntLock_Impl */ @@ -1504,8 +1519,7 @@ int32 OS_IntLock_Impl (void) *-----------------------------------------------------------------*/ int32 OS_IntEnable_Impl (int32 Level) { - rtems_interrupt_enable ( (rtems_interrupt_level) Level); - return(OS_SUCCESS); + return(OS_ERR_NOT_IMPLEMENTED); } /* end OS_IntEnable_Impl */ @@ -1519,10 +1533,7 @@ int32 OS_IntEnable_Impl (int32 Level) *-----------------------------------------------------------------*/ int32 OS_IntDisable_Impl (int32 Level) { - rtems_interrupt_level rtems_int_level; - - rtems_interrupt_disable(rtems_int_level) ; - return ( (int32) rtems_int_level) ; + return(OS_ERR_NOT_IMPLEMENTED); } /* end OS_IntDisable_Impl */ @@ -1590,7 +1601,7 @@ int32 OS_IntGetMask_Impl ( uint32 * MaskSettingPtr ) * See prototype in os-impl.h for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_FPUExcAttachHandler_Impl(uint32 ExceptionNumber, void * ExceptionHandler, +int32 OS_FPUExcAttachHandler_Impl(uint32 ExceptionNumber, osal_task_entry ExceptionHandler, int32 parameter) { /* @@ -1612,7 +1623,7 @@ int32 OS_FPUExcEnable_Impl(int32 ExceptionNumber) /* ** Not implemented in RTEMS. */ - return(OS_SUCCESS); + return(OS_ERR_NOT_IMPLEMENTED); } /* end OS_FPUExcEnable_Impl */ /*---------------------------------------------------------------- @@ -1628,7 +1639,7 @@ int32 OS_FPUExcDisable_Impl(int32 ExceptionNumber) /* ** Not implemented in RTEMS. */ - return(OS_SUCCESS); + return(OS_ERR_NOT_IMPLEMENTED); } /* end OS_FPUExcDisable_Impl */ @@ -1645,7 +1656,7 @@ int32 OS_FPUExcSetMask_Impl(uint32 mask) /* ** Not implemented in RTEMS. */ - return(OS_SUCCESS); + return(OS_ERR_NOT_IMPLEMENTED); } /* end OS_FPUExcSetMask_Impl */ @@ -1662,7 +1673,7 @@ int32 OS_FPUExcGetMask_Impl(uint32 *mask) /* ** Not implemented in RTEMS. */ - return(OS_SUCCESS); + return(OS_ERR_NOT_IMPLEMENTED); } /* end OS_FPUExcGetMask_Impl */ /********************************************************************/ diff --git a/src/os/rtems/osloader.c b/src/os/rtems/osloader.c index 887a8c12d..67d38be4e 100644 --- a/src/os/rtems/osloader.c +++ b/src/os/rtems/osloader.c @@ -40,6 +40,7 @@ */ typedef struct { + /* cppcheck-suppress unusedStructMember */ void *dl_handle; } OS_impl_module_internal_record_t; @@ -205,7 +206,7 @@ static bool OS_rtems_rtl_check_unresolved (rtems_rtl_unresolv_rec_t* rec, * See prototype in os-impl.h for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_ModuleLoad_Impl ( uint32 module_id, char *translated_path ) +int32 OS_ModuleLoad_Impl ( uint32 module_id, const char *translated_path ) { int32 status = OS_ERROR; int unresolved; diff --git a/src/os/shared/os-impl.h b/src/os/shared/os-impl.h index 8e252bf5d..aba3434d6 100644 --- a/src/os/shared/os-impl.h +++ b/src/os/shared/os-impl.h @@ -1227,7 +1227,7 @@ int32 OS_SetLocalTime_Impl(const OS_time_t *time_struct); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_ModuleLoad_Impl ( uint32 module_id, char *translated_path ); +int32 OS_ModuleLoad_Impl ( uint32 module_id, const char *translated_path ); /*---------------------------------------------------------------- @@ -1874,7 +1874,7 @@ int32 OS_IntGetMask_Impl ( uint32 * MaskSettingPtr ); * FPU API low-level handlers * These may also not be implementable on some platforms */ -int32 OS_FPUExcAttachHandler_Impl(uint32 ExceptionNumber, void * ExceptionHandler, +int32 OS_FPUExcAttachHandler_Impl(uint32 ExceptionNumber, osal_task_entry ExceptionHandler, int32 parameter); int32 OS_FPUExcEnable_Impl(int32 ExceptionNumber); int32 OS_FPUExcDisable_Impl(int32 ExceptionNumber); diff --git a/src/os/shared/osapi-fpu.c b/src/os/shared/osapi-fpu.c index 4959b9ff2..48cbddd28 100644 --- a/src/os/shared/osapi-fpu.c +++ b/src/os/shared/osapi-fpu.c @@ -40,7 +40,7 @@ * See description in API and header file for detail * *-----------------------------------------------------------------*/ -int32 OS_FPUExcAttachHandler (uint32 ExceptionNumber, void * ExceptionHandler , +int32 OS_FPUExcAttachHandler (uint32 ExceptionNumber, osal_task_entry ExceptionHandler , int32 parameter) { if (ExceptionHandler == NULL) @@ -76,6 +76,11 @@ int32 OS_FPUExcSetMask(uint32 mask) *-----------------------------------------------------------------*/ int32 OS_FPUExcGetMask(uint32 *mask) { + if (mask == NULL) + { + return OS_INVALID_POINTER; + } + return OS_FPUExcGetMask_Impl(mask); } /* end OS_FPUExcGetMask */ diff --git a/src/os/vxworks/osapi.c b/src/os/vxworks/osapi.c index a7cf8902e..66eeacb9a 100644 --- a/src/os/vxworks/osapi.c +++ b/src/os/vxworks/osapi.c @@ -155,7 +155,7 @@ VX_MUTEX_SEMAPHORE(OS_console_mut_mem); typedef struct { - char * const mem; + void * const mem; SEM_ID vxid; } VxWorks_GlobalMutex_t; @@ -1538,7 +1538,7 @@ int32 OS_IntGetMask_Impl ( uint32 * MaskSettingPtr ) * See prototype in os-impl.h for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_FPUExcAttachHandler_Impl(uint32 ExceptionNumber, void * ExceptionHandler, +int32 OS_FPUExcAttachHandler_Impl(uint32 ExceptionNumber, osal_task_entry ExceptionHandler, int32 parameter) { /* diff --git a/src/os/vxworks/osloader.c b/src/os/vxworks/osloader.c index b95d7a7f1..652a550d8 100644 --- a/src/os/vxworks/osloader.c +++ b/src/os/vxworks/osloader.c @@ -297,7 +297,7 @@ int32 OS_SymbolTableDump_Impl ( const char *local_filename, uint32 SizeLimit ) * See prototype in os-impl.h for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_ModuleLoad_Impl ( uint32 local_id, char *translated_path ) +int32 OS_ModuleLoad_Impl ( uint32 local_id, const char *translated_path ) { int32 return_code; int fd; diff --git a/src/os/vxworks/ostimer.c b/src/os/vxworks/ostimer.c index 9b786ca66..43d1d574a 100644 --- a/src/os/vxworks/ostimer.c +++ b/src/os/vxworks/ostimer.c @@ -469,7 +469,7 @@ int32 OS_TimeBaseCreate_Impl(uint32 timer_id) OSAL_TIMEBASE_TASK_PRIORITY, /* priority */ OSAL_TIMEBASE_TASK_OPTION_WORD, /* task option word */ OSAL_TIMEBASE_TASK_STACK_SIZE, /* size (bytes) of stack needed */ - OS_VxWorks_TimeBaseTask, + (FUNCPTR)OS_VxWorks_TimeBaseTask, global->active_id, /* 1st arg is ID */ 0,0,0,0,0,0,0,0,0); diff --git a/src/tests/sem-speed-test/sem-speed-test.c b/src/tests/sem-speed-test/sem-speed-test.c index 4e828af77..b94171f3a 100644 --- a/src/tests/sem-speed-test/sem-speed-test.c +++ b/src/tests/sem-speed-test/sem-speed-test.c @@ -36,6 +36,25 @@ #include "uttest.h" #include "utbsp.h" +/* + * Note the worker priority must be lower than that of + * the executive (init) task. Otherwise, the SemRun() + * function may may never get CPU time to stop the test. + */ +#define SEMTEST_TASK_PRIORITY 150 + +/* + * A limit for the maximum amount + * of iterations that this test will + * perform. This prevents the test + * from running infinitely in case the + * time-based stop routine does not + * work correctly. See note above + * about priority requirements. + */ +#define SEMTEST_WORK_LIMIT 10000000 + + /* Define setup and test functions for UT assert */ void SemSetup(void); void SemRun(void); @@ -54,8 +73,6 @@ void SemRun(void); */ #define SEMOP(op) SEMCALL(Count,op) -#define TASK_PRIORITY 50 - uint32 task_1_id; uint32 task_1_work; @@ -72,7 +89,7 @@ void task_1(void) OS_printf("Starting task 1\n"); OS_TaskRegister(); - while(1) + while(task_1_work < SEMTEST_WORK_LIMIT) { status = SEMOP(Take)(sem_id_1); if ( status != OS_SUCCESS ) @@ -99,7 +116,7 @@ void task_2(void) OS_printf("Starting task 2\n"); OS_TaskRegister(); - while(1) + while(task_2_work < SEMTEST_WORK_LIMIT) { status = SEMOP(Take)(sem_id_2); if ( status != OS_SUCCESS ) @@ -150,10 +167,10 @@ void SemSetup(void) /* ** Create the tasks */ - status = OS_TaskCreate( &task_1_id, "Task 1", task_1, NULL, 4096, TASK_PRIORITY, 0); + status = OS_TaskCreate( &task_1_id, "Task 1", task_1, NULL, 4096, SEMTEST_TASK_PRIORITY, 0); UtAssert_True(status == OS_SUCCESS, "Task 1 create Id=%u Rc=%d", (unsigned int)task_1_id, (int)status); - status = OS_TaskCreate( &task_2_id, "Task 2", task_2, NULL, 4096, TASK_PRIORITY, 0); + status = OS_TaskCreate( &task_2_id, "Task 2", task_2, NULL, 4096, SEMTEST_TASK_PRIORITY, 0); UtAssert_True(status == OS_SUCCESS, "Task 2 create Id=%u Rc=%d", (unsigned int)task_2_id, (int)status); /* A small delay just to allow the tasks @@ -173,6 +190,9 @@ void SemRun(void) /* ** Delete resources + ** + ** NOTE: if the work limit was reached, the + ** OS_TaskDelete calls may return non-success. */ status = OS_TaskDelete( task_1_id ); UtAssert_True(status == OS_SUCCESS, "Task 1 delete Rc=%d", (int)status); diff --git a/src/unit-test-coverage/shared/src/coveragetest-dir.c b/src/unit-test-coverage/shared/src/coveragetest-dir.c index a7b76a13a..703e6a3ba 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-dir.c +++ b/src/unit-test-coverage/shared/src/coveragetest-dir.c @@ -161,7 +161,7 @@ void Test_OS_readdir(void) os_dirp_t dirp = OS_opendir("Dir"); os_dirent_t *dirent = OS_readdir(dirp); - UtAssert_True(dirent != NULL, "OS_readdir() (%p) != NULL", dirent); + UtAssert_True(dirent != NULL, "OS_readdir() (%p) != NULL", (void*)dirent); } diff --git a/src/unit-test-coverage/shared/src/coveragetest-filesys.c b/src/unit-test-coverage/shared/src/coveragetest-filesys.c index 39aba02f3..f169221de 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-filesys.c +++ b/src/unit-test-coverage/shared/src/coveragetest-filesys.c @@ -70,13 +70,15 @@ void Test_OS_mkfs(void) int32 expected = OS_SUCCESS; int32 actual = ~OS_SUCCESS; - actual = OS_mkfs("adr","/ramdev0","vol",0,0); + char TestBuffer[128]; + + actual = OS_mkfs(TestBuffer,"/ramdev0","vol",0,0); UtAssert_True(actual == expected, "OS_mkfs() (%ld) == OS_SUCCESS", (long)actual); /* * Test an entry NOT found in the OS_VolumeTable */ - actual = OS_mkfs("adr","/rd1","vol1",0,0); + actual = OS_mkfs(TestBuffer,"/rd1","vol1",0,0); UtAssert_True(actual == expected, "OS_mkfs() (%ld) == OS_SUCCESS", (long)actual); @@ -86,25 +88,25 @@ void Test_OS_mkfs(void) UT_SetForceFail(UT_KEY(OCS_strlen), 2 + OS_FS_DEV_NAME_LEN); expected = OS_FS_ERR_PATH_TOO_LONG; - actual = OS_mkfs("adr","/ramdev0","vol",0,0); + actual = OS_mkfs(TestBuffer,"/ramdev0","vol",0,0); UtAssert_True(actual == expected, "OS_mkfs() (%ld) == OS_FS_ERR_PATH_TOO_LONG", (long)actual); UT_ClearForceFail(UT_KEY(OCS_strlen)); /* set up for failure due to empty strings */ expected = OS_FS_ERR_PATH_INVALID; - actual = OS_mkfs("adr","","",0,0); + actual = OS_mkfs(TestBuffer,"","",0,0); UtAssert_True(actual == expected, "OS_mkfs() (%ld) == OS_FS_ERR_PATH_INVALID", (long)actual); /* set up for failure due to formatting */ UT_SetForceFail(UT_KEY(OS_FileSysFormatVolume_Impl), OS_FS_ERR_DRIVE_NOT_CREATED); expected = OS_FS_ERR_DRIVE_NOT_CREATED; - actual = OS_mkfs("adr","/ramdev0","vol",0,0); + actual = OS_mkfs(TestBuffer,"/ramdev0","vol",0,0); UtAssert_True(actual == expected, "OS_mkfs() (%ld) == OS_FS_ERR_DRIVE_NOT_CREATED (format failure)", (long)actual); /* set up for failure due to no free slots */ UT_SetForceFail(UT_KEY(OS_ObjectIdAllocateNew), OS_ERR_NO_FREE_IDS); expected = OS_FS_ERR_DEVICE_NOT_FREE; - actual = OS_mkfs("adr","/ramdev0","vol",0,0); + actual = OS_mkfs(TestBuffer,"/ramdev0","vol",0,0); UtAssert_True(actual == expected, "OS_mkfs() (%ld) == OS_FS_ERR_DEVICE_NOT_FREE", (long)actual); } @@ -148,7 +150,9 @@ void Test_OS_initfs(void) int32 expected = OS_SUCCESS; int32 actual = ~OS_SUCCESS; - actual = OS_initfs("adr","/ramdev0","vol",0,0); + char TestBuffer[128]; + + actual = OS_initfs(TestBuffer,"/ramdev0","vol",0,0); UtAssert_True(actual == expected, "OS_initfs() (%ld) == OS_SUCCESS", (long)actual); actual = OS_initfs(NULL,"/hda2","vol2",0,0); @@ -160,14 +164,14 @@ void Test_OS_initfs(void) UT_SetForceFail(UT_KEY(OCS_strlen), 2 + OS_FS_DEV_NAME_LEN); expected = OS_FS_ERR_PATH_TOO_LONG; - actual = OS_initfs("adr","/ramdev0","vol",0,0); + actual = OS_initfs(TestBuffer,"/ramdev0","vol",0,0); UtAssert_True(actual == expected, "OS_initfs() (%ld) == OS_FS_ERR_PATH_TOO_LONG", (long)actual); UT_ClearForceFail(UT_KEY(OCS_strlen)); /* set up for failure */ UT_SetForceFail(UT_KEY(OS_ObjectIdAllocateNew), OS_ERR_NO_FREE_IDS); expected = OS_FS_ERR_DEVICE_NOT_FREE; - actual = OS_initfs("adr","/ramdev0","vol",0,0); + actual = OS_initfs(TestBuffer,"/ramdev0","vol",0,0); UtAssert_True(actual == expected, "OS_initfs() (%ld) == OS_FS_ERR_DEVICE_NOT_FREE", (long)actual); } diff --git a/src/unit-test-coverage/shared/src/coveragetest-idmap.c b/src/unit-test-coverage/shared/src/coveragetest-idmap.c index 82fc67216..c8a2f1cf0 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-idmap.c +++ b/src/unit-test-coverage/shared/src/coveragetest-idmap.c @@ -368,7 +368,7 @@ void Test_OS_ObjectIdGetById(void) /* Verify Outputs */ UtAssert_True(actual == expected, "OS_ObjectIdGetById() (%ld) == OS_SUCCESS", (long)actual); UtAssert_True(local_idx == 1, "local_idx (%lu) == 1", (unsigned long)local_idx); - UtAssert_True(rptr != NULL, "rptr (%p) != NULL", rptr); + UtAssert_True(rptr != NULL, "rptr (%p) != NULL", (void*)rptr); UtAssert_True(rptr->refcount == 1, "refcount (%u) == 1", (unsigned int)rptr->refcount); @@ -517,7 +517,7 @@ void Test_OS_ObjectIdFindNext(void) } if (rec1 == rec2) { - UtAssert_Failed("OS_ObjectIdFindNext() duplicate slot (%p)", rec1); + UtAssert_Failed("OS_ObjectIdFindNext() duplicate slot (%p)", (void*)rec1); break; } @@ -556,7 +556,7 @@ void Test_OS_ObjectIdAllocateNew(void) /* Verify Outputs */ UtAssert_True(actual == expected, "OS_ObjectIdAllocate() (%ld) == OS_SUCCESS", (long)actual); - UtAssert_True(rptr != NULL, "rptr (%p) != NULL", rptr); + UtAssert_True(rptr != NULL, "rptr (%p) != NULL", (void*)rptr); /* Passing a NULL name also should work here (used for internal objects) */ actual = OS_ObjectIdAllocateNew(OS_OBJECT_TYPE_OS_TASK, NULL, &objid, &rptr); diff --git a/src/unit-test-coverage/shared/src/coveragetest-task.c b/src/unit-test-coverage/shared/src/coveragetest-task.c index d4dbb8dfe..7ea1fdf79 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-task.c +++ b/src/unit-test-coverage/shared/src/coveragetest-task.c @@ -280,8 +280,9 @@ void Test_OS_TaskInstallDeleteHandler(void) UT_SetForceFail(UT_KEY(OS_TaskGetId_Impl), 1); actual = OS_TaskInstallDeleteHandler(UT_TestHook); UtAssert_True(actual == expected, "OS_TaskInstallDeleteHandler() (%ld) == OS_SUCCESS", (long)actual); - UtAssert_True(OS_task_table[1].delete_hook_pointer == UT_TestHook, "OS_task_table[1].delete_hook_pointer (%p) == %p", - OS_task_table[1].delete_hook_pointer, UT_TestHook); + UtAssert_True(OS_task_table[1].delete_hook_pointer == UT_TestHook, "OS_task_table[1].delete_hook_pointer (%lx) == %lx", + (unsigned long)OS_task_table[1].delete_hook_pointer, + (unsigned long)UT_TestHook); OS_task_table[1].delete_hook_pointer = NULL; } diff --git a/src/unit-test-coverage/shared/src/coveragetest-time.c b/src/unit-test-coverage/shared/src/coveragetest-time.c index 4e354bbfe..b0a25b234 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-time.c +++ b/src/unit-test-coverage/shared/src/coveragetest-time.c @@ -113,9 +113,9 @@ void Test_OS_TimerCreate(void) OS_ObjectIdToArrayIndex(OS_OBJECT_TYPE_OS_TIMECB, objid, &local_id); UtAssert_True(OS_timecb_table[local_id].callback_ptr != NULL, - "OS_timecb_table[%lu].callback_ptr (%p) != NULL", + "OS_timecb_table[%lu].callback_ptr (%lx) != NULL", (unsigned long)local_id, - OS_timecb_table[local_id].callback_ptr); + (unsigned long)OS_timecb_table[local_id].callback_ptr); UT_TimerCount = 0; OS_timecb_table[local_id].callback_ptr(objid, OS_timecb_table[local_id].callback_arg); diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-base-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-base-impl-stubs.c index 78a681061..cb660a5a0 100644 --- a/src/unit-test-coverage/ut-stubs/src/osapi-base-impl-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/osapi-base-impl-stubs.c @@ -163,7 +163,7 @@ UT_DEFAULT_STUB(OS_HeapGetInfo_Impl,(OS_heap_prop_t *heap_prop)) /* * FPU API low-level handlers */ -UT_DEFAULT_STUB(OS_FPUExcAttachHandler_Impl,(uint32 ExceptionNumber, void * ExceptionHandler,int32 parameter)) +UT_DEFAULT_STUB(OS_FPUExcAttachHandler_Impl,(uint32 ExceptionNumber, osal_task_entry ExceptionHandler,int32 parameter)) UT_DEFAULT_STUB(OS_FPUExcEnable_Impl,(int32 ExceptionNumber)) UT_DEFAULT_STUB(OS_FPUExcDisable_Impl,(int32 ExceptionNumber)) UT_DEFAULT_STUB(OS_FPUExcSetMask_Impl,(uint32 mask)) diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-loader-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-loader-impl-stubs.c index 33ebe8f28..8e9a4aa9e 100644 --- a/src/unit-test-coverage/ut-stubs/src/osapi-loader-impl-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/osapi-loader-impl-stubs.c @@ -17,7 +17,7 @@ /* * Module Loader API */ -UT_DEFAULT_STUB(OS_ModuleLoad_Impl,( uint32 module_id, char *translated_path )) +UT_DEFAULT_STUB(OS_ModuleLoad_Impl,( uint32 module_id, const char *translated_path )) UT_DEFAULT_STUB(OS_ModuleUnload_Impl,( uint32 module_id )) UT_DEFAULT_STUB(OS_ModuleGetInfo_Impl,( uint32 module_id, OS_module_prop_t *module_prop )) UT_DEFAULT_STUB(OS_SymbolLookup_Impl,( cpuaddr *SymbolAddress, const char *SymbolName )) diff --git a/src/unit-test-coverage/ut-stubs/src/posix-time-stubs.c b/src/unit-test-coverage/ut-stubs/src/posix-time-stubs.c index 094afa0a9..530cc6e73 100644 --- a/src/unit-test-coverage/ut-stubs/src/posix-time-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/posix-time-stubs.c @@ -71,6 +71,10 @@ int OCS_timer_settime (OCS_timer_t timerid, int flags, const struct OCS_itimersp int32 Status; Status = UT_DEFAULT_IMPL(OCS_timer_settime); + if (Status == 0) + { + UT_Stub_CopyFromLocal(UT_KEY(OCS_timer_settime), value, sizeof(*value)); + } return Status; } diff --git a/src/unit-test-coverage/vxworks/modules/inc/ut-osloader.h b/src/unit-test-coverage/vxworks/modules/inc/ut-osloader.h index f0f7a9630..00da55ee1 100644 --- a/src/unit-test-coverage/vxworks/modules/inc/ut-osloader.h +++ b/src/unit-test-coverage/vxworks/modules/inc/ut-osloader.h @@ -24,7 +24,7 @@ int32 OS_VxWorks_ModuleAPI_Impl_Init(void); * Invokes OS_SymTableIterator_Impl() with the given arguments. * This is normally a static function but exposed via a non-static wrapper for UT purposes. */ -int32 Osapi_Internal_CallIteratorFunc(char *name, void* val, uint32 TestSize, uint32 SizeLimit); +int32 Osapi_Internal_CallIteratorFunc(const char *name, void* val, uint32 TestSize, uint32 SizeLimit); #endif /* _OSAL_UT_OSLOADER_H_ */ diff --git a/src/unit-test-coverage/vxworks/modules/src/ut-osloader.c b/src/unit-test-coverage/vxworks/modules/src/ut-osloader.c index 313ad1c69..4f8970e3f 100644 --- a/src/unit-test-coverage/vxworks/modules/src/ut-osloader.c +++ b/src/unit-test-coverage/vxworks/modules/src/ut-osloader.c @@ -19,10 +19,15 @@ OS_SharedGlobalVars_t OS_SharedGlobalVars = * A UT-specific wrapper function to invoke the Symbol Table Iterator. * This is normally static so it needs this wrapper to call it. */ -int32 Osapi_Internal_CallIteratorFunc(char *name, void* val, uint32 TestSize, uint32 SizeLimit) +int32 Osapi_Internal_CallIteratorFunc(const char *name, void* val, uint32 TestSize, uint32 SizeLimit) { OS_impl_module_global.sym_dump.Sizelimit = SizeLimit; OS_impl_module_global.sym_dump.CurrSize = TestSize; - return OS_SymTableIterator_Impl(name,val,0,0,0); + /* + * note the internal function is takes a name declared as "char*" to be + * consistent with the VxWorks API, however the implementation does not + * modify this argument. + */ + return OS_SymTableIterator_Impl((char*)name,val,0,0,0); } diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-osfilesys.c b/src/unit-test-coverage/vxworks/src/coveragetest-osfilesys.c index 84dcb8af6..648f328df 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-osfilesys.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-osfilesys.c @@ -62,8 +62,6 @@ void Test_OS_FileSysStartVolume_Impl(void) OSAPI_TEST_FUNCTION_RC(OS_FileSysStartVolume_Impl(1), OS_FS_ERR_DRIVE_NOT_CREATED); } - -; void Test_OS_FileSysStopVolume_Impl(void) { /* Test Case For: diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-ostimer.c b/src/unit-test-coverage/vxworks/src/coveragetest-ostimer.c index c729379ca..32e60c8ba 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-ostimer.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-ostimer.c @@ -150,18 +150,24 @@ void Test_OS_VxWorks_SigWait(void) * (invocation of static function through a wrapper) */ int signo = OCS_SIGRTMIN; + struct OCS_itimerspec config_value; OS_global_timebase_table[0].active_id = 0x12345; OS_timebase_table[0].nominal_start_time = 8888; OS_timebase_table[0].nominal_interval_time = 5555; + memset(&config_value, 0, sizeof(config_value)); + UT_SetDataBuffer(UT_KEY(OCS_timer_settime),&config_value,sizeof(config_value),false); + UT_SetDataBuffer(UT_KEY(OCS_timer_gettime),&config_value,sizeof(config_value),false); Osapi_Internal_Setup(0, signo, true); + OS_TimeBaseSet_Impl(0, 1111111, 2222222); + UT_SetDataBuffer(UT_KEY(OCS_sigwait),&signo,sizeof(signo),false); - OSAPI_TEST_FUNCTION_RC(Osapi_Internal_CallSigWaitFunc(0), 8888); + OSAPI_TEST_FUNCTION_RC(Osapi_Internal_CallSigWaitFunc(0), 1111111); UT_SetDataBuffer(UT_KEY(OCS_sigwait),&signo,sizeof(signo),false); - OSAPI_TEST_FUNCTION_RC(Osapi_Internal_CallSigWaitFunc(0), 5555); + OSAPI_TEST_FUNCTION_RC(Osapi_Internal_CallSigWaitFunc(0), 2222222); UT_SetDataBuffer(UT_KEY(OCS_sigwait),&signo,sizeof(signo),false); - OSAPI_TEST_FUNCTION_RC(Osapi_Internal_CallSigWaitFunc(0), 5555); + OSAPI_TEST_FUNCTION_RC(Osapi_Internal_CallSigWaitFunc(0), 2222222); Osapi_Internal_Setup(0, 0, false); OS_global_timebase_table[0].active_id = 0; 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 -**================================================================================*/ diff --git a/src/ut-stubs/osapi-utstub-file.c b/src/ut-stubs/osapi-utstub-file.c index 15e9ae1ff..fb4805df3 100644 --- a/src/ut-stubs/osapi-utstub-file.c +++ b/src/ut-stubs/osapi-utstub-file.c @@ -105,7 +105,7 @@ static int32 UT_GenericWriteStub(const char *fname, UT_EntryKey_t fkey, const vo *****************************************************************************/ int32 OS_creat(const char *path, int32 access) { - int32 status = OS_SUCCESS; + int32 status; status = UT_DEFAULT_IMPL(OS_creat); @@ -144,7 +144,7 @@ int32 OS_open(const char *path, int32 access, uint32 mode) *****************************************************************************/ int32 OS_close(uint32 filedes) { - int32 status = OS_FS_SUCCESS; + int32 status; status = UT_DEFAULT_IMPL(OS_close); diff --git a/src/ut-stubs/osapi-utstub-fpu.c b/src/ut-stubs/osapi-utstub-fpu.c index 85a43d249..16000e9cd 100644 --- a/src/ut-stubs/osapi-utstub-fpu.c +++ b/src/ut-stubs/osapi-utstub-fpu.c @@ -30,14 +30,12 @@ * Stub function for OS_FPUExcAttachHandler() * *****************************************************************************/ -int32 OS_FPUExcAttachHandler (uint32 ExceptionNumber, void * ExceptionHandler , +int32 OS_FPUExcAttachHandler (uint32 ExceptionNumber, osal_task_entry ExceptionHandler , int32 parameter) { int32 status; - UT_Stub_RegisterContext(UT_KEY(OS_FPUExcAttachHandler), ExceptionHandler); - - status = UT_DEFAULT_IMPL(OS_FPUExcAttachHandler); + status = UT_DEFAULT_IMPL_ARGS(OS_FPUExcAttachHandler, ExceptionNumber, ExceptionHandler, parameter); return status; } diff --git a/src/ut-stubs/osapi-utstub-mutex.c b/src/ut-stubs/osapi-utstub-mutex.c index c1c89435a..901ab0ef5 100644 --- a/src/ut-stubs/osapi-utstub-mutex.c +++ b/src/ut-stubs/osapi-utstub-mutex.c @@ -124,7 +124,7 @@ int32 OS_MutSemDelete(uint32 sem_id) ******************************************************************************/ int32 OS_MutSemGive(uint32 sem_id) { - int32 status = OS_SUCCESS; + int32 status; status = UT_DEFAULT_IMPL(OS_MutSemGive); @@ -153,7 +153,7 @@ int32 OS_MutSemGive(uint32 sem_id) ******************************************************************************/ int32 OS_MutSemTake(uint32 sem_id) { - int32 status = OS_SUCCESS; + int32 status; status = UT_DEFAULT_IMPL(OS_MutSemTake); diff --git a/src/ut-stubs/osapi-utstub-queue.c b/src/ut-stubs/osapi-utstub-queue.c index 67e72ea36..9d3ff5e38 100644 --- a/src/ut-stubs/osapi-utstub-queue.c +++ b/src/ut-stubs/osapi-utstub-queue.c @@ -58,7 +58,7 @@ int32 OS_QueueCreate(uint32 *queue_id, uint32 data_size, uint32 flags) { - int32 status = OS_SUCCESS; + int32 status; status = UT_DEFAULT_IMPL(OS_QueueCreate); @@ -99,7 +99,7 @@ int32 OS_QueueCreate(uint32 *queue_id, ******************************************************************************/ int32 OS_QueueDelete(uint32 queue_id) { - int32 status = OS_SUCCESS; + int32 status; status = UT_DEFAULT_IMPL(OS_QueueDelete); @@ -142,7 +142,7 @@ int32 OS_QueueGet(uint32 queue_id, uint32 *size_copied, int32 timeout) { - int32 status = OS_SUCCESS; + int32 status; status = UT_DEFAULT_IMPL(OS_QueueGet); @@ -183,7 +183,7 @@ int32 OS_QueueGet(uint32 queue_id, ******************************************************************************/ int32 OS_QueuePut(uint32 queue_id, const void *data, uint32 size, uint32 flags) { - int32 status = OS_SUCCESS; + int32 status; status = UT_DEFAULT_IMPL(OS_QueuePut); diff --git a/src/ut-stubs/osapi-utstub-task.c b/src/ut-stubs/osapi-utstub-task.c index 5ada589e6..8b6747748 100644 --- a/src/ut-stubs/osapi-utstub-task.c +++ b/src/ut-stubs/osapi-utstub-task.c @@ -49,7 +49,7 @@ int32 OS_TaskCreate(uint32 *task_id, const char *task_name, uint32 stack_size, uint32 priority, uint32 flags) { - int32 status = OS_SUCCESS; + int32 status; UT_Stub_RegisterContext(UT_KEY(OS_TaskCreate), &function_pointer); UT_Stub_RegisterContext(UT_KEY(OS_TaskCreate), stack_pointer); @@ -154,7 +154,7 @@ int32 OS_TaskDelay(uint32 millisecond) *****************************************************************************/ int32 OS_TaskSetPriority (uint32 task_id, uint32 new_priority) { - int32 status = OS_SUCCESS; + int32 status; status = UT_DEFAULT_IMPL(OS_TaskSetPriority); @@ -179,7 +179,7 @@ int32 OS_TaskSetPriority (uint32 task_id, uint32 new_priority) ******************************************************************************/ int32 OS_TaskRegister(void) { - int32 status = OS_SUCCESS; + int32 status; status = UT_DEFAULT_IMPL(OS_TaskRegister); diff --git a/src/ut-stubs/utstub-helpers.c b/src/ut-stubs/utstub-helpers.c index 80ef18168..11147cc53 100644 --- a/src/ut-stubs/utstub-helpers.c +++ b/src/ut-stubs/utstub-helpers.c @@ -182,7 +182,6 @@ void UT_CheckForOpenSockets(void) UT_ObjTypeState_t *StatePtr; uint32 i; uint32 id; - uint32 InUse = 0; StatePtr = &UT_ObjState[UT_OBJTYPE_QUEUE]; for (i=0; i <= StatePtr->LastIssueNumber; ++i) @@ -191,10 +190,11 @@ void UT_CheckForOpenSockets(void) { id = i; UT_FIXUP_ID(id, UT_OBJTYPE_QUEUE); + UtAssert_Failed("UT_Queue %d left open. ID=%x\n", (int)i, (unsigned int)id); - ++InUse; } } + }