Skip to contentSkip to conversation

tc-testing: Add tdc to kselftests

RFC New Briana Oursler 1 participant 1 message Jul 14, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 tc-testing: Add tdc to kselftests

Add tdc to existing kselftest infrastructure so that it can be run with existing kselftests. TDC now generates objects in objdir/kselftest without cluttering main objdir, leaves source directory clean, and installs correctly in kselftest_install, properly adding itself to run_kselftest.sh script.

Add tc-testing as a target of selftests/Makefile. Create tdc.sh to run tdc.py targets with correct arguments. To support single target from selftest/Makefile, combine tc-testing/bpf/Makefile and tc-testing/Makefile. Move action.c up a directory to tc-testing/.

Tested with:
make O=/tmp/{objdir} TARGETS="tc-testing" kselftest cd /tmp/{objdir}
cd kselftest
cd tc-testing
./tdc.sh

make -C tools/testing/selftests/ TARGETS=tc-testing run_tests

make TARGETS="tc-testing" kselftest
cd tools/testing/selftests
./kselftest_install.sh /tmp/exampledir
My VM doesn't run all the kselftests so I commented out all except my target and net/pmtu.sh then:
cd /tmp/exampledir && ./run_kselftest.sh

---
 tools/testing/selftests/Makefile                      | 1 +
 tools/testing/selftests/tc-testing/{bpf => }/Makefile | 9 ++++++---
 tools/testing/selftests/tc-testing/{bpf => }/action.c | 0
 tools/testing/selftests/tc-testing/tdc.sh             | 6 ++++++
 tools/testing/selftests/tc-testing/tdc_config.py      | 2 +-
 5 files changed, 14 insertions(+), 4 deletions(-)
 rename tools/testing/selftests/tc-testing/{bpf => }/Makefile (79%)
 rename tools/testing/selftests/tc-testing/{bpf => }/action.c (100%)
 create mode 100755 tools/testing/selftests/tc-testing/tdc.sh
tools/testing/selftests/Makefile +1 -0
index 1195bd85af38..f4522e0a2cab 100644
@@ -54,6 +54,7 @@ TARGETS += splice
 TARGETS += static_keys
 TARGETS += sync
 TARGETS += sysctl
+TARGETS += tc-testing
 TARGETS += timens
 ifneq (1, $(quicktest))
 TARGETS += timers
tools/testing/selftests/tc-testing/Makefile renamed from tools/testing/selftests/tc-testing/bpf/Makefile +6 -3
similarity index 79%
rename from tools/testing/selftests/tc-testing/bpf/Makefile
rename to tools/testing/selftests/tc-testing/Makefile
index be5a5e542804..8316bf3ea5f2 100644
@@ -1,11 +1,11 @@
 # SPDX-License-Identifier: GPL-2.0
 
-APIDIR := ../../../../include/uapi
+top_srcdir = $(abspath ../../../..)
+APIDIR := $(top_scrdir)/include/uapi
 TEST_GEN_FILES = action.o
 
-top_srcdir = ../../../../..
 KSFT_KHDR_INSTALL := 1
-include ../../lib.mk
+include ../lib.mk
 
 CLANG ?= clang
 LLC   ?= llc
@@ -28,3 +28,6 @@ $(OUTPUT)/%.o: %.c
 	$(CLANG) $(CLANG_FLAGS) \
 		 -O2 -target bpf -emit-llvm -c $< -o - |      \
 	$(LLC) -march=bpf -mcpu=$(CPU) $(LLC_FLAGS) -filetype=obj -o $@
+
+TEST_PROGS += ./tdc.sh
+TEST_FILES := tdc*.py Tdc*.py config plugins plugin-lib tc-tests
tools/testing/selftests/tc-testing/action.c renamed from tools/testing/selftests/tc-testing/bpf/action.c +0 -0
similarity index 100%
rename from tools/testing/selftests/tc-testing/bpf/action.c
rename to tools/testing/selftests/tc-testing/action.c
tools/testing/selftests/tc-testing/tdc.sh new file +6 -0
new file mode 100755
index 000000000000..e5d2c0e97bda
@@ -0,0 +1,6 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+./tdc.py -c actions --nobuildebpf
+./tdc.py -c qdisc
+
tools/testing/selftests/tc-testing/tdc_config.py +1 -1
index 080709cc4297..cd4a27ee1466 100644
@@ -24,7 +24,7 @@ NAMES = {
           # Name of the namespace to use
           'NS': 'tcut',
           # Directory containing eBPF test programs
-          'EBPFDIR': './bpf'
+          'EBPFDIR': './'
         }
 
 
Signature · 1 line
2.27.0