Skip to content

Commit

Permalink
Fix nasa#1024, check misc API return codes
Browse files Browse the repository at this point in the history
Fix missing doxygen retvals

Note, other tests were OK, but depend on support being enabled and
supported by RTOS.  Script will report N/A items (due to no impl) as
missing.  Confirmed OS_HeapGetInfo OK on RTEMS.
  • Loading branch information
jphickey committed May 19, 2021
1 parent 1d183e9 commit 327b181
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/os/inc/osapi-heap.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ typedef struct
* @param[out] heap_prop Storage buffer for heap info
*
* @return Execution status, see @ref OSReturnCodes
* @retval #OS_SUCCESS @copybrief OS_SUCCESS
* @retval #OS_INVALID_POINTER if the heap_prop argument is NULL
*/
int32 OS_HeapGetInfo(OS_heap_prop_t *heap_prop);
Expand Down
1 change: 1 addition & 0 deletions src/os/inc/osapi-network.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ int32 OS_NetworkGetID(void);
* @param[in] name_len Maximum length of host name buffer
*
* @return Execution status, see @ref OSReturnCodes
* @retval #OS_SUCCESS @copybrief OS_SUCCESS
* @retval #OS_ERR_INVALID_SIZE if the name_len is zero
* @retval #OS_INVALID_POINTER if the host_name is NULL
*/
Expand Down
12 changes: 2 additions & 10 deletions src/unit-tests/oscore-test/ut_oscore_misc_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,23 +418,15 @@ void UT_os_heapgetinfo_test(void)
{
OS_heap_prop_t heapProp;

/*-----------------------------------------------------*/
/* API not implemented */

if (!UT_IMPL(OS_HeapGetInfo(&heapProp)))
{
return;
}

/*-----------------------------------------------------*/
/* #1 Null-pointer-arg */

UT_RETVAL(OS_HeapGetInfo(NULL), OS_INVALID_POINTER);

/*-----------------------------------------------------*/
/* #3 Nominal */
/* #3 Nominal (allows for not implemented) */

UT_NOMINAL(OS_HeapGetInfo(&heapProp));
UT_NOMINAL_OR_NOTIMPL(OS_HeapGetInfo(&heapProp));
}

/*================================================================================*
Expand Down
8 changes: 8 additions & 0 deletions src/unit-tests/osfile-test/ut_osfile_fileio_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1421,6 +1421,14 @@ void UT_os_outputtofile_test()
UtAssert_True(strstr(g_readBuff, "UT_os_outputtofile_test") != NULL,
"Output file contains UT_os_outputtofile_test");
}

/*
* Executing a command name "false" should fail, either because it is not a known
* command, or if it is valid (e.g. a UNIX-like environment has /bin/false) the
* command always fails.
*/
UT_RETVAL(OS_ShellOutputToFile("false", g_fDescs[0]), OS_ERROR);

}

/* Reset test environment */
Expand Down

0 comments on commit 327b181

Please sign in to comment.