Skip to content

Commit

Permalink
tc-testing: Add tdc to kselftests
Browse files Browse the repository at this point in the history
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

Co-developed-by: Davide Caratti <dcaratti@redhat.com>
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Signed-off-by: Briana Oursler <briana.oursler@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Briana Oursler authored and David S. Miller committed Jul 21, 2020
1 parent c3466a7 commit 2b9843f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions tools/testing/selftests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ TARGETS += splice
TARGETS += static_keys
TARGETS += sync
TARGETS += sysctl
TARGETS += tc-testing
TARGETS += timens
ifneq (1, $(quicktest))
TARGETS += timers
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 plugins plugin-lib tc-tests
File renamed without changes.
5 changes: 5 additions & 0 deletions tools/testing/selftests/tc-testing/tdc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0

./tdc.py -c actions --nobuildebpf
./tdc.py -c qdisc
2 changes: 1 addition & 1 deletion tools/testing/selftests/tc-testing/tdc_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# Name of the namespace to use
'NS': 'tcut',
# Directory containing eBPF test programs
'EBPFDIR': './bpf'
'EBPFDIR': './'
}


Expand Down

0 comments on commit 2b9843f

Please sign in to comment.