• Willem de Bruijn's avatar
    selftests/net: integrate packetdrill with ksft · 8a405552
    Willem de Bruijn authored
    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 a8a388c2 ("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: default avatarWillem de Bruijn <willemb@google.com>
    Link: https://patch.msgid.link/20240905231653.2427327-3-willemdebruijn.kernel@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    8a405552
Makefile 8.45 KB