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

Test improvements #431

Merged
merged 15 commits into from
Aug 5, 2024
Merged

Test improvements #431

merged 15 commits into from
Aug 5, 2024

Conversation

tohojo
Copy link
Member

@tohojo tohojo commented Aug 5, 2024

This contains all the improvements to the test runners added while adding the xdp-forward utility (in #430). These changes make sense on their own and we can merge them independently of the xdp-forward utility.

We missed adding these exports when adding new tools to be tested.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
We moved the libxdp tests to separate namespaces, but not the tool tests. Let's
move the tool tests as well, since they also mess with namespace setups, so it's
better to make sure they don't interfere with the rest of the system.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
The test_runner.sh script is derived from the test-netns script originally
developed for the xdp-tutorial, and still contains a lot of the legacy from
there. Specifically, it uses a state directory with file system-based state to
support interactive execution, saving state across multiple invocations of the
script.

However, the way we execute the tests here, we always clean up everything in the
same run, so all this state saving complexity is unnecessary. Get rid of it and
store most things in global variables, so we save this complexity. This also
makes it possible to support creating multiple namespaces at the same time,
which will be needed for adding tests for the xdp-forward tool. For now, we just
create two namespaces (with matching veth pairs), but only use one of them, but
future tests will use both for forwarding tests.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Support passing test names to 'make test' invocations as TESTS=names...
This makes it easier to debug particular tests that are failing.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Some of the xdpdump test definitions were making particular assumptions about
the interface names and IP addresses used for the test setup, which broke during
the test harness refactor. Fixup the test definitions to remove those
assumptions.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Add support for entering interactive test debugging when DEBUG_TESTENV=1 is set
in the environment. This will execute $SHELL inside the namespace that is setup
for the test run, after setting up the test interfaces, making it easy to
manually run tests in the same environment to debug things.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
When setting up the test environment, make sure to enable GRO on the veth
interfaces, so that XDP redirection will work.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Since we run in a separate mount namespace, we should always mount a new bpffs
during setup. This way, we are sure the bpffs instance will be removed once we
exit the test run, which ensures that no pinned programs are left at the end of
the test.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
We rely on `set -o errexit` to abort tests if any of the setup commands fail.
However, we don't want this turned on during test execution, since we rely on
explicit checks using check_run() to check the output of certain commands in the
tests. So move the errexit to cover only the setup function.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
@tohojo tohojo force-pushed the test-improvements branch 2 times, most recently from 41f7a5f to 20e2422 Compare August 5, 2024 11:06
Add 6.6 and 6.10 kernels to the test matrix. Change the test definition format a
bit to make it less verbose on the YAML side, making it easier to add new kernel
versions in the future.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
@tohojo tohojo force-pushed the test-improvements branch 2 times, most recently from 72e907a to 3d73785 Compare August 5, 2024 12:22
…itly

Instead of having to define the DID_UNSHARE value explicitly as part of the test
matrix, set the environment variable programmatically based on the kernel
version. This removes the need for an 'include' block and some copy-paste to
accommodate the two old kernel versions.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Make sure we use the right apt repository for the version of Ubuntu used as the
workflow runner. Explicitly select ubuntu-22.04 (instead of ubuntu-latest) to
make sure the distro version doesn't change out from under us when Github
updates their runner config.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Instead of only testing on LLVM 16, add different LLVM versions to the test
matrix for wider test coverage.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Silence deprecation warnings about old node.js versions.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
The workflow job mostly consists of running the selftests, so 'selftest' is more
descriptive than 'build'.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
@tohojo tohojo merged commit 6768a75 into master Aug 5, 2024
25 checks passed
@tohojo tohojo deleted the test-improvements branch August 5, 2024 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant