Skip to contentSkip to conversation

selftests: run test_printf module

PATCH New Kees Cook 1 participant 1 message Sep 29, 2015 Kselftest

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 selftests: run test_printf module

This runs to test_printf module to make sure printf is operating sanely.

---
Designed for us with "test_printf: test printf family at runtime":
http://www.spinics.net/lists/kernel/msg2083336.html
http://www.spinics.net/lists/kernel/msg2085894.html

---
 tools/testing/selftests/Makefile      |  1 +
 tools/testing/selftests/lib/Makefile  |  8 ++++++++
 tools/testing/selftests/lib/printf.sh | 10 ++++++++++
 3 files changed, 19 insertions(+)
 create mode 100644 tools/testing/selftests/lib/Makefile
 create mode 100755 tools/testing/selftests/lib/printf.sh
tools/testing/selftests/Makefile +1 -0
index cfe121353eec..4b4957b8df4e 100644
@@ -6,6 +6,7 @@ TARGETS += firmware
 TARGETS += ftrace
 TARGETS += futex
 TARGETS += kcmp
+TARGETS += lib
 TARGETS += membarrier
 TARGETS += memfd
 TARGETS += memory-hotplug
tools/testing/selftests/lib/Makefile new file +8 -0
new file mode 100644
index 000000000000..47147b968514
@@ -0,0 +1,8 @@
+# Makefile for lib/ function selftests
+
+# No binaries, but make sure arg-less "make" doesn't trigger "run_tests"
+all:
+
+TEST_PROGS := printf.sh
+
+include ../lib.mk
tools/testing/selftests/lib/printf.sh new file +10 -0
new file mode 100755
index 000000000000..4fdc70fe6980
@@ -0,0 +1,10 @@
+#!/bin/sh
+# Runs printf infrastructure using test_printf kernel module
+
+if /sbin/modprobe -q test_printf; then
+	/sbin/modprobe -q -r test_printf
+	echo "printf: ok"
+else
+	echo "printf: [FAIL]"
+	exit 1
+fi
Signature · 6 lines
1.9.1


-- 
Kees Cook
Chrome OS Security