1
0
mirror of https://passt.top/passt synced 2024-12-22 13:45:32 +00:00
passt/test
David Gibson c6e6106413 test: Improve logic for waiting for SLAAC & DAD to complete in NDP tests
Since 9a0e544f05 the NDP tests attempt to explicitly wait for DAD to
complete, rather than just having a hard coded sleep.  However, the
conditions we use are a bit sloppy and allow for a number of possible cases
where it might not work correctly.  Stefano seems to be hitting one of
these (though I'm not sure which) with some later patches.

 - We wait for *lack* of a tentative address, so if the first check occurs
   before we have even a tentative address it will bypass the delay
 - It's not entirely clear if the permanent address will always appear
   as soon as the tentative address disappears
 - We weren't filtering on interface
 - We were doing the filtering with ip-address options rather than in jq.
   However in at least in some circumstances this seems to result in an
   empty .addr_info field, rather than omitting it entirely, which could
   cause us to get the wrong result

So, instead, explicitly wait for the address we need to be present: an
RA provided address on the external interface.  While we're here we remove
the requirement that it have global scope: the "kernel_ra" check is already
sufficient to make sure this address comes from an NDP RA, not something
else.  If it's not the global scope address we expect, better to check it
and fail, rather than keep waiting.

Fixes: 9a0e544f05 ("test: Improve test for NDP assigned prefix")
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
2024-11-26 08:30:18 +01:00
..
build passt: Relicense to GPL 2.0, or any later version 2023-04-06 18:00:33 +02:00
demo passt: Relicense to GPL 2.0, or any later version 2023-04-06 18:00:33 +02:00
distro passt: Relicense to GPL 2.0, or any later version 2023-04-06 18:00:33 +02:00
env passt: Relicense to GPL 2.0, or any later version 2023-04-06 18:00:33 +02:00
lib test: Pass TRACE from run_term() into ./run from_term 2024-10-10 05:25:19 +02:00
memory test: Update names of symbols and slabinfo entries 2024-07-25 12:30:29 +02:00
passt test: Improve logic for waiting for SLAAC & DAD to complete in NDP tests 2024-11-26 08:30:18 +01:00
passt_in_ns test: Clarify test for spliced inbound transfers 2024-10-18 20:28:00 +02:00
pasta test: Improve logic for waiting for SLAAC & DAD to complete in NDP tests 2024-11-26 08:30:18 +01:00
pasta_options test: Speed up by cutting on eye candy and performance test duration 2024-08-15 09:13:15 +02:00
pasta_podman test: Verify that podman tests are using the pasta binary we expect 2024-04-05 16:59:24 +02:00
perf test/perf: Select a single IPv6 namespace address in pasta tests 2024-11-26 08:30:18 +01:00
two_guests test: Adjust misplaced sleeps in two_guests code 2024-11-05 23:46:38 +01:00
.gitignore test: Build and download podman as a test asset 2024-04-05 16:59:16 +02:00
ci test: Add CI/demo scripts 2021-09-27 15:10:35 +02:00
find-arm64-firmware.sh tests: Search multiple places for aarch64 EDK2 bios image 2022-07-14 01:32:42 +02:00
Makefile test: remove obsolete images 2024-10-25 14:30:06 +02:00
nstool.c test: Make nstool hold robust against interruptions to control clients 2024-11-07 12:47:30 +01:00
passt.mbuto test: Look for possible sshd-session paths (if it's there at all) in mbuto's profile 2024-08-27 09:03:47 +02:00
passt.mem.mbuto test: Fix memory/passt tests, --netns-only is not a valid option for passt 2024-07-25 12:30:08 +02:00
prepare-distro-img.sh test: Avoid hitting guestfish command length limits 2023-12-04 09:51:26 +01:00
README.md test: Update list of dependencies in README.md 2024-08-21 12:04:30 +02:00
run test: Kernel binary can now be passed via the KERNEL environmental variable 2024-10-02 14:50:34 +02:00
run_demo test: Add CI/demo scripts 2021-09-27 15:10:35 +02:00
valgrind.supp test: Duplicate existing recvfrom() valgrind suppression for recv() 2024-08-21 12:03:23 +02:00

Scope

This directory contains test cases for passt and pasta and a simple POSIX shell-based framework to define them, and run them as a suite.

These tests can be run as part of a continuous integration workflow, and are also used to provide short usage demos, with video recording, for passt and pasta basic use cases.

Run

Dependencies

Packages

The tests require some package dependencies commonly available in Linux distributions. If some packages are not available, the test groups that need them will be selectively skipped.

This is a non-exhaustive list of packages that might not commonly be installed on a system, i.e. common utilities such as a shell are not included here.

Example for Debian, and possibly most Debian-based distributions:

bats bc build-essential catatonit clang-tidy conmon cppcheck crun fakeroot
git go iperf3 isc-dhcp-common jq libgpgme-dev libseccomp-dev linux-cpupower
lm-sensors lz4 netavark netcat-openbsd psmisc qemu-efi-aarch64
qemu-system-arm qemu-system-misc qemu-system-ppc qemu-system-x86
qemu-system-x86 sipcalc socat strace tmux uidmap valgrind

NOTE: the tests need a qemu version >= 7.2, or one that contains commit 13c6be96618c ("net: stream: add unix socket"): this change introduces support for UNIX domain sockets as network device back-end, which qemu uses to connect to passt.

Other tools

Test measuring request-response and connect-request-response latencies use neper, which is not commonly packaged by distributions and needs to be built and installed manually:

git clone https://github.com/google/neper
cd neper; make
cp tcp_crr tcp_rr udp_rr /usr/local/bin

Virtual machine images are built during test executions using mbuto, the shell script is sourced via git as needed, so there's no need to actually install it.

Kernel parameters

Performance tests use iperf3 with rather large TCP receiving and sending windows, to decrease the likelihood of iperf3 itself becoming the bottleneck. These values need to be allowed by the kernel of the host running the tests. Example for /etc/sysctl.conf:

net.core.rmem_max = 134217728 net.core.wmem_max = 134217728

Further, the passt demo uses perf(1), relying on hardware events for performance counters, to display syscall overhead. The kernel needs to allow unprivileged users to access these events. Suggested entry for /etc/sysctl.conf:

kernel.perf_event_paranoid = -1

Special requirements for continuous integration and demo modes

Running the test suite as continuous integration or demo modes will record the terminal with the steps being executed, using asciinema(1), and create binary packages.

The following additional packages are commonly needed:

alien asciinema linux-perf tshark

Regular test

Just issue:

./run

from the test directory. Elevated privileges are not needed. Environment variable settings: DEBUG=1 enables debugging messages, TRACE=1 enables tracing (further debugging messages), PCAP=1 enables packet captures. Example:

PCAP=1 TRACE=1 ./run

Running selected tests

Rudimentary support to run a list of selected tests, without support for dependencies, is available. Tests need to have a setup function corresponding to their path. For example:

./run passt/ndp passt/dhcp pasta/ndp

will call the 'passt' setup function (from lib/setup), run the two corresponding tests, call the 'passt' teardown function, the 'pasta' setup, run the pasta/ndp test, and finally tear down the 'pasta' setup.

Note that requirements on steps implemented by related tests are not handled. For example, if the 'passt/tcp' needs guest connectivity set up by the 'passt/ndp' and 'passt/dhcp' tests, those need to be listed explicitly.

Continuous integration

Issuing:

./ci

will run the whole test suite while recording the execution, and it will also build JavaScript fragments used on http://passt.top/ for performance data tables and links to specific offsets in the captures.

Demo mode

Issuing:

./demo

will run the demo cases under demo, with terminal captures as well.

Framework

The implementation of the testing framework is under lib, and it provides facilities for terminal and tmux session management, interpretation of test directives, video recording, and suchlike. Test cases are organised in the remaining directories.

Test cases can be implemented as POSIX shell scripts, or as a set of directives, which are not formally documented here, but should be clear enough from the existing cases. The entry point for interpretation of test directives is implemented in lib/test.