Skip to content

Commit

Permalink
Fix nasa#171, add teardown at end of tests
Browse files Browse the repository at this point in the history
Invoke OS_API_Teardown to reset state for next test
  • Loading branch information
jphickey committed Apr 7, 2021
1 parent 35e7b04 commit c7a8de0
Show file tree
Hide file tree
Showing 24 changed files with 72 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/tests/bin-sem-flush-test/bin-sem-flush-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ void UtTest_Setup(void)
UtAssert_Abort("OS_API_Init() failed");
}

/* the test should call OS_API_Teardown() before exiting */
UtTest_AddTeardown(OS_API_Teardown, "Cleanup");

/*
* Register the test setup and check routines in UT assert
*/
Expand Down
3 changes: 3 additions & 0 deletions src/tests/bin-sem-test/bin-sem-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ void UtTest_Setup(void)
UtAssert_Abort("OS_API_Init() failed");
}

/* the test should call OS_API_Teardown() before exiting */
UtTest_AddTeardown(OS_API_Teardown, "Cleanup");

/*
* Register the test setup and check routines in UT assert
*/
Expand Down
3 changes: 3 additions & 0 deletions src/tests/bin-sem-timeout-test/bin-sem-timeout-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ void UtTest_Setup(void)
UtAssert_Abort("OS_API_Init() failed");
}

/* the test should call OS_API_Teardown() before exiting */
UtTest_AddTeardown(OS_API_Teardown, "Cleanup");

/*
* Register the test setup and check routines in UT assert
*/
Expand Down
3 changes: 3 additions & 0 deletions src/tests/count-sem-test/count-sem-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ void UtTest_Setup(void)
UtAssert_Abort("OS_API_Init() failed");
}

/* the test should call OS_API_Teardown() before exiting */
UtTest_AddTeardown(OS_API_Teardown, "Cleanup");

/*
* Register the test setup and check routines in UT assert
*/
Expand Down
3 changes: 3 additions & 0 deletions src/tests/file-api-test/file-api-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ void UtTest_Setup(void)
UtAssert_Abort("OS_API_Init() failed");
}

/* the test should call OS_API_Teardown() before exiting */
UtTest_AddTeardown(OS_API_Teardown, "Cleanup");

/*
* This test case requires a fixed virtual dir for one test case.
* Just map /test to a dir of the same name, relative to current dir.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ void UtTest_Setup(void)
UtAssert_Abort("OS_API_Init() failed");
}

/* the test should call OS_API_Teardown() before exiting */
UtTest_AddTeardown(OS_API_Teardown, "Cleanup");

/*
* Register the test setup and check routines in UT assert
*/
Expand Down
3 changes: 3 additions & 0 deletions src/tests/idmap-api-test/idmap-api-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,9 @@ void UtTest_Setup(void)
UtAssert_Abort("OS_API_Init() failed");
}

/* the test should call OS_API_Teardown() before exiting */
UtTest_AddTeardown(OS_API_Teardown, "Cleanup");

/*
* Register the test setup and check routines in UT assert
*/
Expand Down
3 changes: 3 additions & 0 deletions src/tests/mutex-test/mutex-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ void UtTest_Setup(void)
UtAssert_Abort("OS_API_Init() failed");
}

/* the test should call OS_API_Teardown() before exiting */
UtTest_AddTeardown(OS_API_Teardown, "Cleanup");

/*
* Register the test setup and check routines in UT assert
*/
Expand Down
3 changes: 3 additions & 0 deletions src/tests/network-api-test/network-api-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,9 @@ void UtTest_Setup(void)
UtAssert_Abort("OS_API_Init() failed");
}

/* the test should call OS_API_Teardown() before exiting */
UtTest_AddTeardown(OS_API_Teardown, "Cleanup");

/*
* Register the test setup and check routines in UT assert
*/
Expand Down
3 changes: 3 additions & 0 deletions src/tests/osal-core-test/osal-core-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ void UtTest_Setup(void)
UtAssert_Abort("OS_API_Init() failed");
}

/* the test should call OS_API_Teardown() before exiting */
UtTest_AddTeardown(OS_API_Teardown, "Cleanup");

UtTest_Add(TestTasks, NULL, NULL, "TASK");
UtTest_Add(TestQueues, NULL, NULL, "MSGQ");
UtTest_Add(TestBinaries, NULL, NULL, "BSEM");
Expand Down
3 changes: 3 additions & 0 deletions src/tests/queue-test/queue-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ void UtTest_Setup(void)
UtAssert_Abort("OS_API_Init() failed");
}

/* the test should call OS_API_Teardown() before exiting */
UtTest_AddTeardown(OS_API_Teardown, "Cleanup");

/*
* Register the test setup and check routines in UT assert
*/
Expand Down
3 changes: 3 additions & 0 deletions src/tests/select-test/select-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,9 @@ void UtTest_Setup(void)
UtAssert_Abort("OS_API_Init() failed");
}

/* the test should call OS_API_Teardown() before exiting */
UtTest_AddTeardown(OS_API_Teardown, "Cleanup");

/*
* Register the test setup and check routines in UT assert
*/
Expand Down
3 changes: 3 additions & 0 deletions src/tests/sem-speed-test/sem-speed-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ void UtTest_Setup(void)
UtAssert_Abort("OS_API_Init() failed");
}

/* the test should call OS_API_Teardown() before exiting */
UtTest_AddTeardown(OS_API_Teardown, "Cleanup");

/*
* Register the test setup and check routines in UT assert
*/
Expand Down
3 changes: 3 additions & 0 deletions src/tests/shell-test/shell-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ void UtTest_Setup(void)
UtAssert_Abort("OS_API_Init() failed");
}

/* the test should call OS_API_Teardown() before exiting */
UtTest_AddTeardown(OS_API_Teardown, "Cleanup");

/*
* Register the test setup and check routines in UT assert
*/
Expand Down
3 changes: 3 additions & 0 deletions src/tests/symbol-api-test/symbol-api-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ void UtTest_Setup(void)
UtAssert_Abort("OS_API_Init() failed");
}

/* the test should call OS_API_Teardown() before exiting */
UtTest_AddTeardown(OS_API_Teardown, "Cleanup");

/*
* Register the test setup and check routines in UT assert
*/
Expand Down
3 changes: 3 additions & 0 deletions src/tests/time-base-api-test/time-base-api-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,9 @@ void UtTest_Setup(void)
UtAssert_Abort("OS_API_Init() failed");
}

/* the test should call OS_API_Teardown() before exiting */
UtTest_AddTeardown(OS_API_Teardown, "Cleanup");

/*
* Register the test setup and check routines in UT assert
*/
Expand Down
3 changes: 3 additions & 0 deletions src/tests/timer-add-api-test/timer-add-api-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ void UtTest_Setup(void)
UtAssert_Abort("OS_API_Init() failed");
}

/* the test should call OS_API_Teardown() before exiting */
UtTest_AddTeardown(OS_API_Teardown, "Cleanup");

/*
* Register the test setup and check routines in UT assert
*/
Expand Down
3 changes: 3 additions & 0 deletions src/tests/timer-test/timer-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ void UtTest_Setup(void)
UtAssert_Abort("OS_API_Init() failed");
}

/* the test should call OS_API_Teardown() before exiting */
UtTest_AddTeardown(OS_API_Teardown, "Cleanup");

/*
* Register the timer test setup and check routines in UT assert
*/
Expand Down
3 changes: 3 additions & 0 deletions src/unit-tests/oscore-test/ut_oscore_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ void UT_os_init_task_get_info_test()

void UtTest_Setup(void)
{
/* the test should call OS_API_Teardown() before exiting */
UtTest_AddTeardown(OS_API_Teardown, "Cleanup");

UtTest_Add(UT_os_apiinit_test, NULL, NULL, "OS_API_Init");

UtTest_Add(UT_os_printf_test, NULL, NULL, "OS_printf");
Expand Down
3 changes: 3 additions & 0 deletions src/unit-tests/osfile-test/ut_osfile_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ void UT_os_init_file_misc()

void UtTest_Setup(void)
{
/* the test should call OS_API_Teardown() before exiting */
UtTest_AddTeardown(OS_API_Teardown, "Cleanup");

UT_os_initfs_test();

if (UT_os_setup_fs() == OS_SUCCESS)
Expand Down
3 changes: 3 additions & 0 deletions src/unit-tests/osfilesys-test/ut_osfilesys_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ void UtTest_Setup(void)
UtAssert_Abort("OS_API_Init() failed");
}

/* the test should call OS_API_Teardown() before exiting */
UtTest_AddTeardown(OS_API_Teardown, "Cleanup");

UT_os_init_fs_misc();

UtTest_Add(UT_os_makefs_test, NULL, NULL, "OS_mkfs");
Expand Down
3 changes: 3 additions & 0 deletions src/unit-tests/osloader-test/ut_osloader_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ void UtTest_Setup(void)
UtAssert_Abort("OS_API_Init() failed");
}

/* the test should call OS_API_Teardown() before exiting */
UtTest_AddTeardown(OS_API_Teardown, "Cleanup");

/*
* This test needs to load the modules from the filesystem, so
* there must be a virtual path corresponding to the path where
Expand Down
3 changes: 3 additions & 0 deletions src/unit-tests/osnetwork-test/ut_osnetwork_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ void UtTest_Setup(void)
UtAssert_Abort("OS_API_Init() failed");
}

/* the test should call OS_API_Teardown() before exiting */
UtTest_AddTeardown(OS_API_Teardown, "Cleanup");

UtTest_Add(UT_os_networkgetid_test, NULL, NULL, "OS_NetworkGetID");
UtTest_Add(UT_os_networkgethostname_test, NULL, NULL, "OS_NetworkGetHostName");
}
Expand Down
3 changes: 3 additions & 0 deletions src/unit-tests/ostimer-test/ut_ostimer_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ void UtTest_Setup(void)
UtAssert_Abort("OS_API_Init() failed");
}

/* the test should call OS_API_Teardown() before exiting */
UtTest_AddTeardown(OS_API_Teardown, "Cleanup");

UT_os_init_timer_misc();

UtTest_Add(UT_os_timercreate_test, UT_os_setup_timercreate_test, NULL, "OS_TimerCreate");
Expand Down

0 comments on commit c7a8de0

Please sign in to comment.