fix #373, Add OSAL network APIs missing functional tests and fix #378 OS_TimedRead and OS_TimedWrite missing functional tests#549
Conversation
jphickey
left a comment
There was a problem hiding this comment.
First - when I pull this locally and run the test, I am getting two failures:
[ FAIL] 02.014 network-api-test.c:375 - OS_SocketAccept() (0) == OS_SUCCESS
[ FAIL] 02.024 network-api-test.c:516 - OS_SocketConnect() (-35) == OS_ERR_INCORRECT_OBJ_STATE
Other comments noted inline.
| /* OS_SocketOpen */ | ||
| expected = OS_SUCCESS; | ||
| actual = OS_SocketOpen(&socket_id, OS_SocketDomain_INET6, OS_SocketType_DATAGRAM); | ||
| UtAssert_True(actual == expected, "OS_SocketOpen(NULL) (%ld) == OS_SUCCESS", (long)actual); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| char Buf2; | ||
| char Buf3 = 'B'; | ||
| char Buf4; | ||
| uint16 PortNum; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
|
|
||
| /* Recieve data from peer1 to peer2 */ | ||
| expected = sizeof(Buf2); | ||
| actual = OS_SocketRecvFrom(p2_socket_id, &Buf2, 1, &l_addr, 100); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| /* Convert addresses to string and verify data is being sent from the correct address */ | ||
| expected = OS_SUCCESS; | ||
|
|
||
| actual = OS_SocketAddrToString(AddrBuffer1, sizeof(AddrBuffer1), &p2_addr); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| /* Convert addresses to string and verify data is being sent from the correct address */ | ||
| expected = OS_SUCCESS; | ||
|
|
||
| actual = OS_SocketAddrToString(AddrBuffer3, sizeof(AddrBuffer3), &p1_addr); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| UtAssert_True(status == OS_SUCCESS, "OS_TaskCreate() (%ld) == OS_SUCCESS", (long)status); | ||
|
|
||
| /* Connect to a server */ | ||
| actual = OS_SocketConnect(c_socket_id, &s_addr, OS_PEND); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
|
|
||
| actual = OS_TimedRead(connsock_id, Buf_rcv_s, sizeof(Buf_rcv_s), OS_PEND); | ||
| UtAssert_True(actual == status, "OS_TimedRead() (%ld) == %ld",(long)actual, (long)status); | ||
| UtAssert_True(strcmp(Buf_rcv_s,Buf_expected) == 0, "Buf (%s) == Buf_expected (%s)", Buf_rcv_s, Buf_expected); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| */ | ||
| expected = OS_INVALID_POINTER; | ||
| actual = OS_SocketAccept(1, NULL, NULL, 0); | ||
| UtAssert_True(actual == expected, "OS_SocketAccept() (%ld) == OS_INVALID_POINTER", (long)actual); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| int32 status; | ||
| uint32 loopcnt; | ||
| s_socket_id = 0; | ||
| expected = OS_SUCCESS; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| #define UT_EXIT_LOOP_MAX 100 | ||
|
|
||
| int32 expected; | ||
| int32 actual; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
jphickey
left a comment
There was a problem hiding this comment.
Getting there.... still some recommendations to fix up though.
| actual = OS_SocketBind(p2_socket_id, &inv_addr); | ||
| UtAssert_True(actual == expected, "OS_SocketBind() (%ld) == OS_ERR_INCORRECT_OBJ_STATE", (long)actual); | ||
|
|
||
| OS_close(socket_id); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| char Buf_send_c[4] = {0}; | ||
| char Buf_expected[4] ={0}; | ||
| char Buf_rcv_trans[8] = {0}; | ||
| char Buf_expec_trans[8] ={0}; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
skliper
left a comment
There was a problem hiding this comment.
Recommend applying standard formatting - clang-format-10 -i -style=file filename.c. It will clean extra whitespace.
| uint32 connsock_id = 0; | ||
| uint32 iter; | ||
| OS_SockAddr_t addr; | ||
| //char Buf_send_s[4] = {0}; |
|
CCB 2020-08-05 APPROVED, @jphickey will work with @yammajamma to clean up some parts of the tests. |
|
Converted to draft until comments are addressed |
|
@astrogeco all comments have been addressed. |
Changes addressed in last set of commits
fix #373, Add OSAL network APIs missing functional tests
fix #378, OS_TimedRead and OS_TimedWrite missing functional tests
Describe the contribution
Added OSAL network and OS_TimedRead and OS_TimedWrite missing functional tests.
Testing performed
Steps taken to test the contribution:
Standard build and ran unit tests.
System(s) tested on
cFS Dev Server
OS: Ubuntu 18.04
Versions: OSAL 5.0.11.0
Contributor Info
Yasir Majeed Khan
NASA GSFC/Emergent Space