selftests, bpftool: Skip the build test if not in tree
authorJakub Kicinski <jakub.kicinski@netronome.com>
Tue, 19 Nov 2019 10:50:10 +0000 (10:50 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 25 Nov 2019 00:58:45 +0000 (16:58 -0800)
If selftests are copied over to another machine/location
for execution the build test of bpftool will obviously
not work, since the sources are not copied.
Skip it if we can't find bpftool's Makefile.

Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20191119105010.19189-3-quentin.monnet@netronome.com
tools/testing/selftests/bpf/test_bpftool_build.sh

index 1fc6f6247f9b1bc03f0d33ed25c7696b9d550a14..ac349a5cea7ee5eb4ce25625def69116e8056c77 100755 (executable)
@@ -20,6 +20,10 @@ SCRIPT_REL_PATH=$(realpath --relative-to=$PWD $0)
 SCRIPT_REL_DIR=$(dirname $SCRIPT_REL_PATH)
 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
+fi
 
 ERROR=0
 TMPDIR=