Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1404, skip condvar tests if not implemented #1405

Merged
merged 1 commit into from
Aug 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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");
}
}