Skip to content
Permalink
Browse files

tests: net: context: Let the net_context cb to run first

An issue was seen after changes introduced in #17933.
The net_context callback was run after we checked that it
was run ok. This test failed of course in that case. Simple
solution is to k_yield() which will make sure that the
callback gets called before we continue. This works for this
test as our threads have suitably selected priorities.
There is also no need to use K_NO_WAIT here so replacing the
timeout with K_FOREVER.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
  • Loading branch information...
jukkar committed Aug 5, 2019
1 parent 7118d08 commit fc79a789c7e518e12a3e0b9e8c62c823adb12d61
Showing with 6 additions and 2 deletions.
  1. +6 −2 tests/net/context/src/main.c
@@ -389,7 +389,9 @@ static void net_ctx_send_v6(void)
test_sending = true;

ret = net_context_send(udp_v6_ctx, test_data, strlen(test_data),
send_cb, K_NO_WAIT, INT_TO_POINTER(AF_INET6));
send_cb, K_FOREVER, INT_TO_POINTER(AF_INET6));
k_yield();

zassert_false(((ret < 0) || cb_failure),
"Context send IPv6 UDP test failed");
}
@@ -401,7 +403,9 @@ static void net_ctx_send_v4(void)
test_sending = true;

ret = net_context_send(udp_v4_ctx, test_data, strlen(test_data),
send_cb, K_NO_WAIT, INT_TO_POINTER(AF_INET));
send_cb, K_FOREVER, INT_TO_POINTER(AF_INET));
k_yield();

zassert_false(((ret < 0) || cb_failure),
"Context send IPv4 UDP test failed");
}

0 comments on commit fc79a78

Please sign in to comment.
You can’t perform that action at this time.