-
Notifications
You must be signed in to change notification settings - Fork 2k
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
tests: port tests/lwip to sock #6372
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already provided in lines 59-62?
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.
Oops.
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.
Fixed
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the dependencies seem a little much. At least lwip_* should depend on lwip, right?
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.
and lwip should depend on lwip_netdev, which should depend on netdev_default?
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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!
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!
USEMODULE += lwip_udp lwip_conn_udp | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also this dependency should be implicit (through sock?).
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.
See #6372 (comment)
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dynamic array?
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.
How else should I do it?
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.
(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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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]); |
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.
cast needed?
tests/lwip/tcp.c
Outdated
num = (uint32_t)atoi(argv[3]); | ||
} | ||
if (argc > 4) { | ||
delay = (uint32_t)atoi(argv[4]); |
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.
same
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this run with python3?
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.
Now that I replaced all occurrences of pexpect.spawn()
with pexpect.spawnu()
it does
tests/lwip/udp.c
Outdated
@@ -79,27 +77,30 @@ static void *_server_thread(void *args) | |||
static int udp_send(char *addr_str, char *port_str, char *data, unsigned int num, | |||
unsigned int delay) | |||
{ | |||
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]; |
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.
dynamic array
tests/lwip/udp.c
Outdated
puts("Error: unable to parse destination address"); | ||
return 1; | ||
} | ||
/* parse port */ | ||
port = (uint16_t)atoi(port_str); | ||
dst.port = (uint16_t)atoi(port_str); |
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.
cast
+1 for trying to merge this at H&A. Would achieve fully harmonized API (sock). |
If #6012 gets merged, too. |
Addressed comments. |
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.
almost there
tests/lwip/tcp.c
Outdated
@@ -0,0 +1,224 @@ | |||
/* | |||
* Copyright (C) 2015 Freie Universität Berlin |
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.
two years old ;)
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please ad "LU" for our beloved 16bitters
Addressed |
Added |
May I squash, @kaspar030? |
9f3b5cd
to
b84f3cc
Compare
Squashed (asked @kaspar030 if this is alright) |
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.
ACK.
The errors in |
This ports tests/lwip to sock.
Depends on
#5936,#5937, and#5938. Will only rebase once all of these are merged.