-
Notifications
You must be signed in to change notification settings - Fork 3k
Greentea netsocket more tests #6665
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
Greentea netsocket more tests #6665
Conversation
@kjbracey-arm would you please add DO NOT MERGE-label. There are more test cases to come. @SeppoTakalo, @jarlamsa, @juhaylinen, you can start reviewing if you want but it's not expected. At this stage I just want to make the stuff visible so you can see how things are proceeding. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementation provided by @SeppoTakalo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work. Only IP address is accepted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where this limitation is?
Socket API is perfectly capable of accepting domain names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to figure it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SocketAddress does not resolve names. It is just a placeholder for IP addresses.
Use NetworkInterface::gethostbyname()
or feed the string to Socket
which translates its string through the gethostbyname()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So for example TCPSocket::connect(const char *host, uint16_t port)
does the translation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I just need to remember to make the same change to all netsocket test cases.
Wrong lwIP configuration (#define TCP_QUEUE_OOSEQ 0) was causing the issue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add error handling.
There are multiple cases where you call socket functions without testing the return code.
For example:
get_interface()->gethostbyname(...);
sock->open(...);
sock->connect(...);
sock->close();
Every socket call should be tested and compared against acceptable return values. Not only those that transfer the data, but also ones than translate names or create connection.
TESTS/netsocket/tcp/main.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the TEST_ASSERT()
propagation work in greentea_setup()
?
Are we able to see whether device did not join the network and therefore tests failed to run?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we are able to see if the problem arises from the handler. But there is still need to check the logs.
PS C:\ws\mbed-os> mbedhtrun -f .\BUILD\tests\K64F\ARM\TESTS\netsocket\udp\udp.bin -d D: -p COM14:9600
[1526317024.03][HTST][INF] host test executor ver. 1.2.0
[1526317024.03][HTST][INF] copy image onto target...
1 file(s) copied.
[1526317032.47][MBED][WRN] Target ID not found: Skipping flash check and retry
[1526317032.47][HTST][INF] starting host test process...
[1526317033.09][CONN][INF] starting connection process...
[1526317033.09][CONN][INF] notify event queue about extra 60 sec timeout for serial port pooling
[1526317033.09][CONN][INF] initializing serial port listener...
[1526317033.09][SERI][INF] serial(port=COM14, baudrate=9600, read_timeout=0.01, write_timeout=5)
[1526317033.09][SERI][INF] reset device using 'default' plugin...
[1526317033.11][HTST][INF] setting timeout to: 60 sec
[1526317033.36][SERI][INF] waiting 1.00 sec after reset
[1526317034.36][SERI][INF] wait for it...
[1526317034.36][SERI][TXD] mbedmbedmbedmbedmbedmbedmbedmbedmbedmbed
[1526317034.36][CONN][INF] sending up to 2 __sync packets (specified with --sync=2)
[1526317034.36][CONN][INF] sending preamble '0ea1005b-0e2c-4dec-a15f-c947b6556639'
[1526317034.36][SERI][TXD] {{__sync;0ea1005b-0e2c-4dec-a15f-c947b6556639}}
[1526317034.49][CONN][RXD] mbedmbedmbedmbedmbedmbedmbedmbed
[1526317034.54][CONN][INF] found SYNC in stream: {{__sync;0ea1005b-0e2c-4dec-a15f-c947b6556639}} it is #0 sent, queued...
[1526317034.56][HTST][INF] sync KV found, uuid=0ea1005b-0e2c-4dec-a15f-c947b6556639, timestamp=1526317034.540000
[1526317034.57][CONN][INF] found KV pair in stream: {{__version;1.3.0}}, queued...
[[1526317034.59][HTST][INF] DUT greentea-client version: 1.3.0
1526317034.59][CONN][INF] found KV pair in stream: {{__timeout;120}}, queued...
[1526317034.59][HTST][INF] setting timeout to: 120 sec
[1526317034.62][CONN][INF] found KV pair in stream: {{__host_test_name;default_auto}}, queued...
[1526317034.62][HTST][INF] host test class: '<class 'mbed_host_tests.host_tests.default_auto.DefaultAuto'>'
[1526317034.62][HTST][INF] host test setup() call...
[1526317034.62][HTST][INF] CALLBACKs updated
[1526317034.62][HTST][INF] host test detected: default_auto
[1526317078.79][CONN][RXD] :46::FAIL: Expected 0 Was -3004
[1526317078.86][CONN][RXD] >>> failure with reason 'Assertion Failed' during 'Test Setup Handler'
[1526317078.90][CONN][INF] found KV pair in stream: {{max_heap_usage;0}}, queued...
[[1526317078.91][CONN][INF] found KV pair in stream: {{reserved_heap;0}}, queued...
1526317078.91][HTST][ERR] orphan event in main phase: {{max_heap_usage;0}}, timestamp=1526317078.897000
[1526317078.91][HTST][ERR] orphan event in main phase: {{reserved_heap;0}}, timestamp=1526317078.913000
[1526317078.93][CONN][INF] found KV pair in stream: {{end;failure}}, queued...
[1526317078.94][CONN][INF] found KV pair in stream: {{__exit;0}}, queued...
[1526317078.95][HTST][INF] __exit(0)
[1526317078.95][HTST][INF] __notify_complete(False)
[1526317078.95][HTST][INF] __exit_event_queue received
[1526317078.95][HTST][INF] test suite run finished after 44.36 sec...
[1526317078.96][CONN][INF] received special even '__host_test_finished' value='True', finishing
[1526317078.98][HTST][INF] CONN exited with code: 0
[1526317078.98][HTST][INF] Some events in queue
[1526317078.98][HTST][INF] stopped consuming events
[1526317078.98][HTST][INF] host test result() call skipped, received: False
[1526317078.98][HTST][INF] calling blocking teardown()
[1526317078.98][HTST][INF] teardown() finished
[1526317078.98][HTST][INF] {{result;failure}}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add the required return value checks. I wouldn't prefer not to because it will just add clutter on the test cases and assertions would reveal problems arising during setups. Part of the test is to check that the desired behavior is the result of correct setup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you ignoring the sendto()
failures?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I am because buffer comparison will reveal if data was not transmitted and received - retries are allowed. Checking for errors wouldn't make any difference.
@VeijoPesonen Was there a particular reason why this PR was give a new category? @SeppoTakalo @kjbracey-arm Is the intention to get this in for 5.9? |
@cmonr My changes are not fixes, refactoring of existing code, breaking change to existing code, new features and do not consider new targets. I decided to add a new category to evoke this discussion. I would say there is need to have its own category for test cases. Unless new test case is to be treated like a new feature. |
Please let me know when it's fine to squash those fixup commits. |
It is OK to squash when ever you feel so. And please rebase on top of master. For example:
Once build failures are fixed, ask Kevin to start morph testing for this PR. We need to see which boards start failing. |
Please remove also following tests from the tree:
|
Can we also refactor testcases to follow naming from the test plan? So instead of:
We would use:
That would allow us to publish the test plan without modifications. |
I'll switch the naming convention. I don't see a reason to suppress compiler error for TESTS-NETWORK-WIFI test cases when Ethernet is in use. Maybe it would make more sense to use preprocessor directive explicitly to report an error, or not... |
@VeijoPesonen Also, you need to do the separation of testcase. Currently in both TCP and UDP you have
Which is not what we are aiming for. So remove those. So do the splitting in the
Modify the splitting so that in PR we would run only fast smoke tests that current boards are able to pass. Then later on, in nightly test those extented tests are also enable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use same packet ranges as our python tests.
1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100,200,300,400,500,600,700,800,900,1000,1100,1200
So from 1 to 10. Then 10 to 100 in steps of 10. Then from 100 to 1200 in steps of 100.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, to be fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NSAPI_ERROR_WOULD_BLOCK
should not be treated differently in blocking case. All value less than zero are errors in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, have to take a look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a suggestion, you already have generate_RFC_864_pattern()
that can be used for this purpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea and to be taken into use
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be sure, clear the rx_buffer, so if we re-send same sized packet with same data, it will be shown.
`memset(rx_buffer, 0, BUFF_SIZE);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As in TCP case, use same ranges.
(Perhaps update the testplan as well)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is weird way of saying "More than 100, but less than 200"
Why not TEST_ASSERT_INT_WITHIN(50, 150, ...)
Any ideas why WIFI tests now fail to build? |
@VeijoPesonen We cannot merge those in yet, selectively building WiFi tests should be resolved somewhere else. |
@kjbracey-arm @0xc0170
Other than that, test configuration now picks up interfaces by
|
Prior to "default network interface" stuff, you have to assume it's not a WiFi device, unless someone has specifically told you how to find a WiFi interface. Which would be the 'MBED_CONF_APP_OBJECT_CONSTRUCTION' etc the tests use? After default network interface, I'm afraid there's still no compile-time method, but For Ethernet, |
@VeijoPesonen You need then drop the changes to WiFi tests |
Other than those that I have now commented, all looks good. |
udpsocket_sendto_invalid
tcpsocket_send_repeat
udpsocket_sendto_repeat
udpsocket_echotest udpsocket_echotest_nonblock
udpsocket_echotest.cpp udpsocket_echotest_burst.cpp
From lowercase to uppercase and drops 'test_'-prefix. Test case descriptions do also match to TC names now. Additionally all the TCs are not behing MBED_EXTENDED_TESTS anymore.
Rebased on top of master. Emac is now in "needs Preceeding PR" label should be removed. @0xc0170 or @kjbracey-arm please start tests for this. |
It would be nice if this could go to 5.9.0, but I think CI load may prevent it. Labelling as 5.9.1 for now. |
Going to attempt to squeeze this in. /morph build |
Build : SUCCESSBuild number : 2153 Triggering tests/morph test |
Test : SUCCESSBuild number : 1945 |
Exporter Build : SUCCESSBuild number : 1782 |
Description
Improving Greentea netsocket test case coverage
Pull request type
[X] Test case
[ ] Fix
[ ] Refactor
[ ] New target
[ ] Feature
[ ] Breaking change