2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-21 03:33:59 +08:00
linux-next/tools/testing/selftests/run_kselftest.sh
Kees Cook f0f0a5df4e 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] 2e7b62155e

Signed-off-by: Kees Cook <keescook@chromium.org>
Tested-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2020-10-07 07:58:54 -06:00

29 lines
706 B
Bash
Executable File

#!/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