tests: port tests/lwip to sock#6372
Conversation
(because merging those three is pretty tricky due to their similarities) |
|
Also needs #6373 to build successfully for |
Makefile.pseudomodules
Outdated
| PSEUDOMODULES += sock | ||
| PSEUDOMODULES += sock_ip | ||
| PSEUDOMODULES += sock_tcp | ||
| PSEUDOMODULES += sock_udp |
There was a problem hiding this comment.
Already provided in lines 59-62?
98a7453 to
5494725
Compare
|
Made the output a little bit more specific. |
|
|
Fixed |
|
OK no problem ;-) |
|
Remember that this also needs #5938 ;-) |
|
Rebased to current master and #5938. |
6e70e85 to
329b176
Compare
|
From #5937 (comment):
The phytec board issue is due it not being included in lwIP's auto-init routine yet (which was not possible due it not being netdev2 before #6453 was merged). This is more about fixing #4672 (or, as a workaround, writing a custom initialization routine for that device in |
|
Runnung on the phytecs was one issue. Crashing was an other which can also be seen on atmel boards |
Okay, will look into that. |
|
I didn't follow your discussion completely but yes I prefer an application+Makefile that demonstrates sock->lwip->netdev->air. And most likely it is more an "example" than a "test". Without such an application it is always a hassle to research all dependencies and stuff instead of just taking this app as a basis, when someone actually wants to make use of this port. In my opinion a general |
Mostly, but To summarize: I don't see the benefit of having a) 3 separated tests for lwip ip, udp, and tcp (which should be merged to avoid code duplication, and to simplify the code enhancing its readability); and b) a single test (which is more an example) that integrates all 3 but cannot be run automatically -> for instance in a future CI with nightly build + test-everything. |
I'd argue this application doesn't even do that. It provides shell commands that can automatically be run. I re-add the test script and extend it. |
916669f to
40fd399
Compare
|
Rebased. |
|
(and adapted the test script @smlng). |
f96ef1a to
76cdab9
Compare
|
Rebased. |
| # including lwip_ipv6_mld would currently break this test on at86rf2xx radios | ||
| USEMODULE += lwip lwip_ipv6_autoconfig lwip_conn_ip lwip_netdev | ||
| USEMODULE += lwip_udp lwip_conn_udp | ||
| USEMODULE += lwip lwip_ipv6_autoconfig lwip_sock_ip lwip_netdev |
There was a problem hiding this comment.
the dependencies seem a little much. At least lwip_* should depend on lwip, right?
There was a problem hiding this comment.
and lwip should depend on lwip_netdev, which should depend on netdev_default?
There was a problem hiding this comment.
Please read the title of this PR. This PR is about porting the tests, not fixing dependencies for lwIP ;-)
There was a problem hiding this comment.
Well, don't we have a convention that once a mess has been identified, we fix it instead of adding on top?
There was a problem hiding this comment.
Primarily we want to have topical PRs so they don't grow out of hand (and the review doesn't take an eternity). Let's fix this in a separate PR after this one is merged. Please!
| USEMODULE += lwip lwip_ipv6_autoconfig lwip_sock_ip lwip_netdev | ||
| USEMODULE += lwip_udp lwip_sock_udp | ||
| USEMODULE += lwip_tcp lwip_sock_tcp | ||
| USEMODULE += ipv6_addr |
There was a problem hiding this comment.
also this dependency should be implicit (through sock?).
tests/lwip/tcp.c
Outdated
|
|
||
| #ifdef MODULE_SOCK_TCP | ||
| static char sock_inbuf[SOCK_INBUF_SIZE]; | ||
| static bool server_running, client_running = false; |
There was a problem hiding this comment.
only client running will be set to false, which is probably not what you intended. Anyhow, if declared like this, the default is zero (false) anyways.
tests/lwip/tcp.c
Outdated
|
|
||
| msg_init_queue(server_msg_queue, SERVER_MSG_QUEUE_SIZE); | ||
| /* parse port */ | ||
| server_addr.port = (uint16_t)atoi((char *)args); |
There was a problem hiding this comment.
both casts seem unnecessary
tests/lwip/tcp.c
Outdated
|
|
||
| static int tcp_send(char *data, unsigned int num, unsigned int delay) | ||
| { | ||
| uint8_t byte_data[strlen(data) / 2]; |
There was a problem hiding this comment.
(and where did we forbid dynamic arrays, especially in shell context where we know the maximum length this doesn't seem necessary)
There was a problem hiding this comment.
well, for one, the shell commands might be used elsewhere (shudder). Then the problem with dynamic arrays is the dynamic stack usage. Breaks the stack depending on usage. If the maximum shell line length is allowed, allocate that much memory.
tests/lwip/tcp.c
Outdated
| return 1; | ||
| } | ||
| if (argc > 3) { | ||
| num = (uint32_t)atoi(argv[3]); |
tests/lwip/tcp.c
Outdated
| num = (uint32_t)atoi(argv[3]); | ||
| } | ||
| if (argc > 4) { | ||
| delay = (uint32_t)atoi(argv[4]); |
tests/lwip/tests/01-run.py
Outdated
| @@ -1,4 +1,4 @@ | |||
| #! /usr/bin/env python | |||
| #! /usr/bin/env python2 | |||
There was a problem hiding this comment.
does this run with python3?
There was a problem hiding this comment.
Now that I replaced all occurrences of pexpect.spawn() with pexpect.spawnu() it does
tests/lwip/udp.c
Outdated
| ipv6_addr_t src = IPV6_ADDR_UNSPECIFIED, dst; | ||
| uint16_t port; | ||
| sock_udp_ep_t dst = SOCK_IPV6_EP_ANY; | ||
| uint8_t byte_data[strlen(data) / 2]; |
tests/lwip/udp.c
Outdated
| } | ||
| /* parse port */ | ||
| port = (uint16_t)atoi(port_str); | ||
| dst.port = (uint16_t)atoi(port_str); |
|
+1 for trying to merge this at H&A. Would achieve fully harmonized API (sock). |
If #6012 gets merged, too. |
|
Addressed comments. |
tests/lwip/tcp.c
Outdated
| @@ -0,0 +1,224 @@ | |||
| /* | |||
| * Copyright (C) 2015 Freie Universität Berlin | |||
There was a problem hiding this comment.
Well the PR feels like being open for so long :o) (will fix though ;))
tests/lwip/tcp.c
Outdated
| } | ||
| else if (strcmp(argv[1], "send") == 0) { | ||
| uint32_t num = 1; | ||
| uint32_t delay = 1000000; |
There was a problem hiding this comment.
please ad "LU" for our beloved 16bitters
|
Addressed |
|
Added |
|
May I squash, @kaspar030? |
9f3b5cd to
b84f3cc
Compare
|
Squashed (asked @kaspar030 if this is alright) |
|
The errors in |
This ports tests/lwip to sock.
Depends on
#5936,#5937, and#5938. Will only rebase once all of these are merged.