tests: net: use main thread for test
The main thread was doing nothing but spawning another thread to perform the test. Delete the alternate thread, and just do the test on the main thread, adjusting stack size and priority as necessary. Issue: ZEP-2236 Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
e0185d4c76
commit
bcb4cfe9e4
12 changed files with 28 additions and 107 deletions
|
@ -20,6 +20,7 @@ CONFIG_NET_DEBUG_IF=y
|
|||
CONFIG_NET_DEBUG_CORE=y
|
||||
CONFIG_NET_DEBUG_6LO=y
|
||||
CONFIG_NET_DEBUG_NET_PKT=y
|
||||
CONFIG_MAIN_STACK_SIZE=2048
|
||||
|
||||
CONFIG_NET_6LO_CONTEXT=y
|
||||
#Before modifying this value, add respective code in src/main.c
|
||||
|
|
|
@ -899,10 +899,12 @@ static const struct {
|
|||
#endif
|
||||
};
|
||||
|
||||
static void main_thread(void)
|
||||
void main(void)
|
||||
{
|
||||
int count, pass;
|
||||
|
||||
k_thread_priority_set(k_current_get(), K_PRIO_COOP(7));
|
||||
|
||||
#if defined(CONFIG_NET_6LO_CONTEXT)
|
||||
net_6lo_set_context(net_if_get_default(), &ctx1);
|
||||
net_6lo_set_context(net_if_get_default(), &ctx2);
|
||||
|
@ -923,14 +925,3 @@ static void main_thread(void)
|
|||
|
||||
TC_END_REPORT(((pass != ARRAY_SIZE(tests)) ? TC_FAIL : TC_PASS));
|
||||
}
|
||||
|
||||
#define STACKSIZE 2000
|
||||
char __noinit __stack thread_stack[STACKSIZE];
|
||||
static struct k_thread thread_data;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
k_thread_create(&thread_data, thread_stack, STACKSIZE,
|
||||
(k_thread_entry_t)main_thread,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
}
|
||||
|
|
|
@ -669,22 +669,13 @@ static bool run_tests(void)
|
|||
return true;
|
||||
}
|
||||
|
||||
void main_thread(void)
|
||||
void main(void)
|
||||
{
|
||||
k_thread_priority_set(k_current_get(), K_PRIO_COOP(7));
|
||||
|
||||
if (run_tests()) {
|
||||
TC_END_REPORT(TC_PASS);
|
||||
} else {
|
||||
TC_END_REPORT(TC_FAIL);
|
||||
}
|
||||
}
|
||||
|
||||
#define STACKSIZE 2000
|
||||
char __noinit __stack thread_stack[STACKSIZE];
|
||||
static struct k_thread thread_data;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
k_thread_create(&thread_data, thread_stack, STACKSIZE,
|
||||
(k_thread_entry_t)main_thread,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
}
|
||||
|
|
|
@ -24,3 +24,5 @@ CONFIG_NET_MGMT_EVENT=y
|
|||
|
||||
# Turn off UDP checksum checking as the test fails otherwise.
|
||||
CONFIG_NET_UDP_CHECKSUM=n
|
||||
|
||||
CONFIG_MAIN_STACK_SIZE=3072
|
||||
|
|
|
@ -524,10 +524,11 @@ static void receiver_cb(struct net_mgmt_event_callback *cb,
|
|||
test_result(true);
|
||||
}
|
||||
|
||||
void main_thread(void)
|
||||
void main(void)
|
||||
{
|
||||
struct net_if *iface;
|
||||
|
||||
k_thread_priority_set(k_current_get(), K_PRIO_COOP(7));
|
||||
net_mgmt_init_event_callback(&rx_cb, receiver_cb,
|
||||
NET_EVENT_IPV4_ADDR_ADD);
|
||||
|
||||
|
@ -543,14 +544,3 @@ void main_thread(void)
|
|||
|
||||
k_yield();
|
||||
}
|
||||
|
||||
#define STACKSIZE 3000
|
||||
char __noinit __stack thread_stack[STACKSIZE];
|
||||
static struct k_thread thread_data;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
k_thread_create(&thread_data, thread_stack, STACKSIZE,
|
||||
(k_thread_entry_t)main_thread, NULL, NULL, NULL,
|
||||
K_PRIO_COOP(7), 0, 0);
|
||||
}
|
||||
|
|
|
@ -109,8 +109,10 @@ static bool run_tests(void)
|
|||
return true;
|
||||
}
|
||||
|
||||
void main_thread(void)
|
||||
void main(void)
|
||||
{
|
||||
k_thread_priority_set(k_current_get(), K_PRIO_COOP(7));
|
||||
|
||||
if (run_tests()) {
|
||||
TC_END_REPORT(TC_PASS);
|
||||
} else {
|
||||
|
@ -118,13 +120,3 @@ void main_thread(void)
|
|||
}
|
||||
}
|
||||
|
||||
#define STACKSIZE 2000
|
||||
char __noinit __stack thread_stack[STACKSIZE];
|
||||
static struct k_thread thread_data;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
k_thread_create(&thread_data, thread_stack, STACKSIZE,
|
||||
(k_thread_entry_t)main_thread, NULL, NULL, NULL,
|
||||
K_PRIO_COOP(7), 0, 0);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ CONFIG_NET_L2_IEEE802154=y
|
|||
CONFIG_NET_BUF=y
|
||||
CONFIG_RANDOM_GENERATOR=y
|
||||
CONFIG_TEST_RANDOM_GENERATOR=y
|
||||
CONFIG_MAIN_STACK_SIZE=5048
|
||||
CONFIG_MAIN_STACK_SIZE=8192
|
||||
CONFIG_NET_PKT_RX_COUNT=2
|
||||
CONFIG_NET_PKT_TX_COUNT=2
|
||||
CONFIG_NET_BUF_RX_COUNT=35
|
||||
|
|
|
@ -513,9 +513,10 @@ static const struct {
|
|||
{ "test_fragment_ipv6_dispatch_big", &test_data_8},
|
||||
};
|
||||
|
||||
static void main_thread(void)
|
||||
void main(void)
|
||||
{
|
||||
int count, pass;
|
||||
k_thread_priority_set(k_current_get(), K_PRIO_COOP(7));
|
||||
|
||||
for (count = 0, pass = 0; count < ARRAY_SIZE(tests); count++) {
|
||||
TC_START(tests[count].name);
|
||||
|
@ -531,13 +532,3 @@ static void main_thread(void)
|
|||
TC_END_REPORT(((pass != ARRAY_SIZE(tests)) ? TC_FAIL : TC_PASS));
|
||||
}
|
||||
|
||||
#define STACKSIZE 8000
|
||||
char __noinit __stack thread_stack[STACKSIZE];
|
||||
static struct k_thread thread_data;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
k_thread_create(&thread_data, thread_stack, STACKSIZE,
|
||||
(k_thread_entry_t)main_thread, NULL, NULL, NULL,
|
||||
K_PRIO_COOP(7), 0, 0);
|
||||
}
|
||||
|
|
|
@ -433,22 +433,13 @@ static bool run_tests(void)
|
|||
return true;
|
||||
}
|
||||
|
||||
void main_thread(void)
|
||||
void main(void)
|
||||
{
|
||||
k_thread_priority_set(k_current_get(), K_PRIO_COOP(7));
|
||||
|
||||
if (run_tests()) {
|
||||
TC_END_REPORT(TC_PASS);
|
||||
} else {
|
||||
TC_END_REPORT(TC_FAIL);
|
||||
}
|
||||
}
|
||||
|
||||
#define STACKSIZE 2000
|
||||
char __noinit __stack thread_stack[STACKSIZE];
|
||||
static struct k_thread thread_data;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
k_thread_create(&thread_data, thread_stack, STACKSIZE,
|
||||
(k_thread_entry_t)main_thread,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
}
|
||||
|
|
|
@ -359,22 +359,13 @@ static bool run_tests(void)
|
|||
}
|
||||
|
||||
|
||||
void main_thread(void)
|
||||
void main(void)
|
||||
{
|
||||
k_thread_priority_set(k_current_get(), K_PRIO_COOP(7));
|
||||
|
||||
if (run_tests()) {
|
||||
TC_END_REPORT(TC_PASS);
|
||||
} else {
|
||||
TC_END_REPORT(TC_FAIL);
|
||||
}
|
||||
}
|
||||
|
||||
#define STACKSIZE 2000
|
||||
char __noinit __stack thread_stack[STACKSIZE];
|
||||
static struct k_thread thread_data;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
k_thread_create(&thread_data, thread_stack, STACKSIZE,
|
||||
(k_thread_entry_t)main_thread, NULL, NULL, NULL,
|
||||
K_PRIO_COOP(7), 0, 0);
|
||||
}
|
||||
|
|
|
@ -581,22 +581,13 @@ static bool run_tests(void)
|
|||
return true;
|
||||
}
|
||||
|
||||
void main_thread(void)
|
||||
void main(void)
|
||||
{
|
||||
k_thread_priority_set(k_current_get(), K_PRIO_COOP(7));
|
||||
|
||||
if (run_tests()) {
|
||||
TC_END_REPORT(TC_PASS);
|
||||
} else {
|
||||
TC_END_REPORT(TC_FAIL);
|
||||
}
|
||||
}
|
||||
|
||||
#define STACKSIZE 2000
|
||||
char __noinit __stack thread_stack[STACKSIZE];
|
||||
static struct k_thread thread_data;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
k_thread_create(&thread_data, thread_stack, STACKSIZE,
|
||||
(k_thread_entry_t)main_thread,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
}
|
||||
|
|
|
@ -742,22 +742,12 @@ static bool run_net_addr_tests(void)
|
|||
return (pass != ARRAY_SIZE(tests)) ? false : true;
|
||||
}
|
||||
|
||||
void main_thread(void)
|
||||
void main(void)
|
||||
{
|
||||
k_thread_priority_set(k_current_get(), K_PRIO_COOP(7));
|
||||
if (run_tests() && run_net_addr_tests()) {
|
||||
TC_END_REPORT(TC_PASS);
|
||||
} else {
|
||||
TC_END_REPORT(TC_FAIL);
|
||||
}
|
||||
}
|
||||
|
||||
#define STACKSIZE 2000
|
||||
char __noinit __stack thread_stack[STACKSIZE];
|
||||
static struct k_thread thread_data;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
k_thread_create(&thread_data, thread_stack, STACKSIZE,
|
||||
(k_thread_entry_t)main_thread,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue