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 #373, Add OSAL network APIs missing functional tests and fix #378 OS_TimedRead and OS_TimedWrite missing functional tests #549

Conversation

yammajamma
Copy link
Contributor

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

@yammajamma
Copy link
Contributor Author

@jphickey @skliper please review.

Copy link
Contributor

@jphickey jphickey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

char Buf2;
char Buf3 = 'B';
char Buf4;
uint16 PortNum;

This comment was marked as resolved.


/* 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.

/* 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.

/* 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.

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.


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.

*/
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.

int32 status;
uint32 loopcnt;
s_socket_id = 0;
expected = OS_SUCCESS;

This comment was marked as resolved.

#define UT_EXIT_LOOP_MAX 100

int32 expected;
int32 actual;

This comment was marked as resolved.

Copy link
Contributor

@jphickey jphickey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

src/tests/network-api-test/network-api-test.c Show resolved Hide resolved
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.

@astrogeco astrogeco added CCB:Ready Pull request is ready for discussion at the Configuration Control Board (CCB) CCB-20200805 labels Aug 5, 2020
Copy link
Contributor

@skliper skliper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean out commented code

@astrogeco
Copy link
Contributor

CCB 2020-08-05 APPROVED, @jphickey will work with @yammajamma to clean up some parts of the tests.

@astrogeco astrogeco removed the CCB:Ready Pull request is ready for discussion at the Configuration Control Board (CCB) label Aug 12, 2020
@astrogeco astrogeco marked this pull request as draft August 14, 2020 00:09
@astrogeco
Copy link
Contributor

Converted to draft until comments are addressed

@yammajamma
Copy link
Contributor Author

@astrogeco all comments have been addressed.

@astrogeco astrogeco marked this pull request as ready for review August 18, 2020 14:45
@astrogeco astrogeco added the CCB:Approved Indicates code review and approval by community CCB label Aug 18, 2020
@astrogeco astrogeco changed the base branch from master to integration-candidate August 18, 2020 14:46
@astrogeco astrogeco dismissed jphickey’s stale review August 18, 2020 14:46

Changes addressed in last set of commits

@astrogeco astrogeco merged commit 187b424 into nasa:integration-candidate Aug 18, 2020
@skliper skliper added this to the 6.0.0 milestone Aug 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CCB:Approved Indicates code review and approval by community CCB
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OS_TimedRead and OS_TimedWrite missing functional tests OSAL network APIs missing functional tests
4 participants