Merge pull request #12867 from fjmolinas/pr_tests_no_reset_dep
tests: adapt tests so they can use `tests_utils_interactive_sync`
This commit is contained in:
commit
26a1348a9a
@ -31,8 +31,6 @@ USEMODULE += shell
|
|||||||
USEMODULE += shell_commands
|
USEMODULE += shell_commands
|
||||||
USEMODULE += ps
|
USEMODULE += ps
|
||||||
|
|
||||||
DISABLE_MODULE += test_utils_interactive_sync
|
|
||||||
|
|
||||||
# The test requires some setup and to be run as root
|
# The test requires some setup and to be run as root
|
||||||
# So it cannot currently be run
|
# So it cannot currently be run
|
||||||
TEST_ON_CI_BLACKLIST += all
|
TEST_ON_CI_BLACKLIST += all
|
||||||
|
|||||||
@ -41,8 +41,6 @@ USEMODULE += shell
|
|||||||
USEMODULE += shell_commands
|
USEMODULE += shell_commands
|
||||||
USEMODULE += ps
|
USEMODULE += ps
|
||||||
|
|
||||||
DISABLE_MODULE += test_utils_interactive_sync
|
|
||||||
|
|
||||||
# The test requires some setup and to be run as root
|
# The test requires some setup and to be run as root
|
||||||
# So it cannot currently be run
|
# So it cannot currently be run
|
||||||
TEST_ON_CI_BLACKLIST += all
|
TEST_ON_CI_BLACKLIST += all
|
||||||
|
|||||||
@ -84,11 +84,6 @@ static gnrc_netif_t *eth_netif, *mock_netif;
|
|||||||
static ipv6_addr_t *local_addr;
|
static ipv6_addr_t *local_addr;
|
||||||
static char mock_netif_stack[THREAD_STACKSIZE_DEFAULT];
|
static char mock_netif_stack[THREAD_STACKSIZE_DEFAULT];
|
||||||
static char line_buf[SHELL_DEFAULT_BUFSIZE];
|
static char line_buf[SHELL_DEFAULT_BUFSIZE];
|
||||||
static const shell_command_t shell_commands[] = {
|
|
||||||
{ "udp", "send data over UDP and listen on UDP ports", udp_cmd },
|
|
||||||
{ "test", "sends data according to a specified numeric test", shell_test_cmd },
|
|
||||||
{ NULL, NULL, NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
static const ipv6_addr_t _src = { .u8 = TEST_SRC };
|
static const ipv6_addr_t _src = { .u8 = TEST_SRC };
|
||||||
static const ipv6_addr_t _dst = { .u8 = TEST_DST };
|
static const ipv6_addr_t _dst = { .u8 = TEST_DST };
|
||||||
@ -617,6 +612,29 @@ static int shell_test_cmd(int argc, char **argv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int send_test_pkt(int argc, char **argv)
|
||||||
|
{
|
||||||
|
(void) argc;
|
||||||
|
(void) argv;
|
||||||
|
|
||||||
|
printf("Sending UDP test packets to port %u\n", TEST_PORT);
|
||||||
|
for (unsigned i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
|
||||||
|
if (ipv6_addr_is_link_local(ð_netif->ipv6.addrs[i])) {
|
||||||
|
local_addr = ð_netif->ipv6.addrs[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int unittests(int argc, char** argv)
|
||||||
|
{
|
||||||
|
(void) argc;
|
||||||
|
(void) argv;
|
||||||
|
|
||||||
|
run_unittests();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* TODO: test if forwarded packet is not fragmented */
|
/* TODO: test if forwarded packet is not fragmented */
|
||||||
|
|
||||||
static int mock_get_device_type(netdev_t *dev, void *value, size_t max_len)
|
static int mock_get_device_type(netdev_t *dev, void *value, size_t max_len)
|
||||||
@ -649,6 +667,14 @@ static int mock_send(netdev_t *dev, const iolist_t *iolist)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const shell_command_t shell_commands[] = {
|
||||||
|
{ "udp", "send data over UDP and listen on UDP ports", udp_cmd },
|
||||||
|
{ "unittests", "Runs unitest", unittests},
|
||||||
|
{ "test", "sends data according to a specified numeric test", shell_test_cmd },
|
||||||
|
{ "send-test-pkt", "start sendig UDP test packets to TEST_PORT", send_test_pkt },
|
||||||
|
{ NULL, NULL, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
eth_netif = gnrc_netif_iter(NULL);
|
eth_netif = gnrc_netif_iter(NULL);
|
||||||
@ -663,13 +689,6 @@ int main(void)
|
|||||||
sizeof(mock_netif_stack),
|
sizeof(mock_netif_stack),
|
||||||
GNRC_NETIF_PRIO, "mock_netif",
|
GNRC_NETIF_PRIO, "mock_netif",
|
||||||
(netdev_t *)&mock_netdev);
|
(netdev_t *)&mock_netdev);
|
||||||
run_unittests();
|
|
||||||
printf("Sending UDP test packets to port %u\n", TEST_PORT);
|
|
||||||
for (unsigned i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
|
|
||||||
if (ipv6_addr_is_link_local(ð_netif->ipv6.addrs[i])) {
|
|
||||||
local_addr = ð_netif->ipv6.addrs[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE);
|
shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -318,6 +318,7 @@ def test_ipv6_ext_frag_fwd_too_big(child, s, iface, ll_dst):
|
|||||||
def testfunc(child):
|
def testfunc(child):
|
||||||
tap = get_bridge(os.environ["TAP"])
|
tap = get_bridge(os.environ["TAP"])
|
||||||
|
|
||||||
|
child.sendline("unittests")
|
||||||
child.expect(r"OK \((\d+) tests\)") # wait for and check result of unittests
|
child.expect(r"OK \((\d+) tests\)") # wait for and check result of unittests
|
||||||
print("." * int(child.match.group(1)), end="", flush=True)
|
print("." * int(child.match.group(1)), end="", flush=True)
|
||||||
|
|
||||||
@ -337,6 +338,7 @@ def testfunc(child):
|
|||||||
print("FAILED")
|
print("FAILED")
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
|
child.sendline("send-test-pkt")
|
||||||
child.expect(r"Sending UDP test packets to port (\d+)\r\n")
|
child.expect(r"Sending UDP test packets to port (\d+)\r\n")
|
||||||
|
|
||||||
port = int(child.match.group(1))
|
port = int(child.match.group(1))
|
||||||
|
|||||||
@ -35,8 +35,6 @@ USEMODULE += shell
|
|||||||
USEMODULE += shell_commands
|
USEMODULE += shell_commands
|
||||||
USEMODULE += ps
|
USEMODULE += ps
|
||||||
|
|
||||||
DISABLE_MODULE += test_utils_interactive_sync
|
|
||||||
|
|
||||||
# The test requires some setup and to be run as root
|
# The test requires some setup and to be run as root
|
||||||
# So it cannot currently be run
|
# So it cannot currently be run
|
||||||
TEST_ON_CI_BLACKLIST += all
|
TEST_ON_CI_BLACKLIST += all
|
||||||
|
|||||||
@ -234,11 +234,6 @@ static int _ipreg(int argc, char **argv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const shell_command_t shell_commands[] = {
|
|
||||||
{ "ip", "Registers pktdump to protocol number 59 (no next header)", _ipreg },
|
|
||||||
{ NULL, NULL, NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
static void run_unittests(void)
|
static void run_unittests(void)
|
||||||
{
|
{
|
||||||
EMB_UNIT_TESTFIXTURES(fixtures) {
|
EMB_UNIT_TESTFIXTURES(fixtures) {
|
||||||
@ -255,9 +250,23 @@ static void run_unittests(void)
|
|||||||
TESTS_END();
|
TESTS_END();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int _unittests(int argc, char** argv)
|
||||||
|
{
|
||||||
|
(void) argc;
|
||||||
|
(void) argv;
|
||||||
|
|
||||||
|
run_unittests();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const shell_command_t shell_commands[] = {
|
||||||
|
{ "ip", "Registers pktdump to protocol number 59 (no next header)", _ipreg },
|
||||||
|
{ "unittests", "Runs unitest", _unittests},
|
||||||
|
{ NULL, NULL, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
run_unittests();
|
|
||||||
shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE);
|
shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -337,7 +337,7 @@ def test_time_exc(child, iface, hw_dst, ll_dst, ll_src):
|
|||||||
def testfunc(child):
|
def testfunc(child):
|
||||||
global sniffer
|
global sniffer
|
||||||
tap = get_bridge(os.environ["TAP"])
|
tap = get_bridge(os.environ["TAP"])
|
||||||
|
child.sendline("unittests")
|
||||||
child.expect(r"OK \((\d+) tests\)") # wait for and check result of unittests
|
child.expect(r"OK \((\d+) tests\)") # wait for and check result of unittests
|
||||||
print("." * int(child.match.group(1)), end="", flush=True)
|
print("." * int(child.match.group(1)), end="", flush=True)
|
||||||
lladdr_src = get_host_lladdr(tap)
|
lladdr_src = get_host_lladdr(tap)
|
||||||
|
|||||||
@ -28,8 +28,6 @@ USEMODULE += shell_commands
|
|||||||
|
|
||||||
USEMODULE += posix_inet
|
USEMODULE += posix_inet
|
||||||
|
|
||||||
DISABLE_MODULE += test_utils_interactive_sync
|
|
||||||
|
|
||||||
LOW_MEMORY_BOARDS := nucleo-f334r8 msb-430 msb-430h
|
LOW_MEMORY_BOARDS := nucleo-f334r8 msb-430 msb-430h
|
||||||
|
|
||||||
ifeq ($(BOARD),$(filter $(BOARD),$(LOW_MEMORY_BOARDS)))
|
ifeq ($(BOARD),$(filter $(BOARD),$(LOW_MEMORY_BOARDS)))
|
||||||
|
|||||||
@ -37,8 +37,6 @@ USEMODULE += shell
|
|||||||
USEMODULE += shell_commands
|
USEMODULE += shell_commands
|
||||||
USEMODULE += od
|
USEMODULE += od
|
||||||
|
|
||||||
DISABLE_MODULE += test_utils_interactive_sync
|
|
||||||
|
|
||||||
# Export used tap device to environment
|
# Export used tap device to environment
|
||||||
export TAPDEV = $(TAP)
|
export TAPDEV = $(TAP)
|
||||||
|
|
||||||
|
|||||||
@ -63,9 +63,6 @@ def check_cmd(child, cmd, expected):
|
|||||||
|
|
||||||
|
|
||||||
def testfunc(child):
|
def testfunc(child):
|
||||||
# check startup message
|
|
||||||
child.expect('test_shell.')
|
|
||||||
|
|
||||||
# loop other defined commands and expected output
|
# loop other defined commands and expected output
|
||||||
for cmd, expected in CMDS:
|
for cmd, expected in CMDS:
|
||||||
check_cmd(child, cmd, expected)
|
check_cmd(child, cmd, expected)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user