Skip to content

Commit a79d8ba

Browse files
tammelakuba-moo
authored andcommitted
selftests: tc-testing: remove buildebpf plugin
As tdc only tests loading/deleting and anything more complicated is better left to the ebpf test suite, provide a pre-compiled version of 'action.c' and don't bother compiling it in kselftests or on the fly at all. Cc: Davide Caratti <[email protected]> Signed-off-by: Pedro Tammela <[email protected]> Acked-by: Jamal Hadi Salim <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent cae0de4 commit a79d8ba

File tree

7 files changed

+11
-113
lines changed

7 files changed

+11
-113
lines changed
Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,6 @@
11
# SPDX-License-Identifier: GPL-2.0
2-
include ../../../scripts/Makefile.include
32

4-
top_srcdir = $(abspath ../../../..)
5-
APIDIR := $(top_scrdir)/include/uapi
6-
TEST_GEN_FILES = action.o
3+
TEST_PROGS += ./tdc.sh
4+
TEST_FILES := action-ebpf tdc*.py Tdc*.py plugins plugin-lib tc-tests scripts
75

86
include ../lib.mk
9-
10-
PROBE := $(shell $(LLC) -march=bpf -mcpu=probe -filetype=null /dev/null 2>&1)
11-
12-
ifeq ($(PROBE),)
13-
CPU ?= probe
14-
else
15-
CPU ?= generic
16-
endif
17-
18-
CLANG_SYS_INCLUDES := $(shell $(CLANG) -v -E - </dev/null 2>&1 \
19-
| sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }')
20-
21-
CLANG_FLAGS = -I. -I$(APIDIR) \
22-
$(CLANG_SYS_INCLUDES) \
23-
-Wno-compare-distinct-pointer-types
24-
25-
$(OUTPUT)/%.o: %.c
26-
$(CLANG) $(CLANG_FLAGS) \
27-
-O2 --target=bpf -emit-llvm -c $< -o - | \
28-
$(LLC) -march=bpf -mcpu=$(CPU) $(LLC_FLAGS) -filetype=obj -o $@
29-
30-
TEST_PROGS += ./tdc.sh
31-
TEST_FILES := tdc*.py Tdc*.py plugins plugin-lib tc-tests scripts

tools/testing/selftests/tc-testing/README

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,6 @@ directory:
195195
and the other is a test whether the command leaked memory or not.
196196
(This one is a preliminary version, it may not work quite right yet,
197197
but the overall template is there and it should only need tweaks.)
198-
- buildebpfPlugin.py:
199-
builds all programs in $EBPFDIR.
200198

201199

202200
ACKNOWLEDGEMENTS
856 Bytes
Binary file not shown.

tools/testing/selftests/tc-testing/plugin-lib/buildebpfPlugin.py

Lines changed: 0 additions & 67 deletions
This file was deleted.

tools/testing/selftests/tc-testing/tc-tests/actions/bpf.json

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@
5454
"actions",
5555
"bpf"
5656
],
57-
"plugins": {
58-
"requires": "buildebpfPlugin"
59-
},
6057
"setup": [
6158
[
6259
"$TC action flush action bpf",
@@ -65,10 +62,10 @@
6562
255
6663
]
6764
],
68-
"cmdUnderTest": "$TC action add action bpf object-file $EBPFDIR/action.o section action-ok index 667",
65+
"cmdUnderTest": "$TC action add action bpf object-file $EBPFDIR/action-ebpf section action-ok index 667",
6966
"expExitCode": "0",
7067
"verifyCmd": "$TC action get action bpf index 667",
71-
"matchPattern": "action order [0-9]*: bpf action.o:\\[action-ok\\] id [0-9].* tag [0-9a-f]{16}( jited)? default-action pipe.*index 667 ref",
68+
"matchPattern": "action order [0-9]*: bpf action-ebpf:\\[action-ok\\] id [0-9].* tag [0-9a-f]{16}( jited)? default-action pipe.*index 667 ref",
7269
"matchCount": "1",
7370
"teardown": [
7471
"$TC action flush action bpf"
@@ -81,9 +78,6 @@
8178
"actions",
8279
"bpf"
8380
],
84-
"plugins": {
85-
"requires": "buildebpfPlugin"
86-
},
8781
"setup": [
8882
[
8983
"$TC action flush action bpf",
@@ -92,10 +86,10 @@
9286
255
9387
]
9488
],
95-
"cmdUnderTest": "$TC action add action bpf object-file $EBPFDIR/action.o section action-ko index 667",
89+
"cmdUnderTest": "$TC action add action bpf object-file $EBPFDIR/action-ebpf section action-ko index 667",
9690
"expExitCode": "255",
9791
"verifyCmd": "$TC action get action bpf index 667",
98-
"matchPattern": "action order [0-9]*: bpf action.o:\\[action-ko\\] id [0-9].*index 667 ref",
92+
"matchPattern": "action order [0-9]*: bpf action-ebpf:\\[action-ko\\] id [0-9].*index 667 ref",
9993
"matchCount": "0",
10094
"teardown": [
10195
[

tools/testing/selftests/tc-testing/tc-tests/filters/bpf.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,16 @@
5252
],
5353
"plugins": {
5454
"requires": [
55-
"buildebpfPlugin",
5655
"nsPlugin"
5756
]
5857
},
5958
"setup": [
6059
"$TC qdisc add dev $DEV1 ingress"
6160
],
62-
"cmdUnderTest": "$TC filter add dev $DEV1 parent ffff: handle 1 protocol ip prio 100 bpf object-file $EBPFDIR/action.o section action-ok",
61+
"cmdUnderTest": "$TC filter add dev $DEV1 parent ffff: handle 1 protocol ip prio 100 bpf object-file $EBPFDIR/action-ebpf section action-ok",
6362
"expExitCode": "0",
6463
"verifyCmd": "$TC filter get dev $DEV1 parent ffff: handle 1 protocol ip prio 100 bpf",
65-
"matchPattern": "filter parent ffff: protocol ip pref 100 bpf chain [0-9]+ handle 0x1 action.o:\\[action-ok\\].*tag [0-9a-f]{16}( jited)?",
64+
"matchPattern": "filter parent ffff: protocol ip pref 100 bpf chain [0-9]+ handle 0x1 action-ebpf:\\[action-ok\\].*tag [0-9a-f]{16}( jited)?",
6665
"matchCount": "1",
6766
"teardown": [
6867
"$TC qdisc del dev $DEV1 ingress"
@@ -77,17 +76,16 @@
7776
],
7877
"plugins": {
7978
"requires": [
80-
"buildebpfPlugin",
8179
"nsPlugin"
8280
]
8381
},
8482
"setup": [
8583
"$TC qdisc add dev $DEV1 ingress"
8684
],
87-
"cmdUnderTest": "$TC filter add dev $DEV1 parent ffff: handle 1 protocol ip prio 100 bpf object-file $EBPFDIR/action.o section action-ko",
85+
"cmdUnderTest": "$TC filter add dev $DEV1 parent ffff: handle 1 protocol ip prio 100 bpf object-file $EBPFDIR/action-ebpf section action-ko",
8886
"expExitCode": "1",
8987
"verifyCmd": "$TC filter get dev $DEV1 parent ffff: handle 1 protocol ip prio 100 bpf",
90-
"matchPattern": "filter parent ffff: protocol ip pref 100 bpf chain [0-9]+ handle 0x1 action.o:\\[action-ko\\].*tag [0-9a-f]{16}( jited)?",
88+
"matchPattern": "filter parent ffff: protocol ip pref 100 bpf chain [0-9]+ handle 0x1 action-ebpf:\\[action-ko\\].*tag [0-9a-f]{16}( jited)?",
9189
"matchCount": "0",
9290
"teardown": [
9391
"$TC qdisc del dev $DEV1 ingress"

tools/testing/selftests/tc-testing/tdc.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,5 @@ try_modprobe sch_hfsc
6464
try_modprobe sch_hhf
6565
try_modprobe sch_htb
6666
try_modprobe sch_teql
67-
./tdc.py -J`nproc` -c actions --nobuildebpf
67+
./tdc.py -J`nproc` -c actions
6868
./tdc.py -J`nproc` -c qdisc

0 commit comments

Comments
 (0)