Skip to content
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

Duplicate some native tests for native64 #314

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions 01-ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,13 @@ Run all unittests at once on an iotlab-m3 node.
### Result

All tests run successfully. (Output says: "OK (xyz tests)"

Task #05 - Unittests on native64
================================
### Description

Run all unittests at once in native64.

### Result

All tests run successfully. (Output says: "OK (xyz tests)"
6 changes: 5 additions & 1 deletion 01-ci/test_spec01.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import pytest


APP = 'tests/unittests'
TESTS_SUITES = sorted(
d.name
Expand Down Expand Up @@ -47,3 +46,8 @@ def test_task03(nodes, log_nodes, riotbase, test_suite):
@pytest.mark.parametrize('nodes', [pytest.param(['iotlab-m3'])], indirect=['nodes'])
def test_task04(nodes, log_nodes, riotbase):
run_unittests('all', nodes, log_nodes, os.path.join(riotbase, APP))

# nodes passed to nodes fixture
@pytest.mark.parametrize('nodes', [pytest.param(['native64'])], indirect=['nodes'])
def test_task05(nodes, log_nodes, riotbase):
run_unittests('all', nodes, log_nodes, os.path.join(riotbase, APP))
10 changes: 10 additions & 0 deletions 02-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,13 @@ Perform a subset of tests (!= subset from Task #02) on samr21-xpro node.
### Result

All tests succeed.

Task #04 - Subset of tests on native64
=======================================
### Description

Perform a subset of tests on native64 and check their output.

### Result

All tests succeed.
18 changes: 18 additions & 0 deletions 03-single-hop-ipv6-icmp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,21 @@ both the fragmented and reassembled requests/replies).
### Result

<1% packets lost on the pinging node.

Task #07 - ICMPv6 stress test on native64 (1 hour)
================================================
### Description

Rapid ICMPv6 echo request/reply exchange from 10 host ping applications (same
host, e.g. Linux host) simultaneously to one native64 node for 1 hour.
* Stack configuration: IPv6 (default)
* Count: Infinity
* Interval: 0ms
* Payload: 1452B
* Destination Address: Link local unicast (fe80::.../64)

### Result

All nodes are still running, reachable, and the packet buffer is empty 10
seconds after completions (use module `shell_cmd_gnrc_pktbuf`).
Packet loss is irrelevant in this stress test.
46 changes: 40 additions & 6 deletions 03-single-hop-ipv6-icmp/test_spec03.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
import pexpect
import pexpect.replwrap
import pytest

from riotctrl_shell.gnrc import GNRCICMPv6Echo, GNRCPktbufStats
from riotctrl_shell.netif import Ifconfig

from testutils.asyncio import wait_for_futures, timeout_futures
from testutils.native import bridged, bridge, get_ping_cmd, interface_exists
from testutils.shell import ping6, lladdr, check_pktbuf

from testutils.asyncio import timeout_futures, wait_for_futures
from testutils.native import bridge, bridged, get_ping_cmd, interface_exists
from testutils.shell import check_pktbuf, lladdr, ping6

APP = 'tests/net/gnrc_udp'
TASK05_NODES = 11
Expand Down Expand Up @@ -163,3 +160,40 @@ def test_task06(riot_ctrl):
assert res['stats']['packet_loss'] < 1

check_pktbuf(pinged, pinger)

@pytest.mark.skipif(not interface_exists("tap0"), reason="tap0 does not exist")
@pytest.mark.sudo_only # ping -f requires root
@pytest.mark.parametrize(
'nodes', [pytest.param(['native64'] * TASK05_NODES)], indirect=['nodes']
)
def test_task07(riot_ctrl, log_nodes):
node = riot_ctrl(0, APP, Shell, port='tap0')
pingers = [pexpect.replwrap.bash() for _ in range(10)]

_, pinged_addr = lladdr(node.ifconfig_list())
assert pinged_addr.startswith("fe80::")
iface = bridge('tap0')
pinged_addr += f"%{iface}"
ping_cmd = get_ping_cmd()

futures = []
try:
for pinger in pingers:
if log_nodes:
pinger.child.logfile = sys.stdout
out = pinger.run_command(
f"{ping_cmd} -f -s 1452 {pinged_addr}"
# pipe to /dev/null because output can go
# into MiB of data ;-)
" 2>&1 > /dev/null",
async_=True,
timeout=60 * 60,
)
futures.append(out)
timeout_futures(futures, 60 * 60)
finally:
for pinger in pingers:
# interrupt prevailing `ping6`s
pinger.child.sendintr()

check_pktbuf(node)
26 changes: 24 additions & 2 deletions 05-single-hop-route/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,29 @@ advertisements for this task).
<10% packets lost on the pinging node.
No leaks in the packet buffer (check with `shell_cmd_gnrc_pktbuf`).

Task #03 - ICMPv6 echo unicast addresess on native (specific route)
Task #03 - ICMPv6 echo unicast addresess on native64 (default route)
====================================================================
### Description

ICMPv6 echo request/reply exchange between two native64 nodes both with global
unicast addresses. A static default route has to be used
(`nib route add <iface> :: <dst link-local>`, also remember to deactivate router
advertisements on both ends *beforehand* with `ifconfig <iface> -rtr_adv`,
otherwise default routes and address resolution will be auto-configured).
* Stack configuration: IPv6 (default)
* Count: 100
* Interval: 10ms
* Payload: 1kB
* Sender Address: beef::2/64
* Destination Address: beef::1/64

### Result

<1% packets lost on the pinging node.
No leaks in the packet buffer (check with `shell_cmd_gnrc_pktbuf`).


Task #04 - ICMPv6 echo unicast addresess on native (specific route)
===================================================================
### Description

Expand All @@ -64,7 +86,7 @@ otherwise default routes and address resolution will be auto-configured ).
<1% packets lost on the pinging node.
No leaks in the packet buffer (check with `shell_cmd_gnrc_pktbuf`).

Task #04 - ICMPv6 echo unicast addresess on iotlab-m3 (static route)
Task #05 - ICMPv6 echo unicast addresess on iotlab-m3 (static route)
====================================================================
### Description

Expand Down
35 changes: 29 additions & 6 deletions 05-single-hop-route/test_spec05.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import pytest

from riotctrl_shell.gnrc import GNRCICMPv6Echo, GNRCIPv6NIB, GNRCPktbufStats
from riotctrl_shell.netif import Ifconfig

from testutils.native import bridged
from testutils.shell import ping6, lladdr, check_pktbuf

from testutils.shell import check_pktbuf, lladdr, ping6

APP = 'examples/gnrc_networking'
pytestmark = pytest.mark.rc_only()
Expand Down Expand Up @@ -66,12 +63,38 @@ def test_task02(riot_ctrl):

check_pktbuf(pinged, pinger)

@pytest.mark.skipif(not bridged(["tap0", "tap1"]), reason="tap0 and tap1 not bridged")
# nodes passed to riot_ctrl fixture
@pytest.mark.parametrize(
'nodes', [pytest.param(['native64', 'native64'])], indirect=['nodes']
)
def test_task03(riot_ctrl):
pinger, pinged = (
riot_ctrl(0, APP, Shell, modules=["shell_cmd_gnrc_pktbuf"], port="tap0"),
riot_ctrl(1, APP, Shell, modules=["shell_cmd_gnrc_pktbuf"], port="tap1"),
)

pinged_netif, pinged_lladdr = lladdr(pinged.ifconfig_list())
pinged.ifconfig_flag(pinged_netif, "rtr_adv", False)
pinged.ifconfig_add(pinged_netif, "beef::1/64")
pinger_netif, pinger_lladdr = lladdr(pinger.ifconfig_list())
pinger.ifconfig_flag(pinger_netif, "rtr_adv", False)
pinger.ifconfig_add(pinger_netif, "beef::2/64")

pinged.nib_route_add(pinged_netif, "::", pinger_lladdr)
pinger.nib_route_add(pinger_netif, "::", pinged_lladdr)

res = ping6(pinger, "beef::1", count=100, interval=10, packet_size=1024)
assert res['stats']['packet_loss'] < 1

check_pktbuf(pinged, pinger)


@pytest.mark.skipif(not bridged(["tap0", "tap1"]), reason="tap0 and tap1 not bridged")
@pytest.mark.parametrize(
'nodes', [pytest.param(['native', 'native'])], indirect=['nodes']
)
def test_task03(riot_ctrl):
def test_task04(riot_ctrl):
pinger, pinged = (
riot_ctrl(0, APP, Shell, modules=["shell_cmd_gnrc_pktbuf"], port="tap0"),
riot_ctrl(1, APP, Shell, modules=["shell_cmd_gnrc_pktbuf"], port="tap1"),
Expand All @@ -97,7 +120,7 @@ def test_task03(riot_ctrl):
@pytest.mark.parametrize(
'nodes', [pytest.param(['native', 'native'])], indirect=['nodes']
)
def test_task04(riot_ctrl):
def test_task05(riot_ctrl):
pinger, pinged = (
riot_ctrl(0, APP, Shell, modules=["shell_cmd_gnrc_pktbuf"], port="tap0"),
riot_ctrl(1, APP, Shell, modules=["shell_cmd_gnrc_pktbuf"], port="tap1"),
Expand Down
40 changes: 38 additions & 2 deletions 06-single-hop-udp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,24 @@ Sending UDP from one iotlab-m3 node to a non-existent neighbor.
No leaks in the packet buffer (check with `shell_cmd_gnrc_pktbuf`).
Packet loss is irrelevant for this test.

Task #05 - Empty UDP on native
Task #05 - UDP on native64 (non-existent neighbor)
==================================================
### Description

Sending UDP from one native64 node to a non-existent neighbor.
* Stack configuration: IPv6 (default)
* Count: 1000
* Interval: 0us
* Port: 1337
* Payload: 8B
* Destination Address: Non-existent link local unicast (e.g fe80::bd:b7ec)

### Result

No leaks in the packet buffer (check with `shell_cmd_gnrc_pktbuf`).
Packet loss is irrelevant for this test.

Task #06 - Empty UDP on native
==============================
### Description

Expand All @@ -88,7 +105,7 @@ Sending UDP between two native nodes.
<=10% packets lost on the receiving node.
No leaks in the packet buffer (check with `shell_cmd_gnrc_pktbuf`).

Task #06 - Empty UDP on iotlab-m3
Task #07 - Empty UDP on iotlab-m3
=================================
### Description

Expand All @@ -105,3 +122,22 @@ Sending UDP between two iotlab-m3 nodes.

<=10% packets lost on the receiving node.
No leaks in the packet buffer (check with `shell_cmd_gnrc_pktbuf`).

Task #10 - Empty UDP on native64
================================
### Description

Sending UDP between two native64 nodes.
* Stack configuration: IPv6 (default)
* Count: 10
* Interval: 100ms
* Port: 1337
* Payload: 0B
* Destination Address: Link local unicast (fe80::.../64)

### Result

<=10% packets lost on the receiving node.
No leaks in the packet buffer (check with `shell_cmd_gnrc_pktbuf`).


38 changes: 32 additions & 6 deletions 06-single-hop-udp/test_spec06.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import pytest

from riotctrl_shell.gnrc import GNRCPktbufStats
from riotctrl_shell.netif import Ifconfig

from testutils.native import bridged
from testutils.shell import lladdr, GNRCUDP, check_pktbuf

from testutils.shell import GNRCUDP, check_pktbuf, lladdr

APP = 'tests/net/gnrc_udp'
pytestmark = pytest.mark.rc_only()
Expand Down Expand Up @@ -92,12 +89,18 @@ def test_task04(riot_ctrl):
node.udp_client_send("fe80::db:b7ec", 1337, count=1000, delay_ms=0, payload=8)
check_pktbuf(node)

@pytest.mark.skipif(not bridged(["tap0"]), reason="tap0 not bridged")
@pytest.mark.parametrize('nodes', [pytest.param(['native64'])], indirect=['nodes'])
def test_task05(riot_ctrl):
node = riot_ctrl(0, APP, Shell, port="tap0")
node.udp_client_send("fe80::db:b7ec", 1337, count=1000, delay_ms=0, payload=8)
check_pktbuf(node)

@pytest.mark.skipif(not bridged(["tap0", "tap1"]), reason="tap0 and tap1 not bridged")
@pytest.mark.parametrize(
'nodes', [pytest.param(['native', 'native'])], indirect=['nodes']
)
def test_task05(riot_ctrl):
def test_task06(riot_ctrl):
nodes = (
riot_ctrl(0, APP, Shell, port="tap0"),
riot_ctrl(1, APP, Shell, port="tap1"),
Expand All @@ -122,7 +125,7 @@ def test_task05(riot_ctrl):
@pytest.mark.parametrize(
'nodes', [pytest.param(['iotlab-m3', 'iotlab-m3'])], indirect=['nodes']
)
def test_task06(riot_ctrl):
def test_task07(riot_ctrl):
nodes = (
riot_ctrl(0, APP, Shell),
riot_ctrl(1, APP, Shell),
Expand All @@ -143,3 +146,26 @@ def test_task06(riot_ctrl):
server.udp_server_stop()

check_pktbuf(*nodes)

@pytest.mark.skipif(not bridged(["tap0", "tap1"]), reason="tap0 and tap1 not bridged")
@pytest.mark.parametrize(
'nodes', [pytest.param(['native64', 'native64'])], indirect=['nodes']
)
def test_task08(riot_ctrl):
nodes = (
riot_ctrl(0, APP, Shell, port="tap0"),
riot_ctrl(1, APP, Shell, port="tap1"),
)

for client, server in zip(nodes, reversed(nodes)):
_, server_addr = lladdr(server.ifconfig_list())
assert server_addr.startswith("fe80::")

server.udp_server_start(1337)

client.udp_client_send(server_addr, 1337, count=100, delay_ms=100, payload=0)
packet_loss = server.udp_server_check_output(count=100, delay_ms=100)
assert packet_loss <= 10
server.udp_server_stop()

check_pktbuf(*nodes)
Loading
Loading