Skip to content

Commit

Permalink
Merge pull request nasa#1405 from jphickey/fix-1404-condvar-test
Browse files Browse the repository at this point in the history
Fix nasa#1404, skip condvar tests if not implemented
  • Loading branch information
dzbaker authored Aug 18, 2023
2 parents f11fc4d + 6d1ef70 commit 99e3b40
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions src/tests/condvar-test/condvar-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,20 @@ void CondVarTest_Ops(void)
}
}

bool CondVarTest_CheckImpl(void)
{
int32_t status;
osal_id_t cvid;

status = OS_CondVarCreate(&cvid, "ut", 0);
if (status == OS_SUCCESS)
{
OS_CondVarDelete(cvid);
}

return (status != OS_ERR_NOT_IMPLEMENTED);
}

void UtTest_Setup(void)
{
if (OS_API_Init() != OS_SUCCESS)
Expand All @@ -376,10 +390,17 @@ void UtTest_Setup(void)
/* 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
*/
UtTest_Add(CondVarTest_Ops, NULL, NULL, "CondVarOps");
UtTest_Add(CondVarTest_Execute, CondVarTest_Setup, CondVarTest_Teardown, "CondVarBasic");
UtTest_Add(CondVarTimedWait_Execute, CondVarTimedWait_Setup, CondVarTimedWait_Teardown, "CondVarTimed");
if (CondVarTest_CheckImpl())
{
/*
* Register the test setup and check routines in UT assert
*/
UtTest_Add(CondVarTest_Ops, NULL, NULL, "CondVarOps");
UtTest_Add(CondVarTest_Execute, CondVarTest_Setup, CondVarTest_Teardown, "CondVarBasic");
UtTest_Add(CondVarTimedWait_Execute, CondVarTimedWait_Setup, CondVarTimedWait_Teardown, "CondVarTimed");
}
else
{
UtAssert_MIR("Condition variables not implemented; skipping tests");
}
}

0 comments on commit 99e3b40

Please sign in to comment.