Skip to contentSkip to conversation

kselftest/lkdtm: Create selftest driving scripts for LKDTM

PATCH New keescook at chromium.org (Kees Cook) 1 participant 1 message Apr 9, 2019

Subsystems (2)
lore
Share & tools
lore

keescook at chromium.org (Kees Cook)

#0 lore raw

PATCH 1/1 kselftest/lkdtm: Create selftest driving scripts for LKDTM

This adds most of the non-system-crashing selftests that exist in LKDTM. The ones that leave the system in an unstable state are marked as "SKIP" in the test run. Since output can change based on architecture and other kernel configs, all output is reported during the tests.

Example output:

	# cd tools/testing/selftests
	# make --silent -C lkdtm run_tests
	TAP version 13
	1..64 selftests: lkdtm
	# selftests: lkdtm: PANIC.sh
	# PANIC: crashes entire system [SKIP]
	not ok 1 selftests: lkdtm: PANIC.sh # SKIP
	# selftests: lkdtm: BUG.sh
	# [19716.955023] lkdtm: Performing direct entry BUG
	# [19716.956236] ------------[ cut here ]------------
	# [19716.957318] kernel BUG at drivers/misc/lkdtm/bugs.c:63!
	...
	# BUG: saw 'call trace:': ok
	ok 2 selftests: lkdtm: BUG.sh
	...
Signed-off-by Kees Cook <keescook at chromium.org>
---
 MAINTAINERS                              |  1 +
 tools/testing/selftests/lkdtm/.gitignore |  1 +
 tools/testing/selftests/lkdtm/Makefile   | 11 +++
 tools/testing/selftests/lkdtm/config     |  1 +
 tools/testing/selftests/lkdtm/run.sh     | 86 ++++++++++++++++++++++++
 tools/testing/selftests/lkdtm/tests.txt  | 64 ++++++++++++++++++
 6 files changed, 164 insertions(+)
 create mode 100644 tools/testing/selftests/lkdtm/.gitignore
 create mode 100644 tools/testing/selftests/lkdtm/Makefile
 create mode 100644 tools/testing/selftests/lkdtm/config
 create mode 100755 tools/testing/selftests/lkdtm/run.sh
 create mode 100644 tools/testing/selftests/lkdtm/tests.txt
MAINTAINERS +1 -0
index 3e5a5d263f29..716d6f0fbd0c 100644
@@ -8976,6 +8976,7 @@ LINUX KERNEL DUMP TEST MODULE (LKDTM)
 M:	Kees Cook <keescook at chromium.org>
 S:	Maintained
 F:	drivers/misc/lkdtm/*
+F:	tools/testing/selftests/lkdtm/*
 
 LINUX KERNEL MEMORY CONSISTENCY MODEL (LKMM)
 M:	Alan Stern <stern at rowland.harvard.edu>
tools/testing/selftests/lkdtm/.gitignore new file +1 -0
new file mode 100644
index 000000000000..09df4a4da272
@@ -0,0 +1 @@
+[A-Z][A-Z]*.sh
tools/testing/selftests/lkdtm/Makefile new file +11 -0
new file mode 100644
index 000000000000..f322d281fd8e
@@ -0,0 +1,11 @@
+# SPDX-License-Identifier: GPL-2.0
+# Makefile for LKDTM regression tests
+
+include ../lib.mk
+
+# NOTE: $(OUTPUT) won't get default value if used before lib.mk
+TEST_GEN_PROGS = $(patsubst %,$(OUTPUT)/%.sh,$(shell awk '{print $$1}' tests.txt | sed -e 's/\#//'))
+all: $(TEST_GEN_PROGS)
+
+$(OUTPUT)/%: run.sh tests.txt
+	install -m 0744 run.sh $@
tools/testing/selftests/lkdtm/config new file +1 -0
new file mode 100644
index 000000000000..d874990e442b
@@ -0,0 +1 @@
+CONFIG_LKDTM=y
tools/testing/selftests/lkdtm/run.sh new file +86 -0

86 lines not on this page · raw message

tools/testing/selftests/lkdtm/tests.txt new file +64 -0

64 lines not on this page · raw message

Signature · 5 lines
2.17.1


-- 
Kees Cook