Skip to content

Commit

Permalink
Fix #1432, Remove redundant SemGetInfo functional testing
Browse files Browse the repository at this point in the history
  • Loading branch information
skliper committed Jan 10, 2024
1 parent 46c65e6 commit 0f54ccc
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 411 deletions.
291 changes: 0 additions & 291 deletions src/tests/bin-sem-flush-test/bin-sem-flush-test.c

This file was deleted.

45 changes: 11 additions & 34 deletions src/tests/bin-sem-timeout-test/bin-sem-timeout-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,6 @@ void TimerFunction(osal_id_t local_timer_id)
{
++timer_function_failures;
}

{
status = OS_BinSemGetInfo(bin_sem_id, &bin_sem_prop);
if (status != OS_SUCCESS)
{
++timer_function_failures;
}
else if (bin_sem_prop.value > 1)
{
++timer_function_failures;
}
else if (bin_sem_prop.value < -1)
{
++timer_function_failures;
}
}
}

void task_1(void)
Expand All @@ -115,20 +99,18 @@ void task_1(void)
{
OS_printf("TASK 1: Doing some work: %d\n", (int)counter++);
status = OS_BinSemGetInfo(bin_sem_id, &bin_sem_prop);
if (status != OS_SUCCESS)
{
OS_printf("Error: OS_BinSemGetInfo\n");
++task_1_failures;
}
else if (bin_sem_prop.value > 1)
if (status == OS_SUCCESS)
{
OS_printf("Error: Binary sem value > 1 ( in task):%d !\n", (int)bin_sem_prop.value);
++task_1_failures;
}
else if (bin_sem_prop.value < -1)
{
OS_printf("Error: Binary sem value < -1 ( in task):%d !\n", (int)bin_sem_prop.value);
++task_1_failures;
if (bin_sem_prop.value > 1)
{
OS_printf("Error: Binary sem value > 1 ( in task):%d !\n", (int)bin_sem_prop.value);
++task_1_failures;
}
else if (bin_sem_prop.value < -1)
{
OS_printf("Error: Binary sem value < -1 ( in task):%d !\n", (int)bin_sem_prop.value);
++task_1_failures;
}
}
}
else if (status == OS_SEM_TIMEOUT)
Expand Down Expand Up @@ -211,16 +193,11 @@ void BinSemTimeoutSetup(void)
status = OS_BinSemCreate(&bin_sem_id, "BinSem1", 1, 0);
UtAssert_True(status == OS_SUCCESS, "BinSem1 create Id=%lx Rc=%d", OS_ObjectIdToInteger(bin_sem_id), (int)status);

status = OS_BinSemGetInfo(bin_sem_id, &bin_sem_prop);
UtAssert_True(status == OS_SUCCESS, "BinSem1 value=%d Rc=%d", (int)bin_sem_prop.value, (int)status);

/*
** Take the semaphore so the value is 0 and the next SemTake call should block
*/
status = OS_BinSemTake(bin_sem_id);
UtAssert_True(status == OS_SUCCESS, "BinSem1 take Rc=%d", (int)status);
status = OS_BinSemGetInfo(bin_sem_id, &bin_sem_prop);
UtAssert_True(status == OS_SUCCESS, "BinSem1 value=%d Rc=%d", (int)bin_sem_prop.value, (int)status);

/*
** Create the "consumer" task.
Expand Down
Loading

0 comments on commit 0f54ccc

Please # to comment.