aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools/testing/selftests/run_kselftest.sh
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2020-09-28 13:26:48 -0700
committerShuah Khan <skhan@linuxfoundation.org>2020-10-07 07:58:54 -0600
commitf0f0a5df4e081e7a659929303fe83450edce9a3e (patch)
treefe4c52731e16b926d84450800658269123ea8b63 /tools/testing/selftests/run_kselftest.sh
parentselftests: Add missing gitignore entries (diff)
downloadwireguard-linux-f0f0a5df4e081e7a659929303fe83450edce9a3e.tar.xz
wireguard-linux-f0f0a5df4e081e7a659929303fe83450edce9a3e.zip
selftests: Extract run_kselftest.sh and generate stand-alone test list
Instead of building a script on the fly (which just repeats the same thing for each test collection), move the script out of the Makefile and into run_kselftest.sh, which reads kselftest-list.txt. Adjust the emit_tests target to report each test on a separate line so that test running tools (e.g. LAVA) can easily remove individual tests (for example, as seen in [1]). [1] https://github.com/Linaro/test-definitions/pull/208/commits/2e7b62155e4998e54ac0587704932484d4ff84c8 Signed-off-by: Kees Cook <keescook@chromium.org> Tested-by: Naresh Kamboju <naresh.kamboju@linaro.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to '')
-rwxr-xr-xtools/testing/selftests/run_kselftest.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/tools/testing/selftests/run_kselftest.sh b/tools/testing/selftests/run_kselftest.sh
new file mode 100755
index 000000000000..8b0ad4766d78
--- /dev/null
+++ b/tools/testing/selftests/run_kselftest.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+#
+# Run installed kselftest tests.
+#
+BASE_DIR=$(realpath $(dirname $0))
+cd $BASE_DIR
+TESTS="$BASE_DIR"/kselftest-list.txt
+if [ ! -r "$TESTS" ] ; then
+ echo "$0: Could not find list of tests to run ($TESTS)" >&2
+ exit 1
+fi
+available="$(cat "$TESTS")"
+
+. ./kselftest/runner.sh
+ROOT=$PWD
+
+if [ "$1" = "--summary" ] ; then
+ logfile="$BASE_DIR"/output.log
+ cat /dev/null > $logfile
+fi
+
+collections=$(echo "$available" | cut -d: -f1 | uniq)
+for collection in $collections ; do
+ [ -w /dev/kmsg ] && echo "kselftest: Running tests in $collection" >> /dev/kmsg
+ tests=$(echo "$available" | grep "^$collection:" | cut -d: -f2)
+ (cd "$collection" && run_many $tests)
+done