Skip to content

Improve consistency in the result reporting in "unit-tests" #981

@jphickey

Description

@jphickey

Is your feature request related to a problem? Please describe.
In order to be able to cross check and confirm that the unit tests are actually checking for the status codes that they should be, the test cases need to be clear about the API being called and the return value/status code being tested for in that test case. However, the functional tests are currently not consistent in how results are reported.

Describe the solution you'd like
Example from the binsem test, which is better because it at least uses a macro that includes both the function name/API being called (OS_BinSemCreate) as well as the status code being tested for (OS_INVALID_POINTER):

UT_RETVAL(OS_BinSemCreate(&sem_ids[0], NULL, 1, 0), OS_INVALID_POINTER, "null pointer arg 2");

Which translates to a line like this in the log file:
[ PASS] 05.002 ut_oscore_binsem_test.c:84 - OS_BinSemCreate(&sem_ids[0], NULL, 1, 0) (-2) == OS_INVALID_POINTER (-2): null pointer arg 2

However a similar test case from OS_ModuleLoad displays neither:

testDesc = "#2 Null-pointer-arg-2";
res = OS_ModuleLoad(&module_id, 0, UT_OS_GENERIC_MODULE_NAME1, OS_MODULE_FLAG_LOCAL_SYMBOLS);
if (res == OS_INVALID_POINTER)
UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS);
else
UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_FAILURE);

The latter translates only to a line like this in the log file, which doesn't say much at all:
[ PASS] 01.002 ut_osloader_module_test.c:103 - #2 Null-pointer-arg-2

A clear and concise description of what you want to happen.

Additional context
This is a prerequisite to completing #331 - The information in the log file needs to be made more like the BinSem case, so it can be cross referenced back to confirm the functional tests are checking for the items they are supposed to be checking for.

Requester Info
Joseph Hickey, Vantage Systems, Inc.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions