2021-08-20 02:00:26

by Li Zhijian

[permalink] [raw]
Subject: [PATCH v2 0/5] selftests/bpf: minor fixups

Fix a few issues reported by 0Day/LKP during runing selftests/bpf.

Changelog:
V2:
- folded previous similar standalone patch to [1/5], and add acked tag
from Song Liu
- add acked tag to [2/5], [3/5] from Song Liu
- [4/5]: move test_bpftool.py to TEST_PROGS_EXTENDED, files in TEST_GEN_PROGS_EXTENDED
are generated by make. Otherwise, it will break out-of-tree install:
'make O=/kselftest-build SKIP_TARGETS= V=1 -C tools/testing/selftests install INSTALL_PATH=/kselftest-install'
- [5/5]: new patch


Li Zhijian (5):
selftests/bpf: enlarge select() timeout for test_maps
selftests/bpf: make test_doc_build.sh work from script directory
selftests/bpf: add default bpftool built by selftests to PATH
selftests/bpf: add missing files required by test_bpftool.sh for
installing
selftests/bpf: exit with KSFT_SKIP if no Makefile found

tools/testing/selftests/bpf/Makefile | 4 +++-
tools/testing/selftests/bpf/test_bpftool.sh | 6 ++++++
tools/testing/selftests/bpf/test_bpftool_build.sh | 2 +-
tools/testing/selftests/bpf/test_doc_build.sh | 10 ++++++++--
tools/testing/selftests/bpf/test_maps.c | 2 +-
5 files changed, 19 insertions(+), 5 deletions(-)

--
2.32.0




2021-08-20 03:00:05

by Li Zhijian

[permalink] [raw]
Subject: [PATCH v2 5/5] selftests/bpf: exit with KSFT_SKIP if no Makefile found

This would happend when we run the tests after install kselftests
root@lkp-skl-d01 ~# /kselftests/run_kselftest.sh -t bpf:test_doc_build.sh
TAP version 13
1..1
# selftests: bpf: test_doc_build.sh
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_ADDRESS = "en_US.UTF-8",
LC_NAME = "en_US.UTF-8",
LC_MONETARY = "en_US.UTF-8",
LC_PAPER = "en_US.UTF-8",
LC_IDENTIFICATION = "en_US.UTF-8",
LC_TELEPHONE = "en_US.UTF-8",
LC_MEASUREMENT = "en_US.UTF-8",
LC_TIME = "en_US.UTF-8",
LC_NUMERIC = "en_US.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
# skip: bpftool files not found!
#
ok 1 selftests: bpf: test_doc_build.sh # SKIP

Signed-off-by: Li Zhijian <[email protected]>
---
tools/testing/selftests/bpf/test_bpftool_build.sh | 2 +-
tools/testing/selftests/bpf/test_doc_build.sh | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/test_bpftool_build.sh b/tools/testing/selftests/bpf/test_bpftool_build.sh
index ac349a5cea7e..b03a87571592 100755
--- a/tools/testing/selftests/bpf/test_bpftool_build.sh
+++ b/tools/testing/selftests/bpf/test_bpftool_build.sh
@@ -22,7 +22,7 @@ KDIR_ROOT_DIR=$(realpath $PWD/$SCRIPT_REL_DIR/../../../../)
cd $KDIR_ROOT_DIR
if [ ! -e tools/bpf/bpftool/Makefile ]; then
echo -e "skip: bpftool files not found!\n"
- exit 0
+ exit 4 # KSFT_SKIP=4
fi

ERROR=0
diff --git a/tools/testing/selftests/bpf/test_doc_build.sh b/tools/testing/selftests/bpf/test_doc_build.sh
index d67ced95a6cf..679cf968c7d1 100755
--- a/tools/testing/selftests/bpf/test_doc_build.sh
+++ b/tools/testing/selftests/bpf/test_doc_build.sh
@@ -10,6 +10,11 @@ KDIR_ROOT_DIR=$(realpath $SCRIPT_REL_DIR/../../../../)
SCRIPT_REL_DIR=$(dirname $(realpath --relative-to=$KDIR_ROOT_DIR $SCRIPT_REL_PATH))
cd $KDIR_ROOT_DIR

+if [ ! -e $PWD/$SCRIPT_REL_DIR/Makefile ]; then
+ echo -e "skip: bpftool files not found!\n"
+ exit 4 # KSFT_SKIP=4
+fi
+
for tgt in docs docs-clean; do
make -s -C $PWD/$SCRIPT_REL_DIR $tgt;
done
--
2.32.0