Skip to content

Commit

Permalink
Fix nasa#1404, skip condvar tests if not implemented
Browse files Browse the repository at this point in the history
This reports that the functionality is not implemented and reports it as
an MIR result, instead of having most/all of the tests fail.
  • Loading branch information
jphickey committed Aug 18, 2023
1 parent f11fc4d commit 6d1ef70
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 6d1ef70

Please sign in to comment.