summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/tc-testing/tc-tests
diff options
context:
space:
mode:
authorDavide Caratti <dcaratti@redhat.com>2018-10-04 19:34:38 +0300
committerDavid S. Miller <davem@davemloft.net>2018-10-06 00:44:55 +0300
commitcf5eafbfa586d030f9321cee516b91d089e38280 (patch)
tree30e1371bbdf7b2cdb19c0079d80c7135cfa7a2a5 /tools/testing/selftests/tc-testing/tc-tests
parent4a84810eaa20337ffc033c299d35ab91877e3814 (diff)
downloadlinux-cf5eafbfa586d030f9321cee516b91d089e38280.tar.xz
tc-testing: fix build of eBPF programs
rely on uAPI headers in the current kernel tree, rather than requiring the correct version installed on the test system. While at it, group all sections in a single binary and test the 'section' parameter. Reported-by: Lucas Bates <lucasb@mojatatu.com> Signed-off-by: Davide Caratti <dcaratti@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/testing/selftests/tc-testing/tc-tests')
-rw-r--r--tools/testing/selftests/tc-testing/tc-tests/actions/bpf.json16
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/testing/selftests/tc-testing/tc-tests/actions/bpf.json b/tools/testing/selftests/tc-testing/tc-tests/actions/bpf.json
index 6f289a49e5ec..1a9b282dd0be 100644
--- a/tools/testing/selftests/tc-testing/tc-tests/actions/bpf.json
+++ b/tools/testing/selftests/tc-testing/tc-tests/actions/bpf.json
@@ -55,7 +55,7 @@
"bpf"
],
"setup": [
- "printf '#include <linux/bpf.h>\nchar l[] __attribute__((section(\"license\"),used))=\"GPL\"; __attribute__((section(\"action\"),used)) int m(struct __sk_buff *s) { return 2; }' | clang -O2 -x c -c - -target bpf -o _b.o",
+ "make -C bpf",
[
"$TC action flush action bpf",
0,
@@ -63,14 +63,14 @@
255
]
],
- "cmdUnderTest": "$TC action add action bpf object-file _b.o index 667",
+ "cmdUnderTest": "$TC action add action bpf object-file $EBPFDIR/action.o section action-ok index 667",
"expExitCode": "0",
"verifyCmd": "$TC action get action bpf index 667",
- "matchPattern": "action order [0-9]*: bpf _b.o:\\[action\\] id [0-9]* tag 3b185187f1855c4c( jited)? default-action pipe.*index 667 ref",
+ "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",
"matchCount": "1",
"teardown": [
"$TC action flush action bpf",
- "rm -f _b.o"
+ "make -C bpf clean"
]
},
{
@@ -81,7 +81,7 @@
"bpf"
],
"setup": [
- "printf '#include <linux/bpf.h>\nchar l[] __attribute__((section(\"license\"),used))=\"GPL\"; __attribute__((section(\"action\"),used)) int m(struct __sk_buff *s) { s->data = 0x0; return 2; }' | clang -O2 -x c -c - -target bpf -o _c.o",
+ "make -C bpf",
[
"$TC action flush action bpf",
0,
@@ -89,10 +89,10 @@
255
]
],
- "cmdUnderTest": "$TC action add action bpf object-file _c.o index 667",
+ "cmdUnderTest": "$TC action add action bpf object-file $EBPFDIR/action.o section action-ko index 667",
"expExitCode": "255",
"verifyCmd": "$TC action get action bpf index 667",
- "matchPattern": "action order [0-9]*: bpf _c.o:\\[action\\] id [0-9].*index 667 ref",
+ "matchPattern": "action order [0-9]*: bpf action.o:\\[action-ko\\] id [0-9].*index 667 ref",
"matchCount": "0",
"teardown": [
[
@@ -101,7 +101,7 @@
1,
255
],
- "rm -f _c.o"
+ "make -C bpf clean"
]
},
{