summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2021-10-23 00:38:25 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-10-25 09:13:46 +0200
commit149538cd55cad138b6eaa4dc4735c28f53eb5d32 (patch)
tree1d65886682cb6dca438546bebd49385426c11c6f
parentMerge tag 'soundwire-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/g... (diff)
downloadlinux-149538cd55cad138b6eaa4dc4735c28f53eb5d32.tar.xz
linux-149538cd55cad138b6eaa4dc4735c28f53eb5d32.zip
selftests/lkdtm: Add way to repeat a test
Some LKDTM tests need to be run more than once (usually to setup and then later trigger). Until now, the only case was the SOFT_LOCKUP test, which wasn't useful to run in the bulk selftests. The coming stack canary checking needs to run twice, so support this with a new test output prefix "repeat". Signed-off-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20211022223826.330653-2-keescook@chromium.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rwxr-xr-xtools/testing/selftests/lkdtm/run.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/testing/selftests/lkdtm/run.sh b/tools/testing/selftests/lkdtm/run.sh
index e95e79bd3126..95e904959207 100755
--- a/tools/testing/selftests/lkdtm/run.sh
+++ b/tools/testing/selftests/lkdtm/run.sh
@@ -56,8 +56,14 @@ if echo "$test" | grep -q '^#' ; then
fi
# If no expected output given, assume an Oops with back trace is success.
+repeat=1
if [ -z "$expect" ]; then
expect="call trace:"
+else
+ if echo "$expect" | grep -q '^repeat:' ; then
+ repeat=$(echo "$expect" | cut -d' ' -f1 | cut -d: -f2)
+ expect=$(echo "$expect" | cut -d' ' -f2-)
+ fi
fi
# Prepare log for report checking
@@ -83,7 +89,9 @@ dmesg > "$DMESG"
# the signal that killed the subprocess, we must ignore the failure and
# continue. However we don't silence stderr since there might be other
# useful details reported there in the case of other unexpected conditions.
-echo "$test" | cat >"$TRIGGER" || true
+for i in $(seq 1 $repeat); do
+ echo "$test" | cat >"$TRIGGER" || true
+done
# Record and dump the results
dmesg | comm --nocheck-order -13 "$DMESG" - > "$LOG" || true