]> git.dujemihanovic.xyz Git - linux.git/commit
selftests/net: integrate packetdrill with ksft
authorWillem de Bruijn <willemb@google.com>
Thu, 5 Sep 2024 23:15:52 +0000 (19:15 -0400)
committerJakub Kicinski <kuba@kernel.org>
Tue, 10 Sep 2024 00:38:02 +0000 (17:38 -0700)
commit8a405552fd3b1eefe186e724343e88790f6be832
treed30c24c4e70a8ce7faf19ed38fa6fcaa651eed6d
parentdbd61921a6adbd231d8ca91537f1e7b62e9fea61
selftests/net: integrate packetdrill with ksft

Lay the groundwork to import into kselftests the over 150 packetdrill
TCP/IP conformance tests on github.com/google/packetdrill.

Florian recently added support for packetdrill tests in nf_conntrack,
in commit a8a388c2aae49 ("selftests: netfilter: add packetdrill based
conntrack tests").

This patch takes a slightly different approach. It relies on
ksft_runner.sh to run every *.pkt file in the directory.

Any future imports of packetdrill tests should require no additional
coding. Just add the *.pkt files.

Initially import only two features/directories from github. One with a
single script, and one with two. This was the only reason to pick
tcp/inq and tcp/md5.

The path replaces the directory hierarchy in github with a flat space
of files: $(subst /,_,$(wildcard tcp/**/*.pkt)). This is the most
straightforward option to integrate with kselftests. The Linked thread
reviewed two ways to maintain the hierarchy: TEST_PROGS_RECURSE and
PRESERVE_TEST_DIRS. But both introduce significant changes to
kselftest infra and with that risk to existing tests.

Implementation notes:
- restore alphabetical order when adding the new directory to
  tools/testing/selftests/Makefile
- imported *.pkt files and support verbatim from the github project,
  except for
    - update `source ./defaults.sh` path (to adjust for flat dir)
    - add SPDX headers
    - remove one author statement
    - Acknowledgment: drop an e (checkpatch)

Tested:
make -C tools/testing/selftests \
  TARGETS=net/packetdrill \
  run_tests

make -C tools/testing/selftests \
  TARGETS=net/packetdrill \
  install INSTALL_PATH=$KSFT_INSTALL_PATH

# in virtme-ng
./run_kselftest.sh -c net/packetdrill
./run_kselftest.sh -t net/packetdrill:tcp_inq_client.pkt

Link: https://lore.kernel.org/netdev/20240827193417.2792223-1-willemdebruijn.kernel@gmail.com/
Signed-off-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20240905231653.2427327-3-willemdebruijn.kernel@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/Makefile
tools/testing/selftests/net/packetdrill/Makefile [new file with mode: 0644]
tools/testing/selftests/net/packetdrill/config [new file with mode: 0644]
tools/testing/selftests/net/packetdrill/defaults.sh [new file with mode: 0755]
tools/testing/selftests/net/packetdrill/ksft_runner.sh [new file with mode: 0755]
tools/testing/selftests/net/packetdrill/tcp_inq_client.pkt [new file with mode: 0644]
tools/testing/selftests/net/packetdrill/tcp_inq_server.pkt [new file with mode: 0644]
tools/testing/selftests/net/packetdrill/tcp_md5_md5-only-on-client-ack.pkt [new file with mode: 0644]