From 9818cc7b1d706744d2a579dbf6cd5efd896d155a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 9 Jun 2016 09:00:57 +0300 Subject: [PATCH] net: ARP unit test needs to be run from fiber The ARP unit test is not able to pass packets between fiber and task. Because of this the test is run from fiber. Change-Id: I1825a0abdc1b04a78de76d58425f4d2a2ce26ab7 Signed-off-by: Jukka Rissanen --- tests/net/arp/prj.mdef | 2 +- tests/net/arp/src/main.c | 24 +++++++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/tests/net/arp/prj.mdef b/tests/net/arp/prj.mdef index 79a413f1797..648f29b5c4e 100644 --- a/tests/net/arp/prj.mdef +++ b/tests/net/arp/prj.mdef @@ -2,4 +2,4 @@ % TASK NAME PRIO ENTRY STACK GROUPS % =================================================== - TASK MAIN 7 mainloop 2048 [EXE] + TASK MAIN 7 main 2048 [EXE] diff --git a/tests/net/arp/src/main.c b/tests/net/arp/src/main.c index c178b1e2ebb..ee9802dbb7c 100644 --- a/tests/net/arp/src/main.c +++ b/tests/net/arp/src/main.c @@ -16,6 +16,9 @@ * limitations under the License. */ +#include +#include + #include #include #include @@ -321,11 +324,7 @@ NET_DEVICE_INIT(net_arp_test, "net_arp_test", CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &net_arp_if_api, _ETH_L2_LAYER, 127); -#ifdef CONFIG_MICROKERNEL -void mainloop(void) -#else -void main(void) -#endif +void main_fiber(void) { struct net_buf *buf, *buf2; struct net_buf *frag; @@ -763,3 +762,18 @@ void main(void) printk("Network ARP checks passed\n"); } + +#if defined(CONFIG_NANOKERNEL) +#define STACKSIZE 2000 +char __noinit __stack fiberStack[STACKSIZE]; +#endif + +void main(void) +{ +#if defined(CONFIG_MICROKERNEL) + main_fiber(); +#else + task_fiber_start(&fiberStack[0], STACKSIZE, + (nano_fiber_entry_t)main_fiber, 0, 0, 7, 0); +#endif +}