Skip to contentSkip to conversation

Kselftest update for 4.4-rc1

GIT PULL Shuah Khan 1 participant 1 message Nov 9, 2015

Subsystems (6)
lore
Share & tools
lore

Shuah Khan

author
#0 lore raw

Hi Linus,

Please pull the update for 4.4-rc1. This 12 patch update for 4.4-rc1 consists of a new pstore test and fixes to existing tests. diff attached.

thanks,
-- Shuah

----------------------------------------------------------------------

The following changes since commit 25cb62b76430a91cc6195f902e61c2cb84ade622:

Linux 4.3-rc5 (2015-10-11 11:09:45 -0700)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
tags/linux-kselftest-4.4-rc1

for you to fetch changes up to 3b5bab390181968e403886a45c70f9c13b5b6d29:

selftests: breakpoint: Actually build it (2015-11-03 16:55:08 -0700)

----------------------------------------------------------------
linux-kselftest-4.4-rc1

This 12 patch update for 4.4-rc1 consists of a new pstore test and fixes to existing tests.

----------------------------------------------------------------
Ben Hutchings (6):
selftests: Add missing #include directives
selftests: memfd: Stop unnecessary rebuilds
selftests: kprobe: Choose an always-defined function to probe
selftests: Make scripts executable
selftests: vm: Try harder to allocate huge pages
selftests: breakpoint: Actually build it

Chunyan Zhang (1):
selftests: memfd_test: Revised STACK_SIZE to make it 16-byte aligned

Hiraku Toyooka (2):
selftests/pstore: add pstore test script for pre-reboot selftests/pstore: add pstore test scripts going with reboot

Kees Cook (1):
selftests/seccomp: build and pass on arm64

Robert Sesek (1):
selftests/seccomp: Be more precise with syscall arguments.

Yuan Sun (1):
selftests: add .gitignore for efivarfs

 tools/testing/selftests/Makefile                   |   4 +
 tools/testing/selftests/breakpoints/Makefile       |   2 +-
 tools/testing/selftests/efivarfs/.gitignore        |   2 +
 .../ftrace/test.d/kprobe/add_and_remove.tc         |   2 +-
 .../selftests/ftrace/test.d/kprobe/busy_check.tc   |   2 +-
 .../selftests/ftrace/test.d/kprobe/kprobe_args.tc  |   2 +-
 .../ftrace/test.d/kprobe/kprobe_ftrace.tc          |  14 +--
 .../ftrace/test.d/kprobe/kretprobe_args.tc         |   2 +-
tools/testing/selftests/memfd/Makefile             |  12 +--
 tools/testing/selftests/memfd/memfd_test.c         |   3 +-
 tools/testing/selftests/memfd/run_fuse_test.sh     |   0
 tools/testing/selftests/mqueue/mq_open_tests.c     |   1 +
 tools/testing/selftests/mqueue/mq_perf_tests.c     |   1 +
 tools/testing/selftests/pstore/Makefile            |  15 +++
 tools/testing/selftests/pstore/common_tests        |  83 +++++++++++++++
 tools/testing/selftests/pstore/pstore_crash_test   |  30 ++++++
 .../selftests/pstore/pstore_post_reboot_tests      |  77 ++++++++++++++
 tools/testing/selftests/pstore/pstore_tests        |  30 ++++++
 tools/testing/selftests/seccomp/seccomp_bpf.c      | 117
+++++++++++++++------
 .../selftests/static_keys/test_static_keys.sh      |   0
 tools/testing/selftests/timers/nanosleep.c         |   1 +
 tools/testing/selftests/vm/run_vmtests             |  15 ++-
 22 files changed, 362 insertions(+), 53 deletions(-)
 create mode 100644 tools/testing/selftests/efivarfs/.gitignore
 mode change 100644 => 100755 tools/testing/selftests/memfd/run_fuse_test.sh
 create mode 100644 tools/testing/selftests/pstore/Makefile
 create mode 100755 tools/testing/selftests/pstore/common_tests
 create mode 100755 tools/testing/selftests/pstore/pstore_crash_test
 create mode 100755 tools/testing/selftests/pstore/pstore_post_reboot_tests
 create mode 100755 tools/testing/selftests/pstore/pstore_tests
 mode change 100644 => 100755

tools/testing/selftests/static_keys/test_static_keys.sh

--------------------------------------------------------------------------

Signature · 5 lines
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
[email protected] | (970) 217-8978
tools/testing/selftests/Makefile +4 -0
index cfe1213..2458288 100644
@@ -13,6 +13,7 @@ TARGETS += mount
 TARGETS += mqueue
 TARGETS += net
 TARGETS += powerpc
+TARGETS += pstore
 TARGETS += ptrace
 TARGETS += seccomp
 TARGETS += size
@@ -65,6 +66,9 @@ clean_hotplug:
 		make -C $$TARGET clean; \
 	done;
 
+run_pstore_crash:
+	make -C pstore run_crash
+
 INSTALL_PATH ?= install
 INSTALL_PATH := $(abspath $(INSTALL_PATH))
 ALL_SCRIPT := $(INSTALL_PATH)/run_kselftest.sh
tools/testing/selftests/breakpoints/Makefile +1 -1
index d27108b..c0d9570 100644
@@ -6,7 +6,7 @@ ifeq ($(ARCH),x86)
 TEST_PROGS := breakpoint_test
 endif
 
-all:
+all: $(TEST_PROGS)
 
 include ../lib.mk
 
tools/testing/selftests/efivarfs/.gitignore new file +2 -0
new file mode 100644
index 0000000..3361849
@@ -0,0 +1,2 @@
+create-read
+open-unlink
tools/testing/selftests/ftrace/test.d/kprobe/add_and_remove.tc +1 -1
index a5a4262..c3843ed 100644
@@ -5,7 +5,7 @@
 
 echo 0 > events/enable
 echo > kprobe_events
-echo p:myevent do_fork > kprobe_events
+echo p:myevent _do_fork > kprobe_events
 grep myevent kprobe_events
 test -d events/kprobes/myevent
 echo > kprobe_events
tools/testing/selftests/ftrace/test.d/kprobe/busy_check.tc +1 -1
index d8c7bb6..74507db 100644
@@ -5,7 +5,7 @@
 
 echo 0 > events/enable
 echo > kprobe_events
-echo p:myevent do_fork > kprobe_events
+echo p:myevent _do_fork > kprobe_events
 test -d events/kprobes/myevent
 echo 1 > events/kprobes/myevent/enable
 echo > kprobe_events && exit 1 # this must fail
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args.tc +1 -1
index c45ee27..64949d4 100644
@@ -5,7 +5,7 @@
 
 echo 0 > events/enable
 echo > kprobe_events
-echo 'p:testprobe do_fork $stack $stack0 +0($stack)' > kprobe_events
+echo 'p:testprobe _do_fork $stack $stack0 +0($stack)' > kprobe_events
 grep testprobe kprobe_events
 test -d events/kprobes/testprobe
 echo 1 > events/kprobes/testprobe/enable
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc +7 -7
index ab41d2b..d6f2f49 100644
@@ -6,31 +6,31 @@ grep function available_tracers || exit_unsupported # this is configurable
 
 # prepare
 echo nop > current_tracer
-echo do_fork > set_ftrace_filter
+echo _do_fork > set_ftrace_filter
 echo 0 > events/enable
 echo > kprobe_events
-echo 'p:testprobe do_fork' > kprobe_events
+echo 'p:testprobe _do_fork' > kprobe_events
 
 # kprobe on / ftrace off
 echo 1 > events/kprobes/testprobe/enable
 echo > trace
 ( echo "forked")
 grep testprobe trace
-! grep 'do_fork <-' trace
+! grep '_do_fork <-' trace
 
 # kprobe on / ftrace on
 echo function > current_tracer
 echo > trace
 ( echo "forked")
 grep testprobe trace
-grep 'do_fork <-' trace
+grep '_do_fork <-' trace
 
 # kprobe off / ftrace on
 echo 0 > events/kprobes/testprobe/enable
 echo > trace
 ( echo "forked")
 ! grep testprobe trace
-grep 'do_fork <-' trace
+grep '_do_fork <-' trace
 
 # kprobe on / ftrace on
 echo 1 > events/kprobes/testprobe/enable
@@ -38,14 +38,14 @@ echo function > current_tracer
 echo > trace
 ( echo "forked")
 grep testprobe trace
-grep 'do_fork <-' trace
+grep '_do_fork <-' trace
 
 # kprobe on / ftrace off
 echo nop > current_tracer
 echo > trace
 ( echo "forked")
 grep testprobe trace
-! grep 'do_fork <-' trace
+! grep '_do_fork <-' trace
 
 # cleanup
 echo nop > current_tracer
tools/testing/selftests/ftrace/test.d/kprobe/kretprobe_args.tc +1 -1
index 3171798..0d09546 100644
@@ -5,7 +5,7 @@
 
 echo 0 > events/enable
 echo > kprobe_events
-echo 'r:testprobe2 do_fork $retval' > kprobe_events
+echo 'r:testprobe2 _do_fork $retval' > kprobe_events
 grep testprobe2 kprobe_events
 test -d events/kprobes/testprobe2
 echo 1 > events/kprobes/testprobe2/enable
tools/testing/selftests/memfd/Makefile +6 -6
index 3e7eb79..fd396ac 100644
@@ -4,16 +4,16 @@ CFLAGS += -I../../../../include/uapi/
 CFLAGS += -I../../../../include/
 CFLAGS += -I../../../../usr/include/
 
-all:
-	$(CC) $(CFLAGS) memfd_test.c -o memfd_test
-
 TEST_PROGS := memfd_test
 
+all: $(TEST_PROGS)
+
 include ../lib.mk
 
-build_fuse:
-	$(CC) $(CFLAGS) fuse_mnt.c `pkg-config fuse --cflags --libs` -o fuse_mnt
-	$(CC) $(CFLAGS) fuse_test.c -o fuse_test
+build_fuse: fuse_mnt fuse_test
+
+fuse_mnt.o: CFLAGS += $(shell pkg-config fuse --cflags)
+fuse_mnt: LDFLAGS += $(shell pkg-config fuse --libs)
 
 run_fuse: build_fuse
 	@./run_fuse_test.sh || echo "fuse_test: [FAIL]"
tools/testing/selftests/memfd/memfd_test.c +2 -1
index 0b9eafb..2654689 100644
@@ -15,10 +15,11 @@
 #include <sys/mman.h>
 #include <sys/stat.h>
 #include <sys/syscall.h>
+#include <sys/wait.h>
 #include <unistd.h>
 
 #define MFD_DEF_SIZE 8192
-#define STACK_SIZE 65535
+#define STACK_SIZE 65536
 
 static int sys_memfd_create(const char *name,
 			    unsigned int flags)
tools/testing/selftests/memfd/run_fuse_test.sh +0 -0
old mode 100644
new mode 100755
tools/testing/selftests/mqueue/mq_open_tests.c +1 -0
index 9c1a5d35..e0a74bd 100644
@@ -31,6 +31,7 @@
 #include <sys/resource.h>
 #include <sys/stat.h>
 #include <mqueue.h>
+#include <error.h>
 
 static char *usage =
 "Usage:\n"
tools/testing/selftests/mqueue/mq_perf_tests.c +1 -0
index 8519e9e..8188f72 100644
@@ -37,6 +37,7 @@
 #include <sys/stat.h>
 #include <mqueue.h>
 #include <popt.h>
+#include <error.h>
 
 static char *usage =
 "Usage:\n"
tools/testing/selftests/pstore/Makefile new file +15 -0
new file mode 100644
index 0000000..bd7abe2
@@ -0,0 +1,15 @@
+# Makefile for pstore selftests.
+# Expects pstore backend is registered.
+
+all:
+
+TEST_PROGS := pstore_tests pstore_post_reboot_tests
+TEST_FILES := common_tests pstore_crash_test
+
+include ../lib.mk
+
+run_crash:
+	@sh pstore_crash_test || { echo "pstore_crash_test: [FAIL]"; exit 1; }
+
+clean:
+	rm -rf logs/* *uuid
tools/testing/selftests/pstore/common_tests new file +83 -0

83 lines not on this page · raw message

tools/testing/selftests/pstore/pstore_crash_test new file +30 -0
new file mode 100755
index 0000000..1a4afe5
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+# pstore_crash_test - Pstore test shell script which causes crash and reboot
+#
+# Copyright (C) Hitachi Ltd., 2015
+#  Written by Hiraku Toyooka <[email protected]>
+#
+# Released under the terms of the GPL v2.
+
+# exit if pstore backend is not registered
+. ./common_tests
+
+prlog "Causing kernel crash ..."
+
+# enable all functions triggered by sysrq
+echo 1 > /proc/sys/kernel/sysrq
+# setting to reboot in 3 seconds after panic
+echo 3 > /proc/sys/kernel/panic
+
+# save uuid file by different name because next test execution will replace it.
+mv $TOP_DIR/uuid $TOP_DIR/prev_uuid
+
+# create a file as reboot flag
+touch $REBOOT_FLAG
+sync
+
+# cause crash
+# Note: If you use kdump and want to see kmesg-* files after reboot, you should
+#       specify 'crash_kexec_post_notifiers' in 1st kernel's cmdline.
+echo c > /proc/sysrq-trigger
tools/testing/selftests/pstore/pstore_post_reboot_tests new file +77 -0

77 lines not on this page · raw message

tools/testing/selftests/pstore/pstore_tests new file +30 -0
new file mode 100755
index 0000000..f25d2a3
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+# pstore_tests - Check pstore's behavior before crash/reboot
+#
+# Copyright (C) Hitachi Ltd., 2015
+#  Written by Hiraku Toyooka <[email protected]>
+#
+# Released under the terms of the GPL v2.
+
+. ./common_tests
+
+prlog -n "Checking pstore console is registered ... "
+dmesg | grep -q "console \[pstore"
+show_result $?
+
+prlog -n "Checking /dev/pmsg0 exists ... "
+test -e /dev/pmsg0
+show_result $?
+
+prlog -n "Writing unique string to /dev/pmsg0 ... "
+if [ -e "/dev/pmsg0" ]; then
+    echo "${TEST_STRING_PATTERN}""$UUID" > /dev/pmsg0
+    show_result $?
+    echo "$UUID" > $TOP_DIR/uuid
+else
+    prlog "FAIL"
+    rc=1
+fi
+
+exit $rc
tools/testing/selftests/seccomp/seccomp_bpf.c +84 -33

258 lines not on this page · raw message

tools/testing/selftests/static_keys/test_static_keys.sh +0 -0
old mode 100644
new mode 100755
tools/testing/selftests/timers/nanosleep.c +1 -0
index 8a3c29d..ff942ff 100644
@@ -19,6 +19,7 @@
  *   GNU General Public License for more details.
  */
 
+#include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <time.h>
tools/testing/selftests/vm/run_vmtests +14 -1
index 9179ce8..97ed1b2 100755
@@ -20,13 +20,26 @@ done < /proc/meminfo
 if [ -n "$freepgs" ] && [ -n "$pgsize" ]; then
 	nr_hugepgs=`cat /proc/sys/vm/nr_hugepages`
 	needpgs=`expr $needmem / $pgsize`
-	if [ $freepgs -lt $needpgs ]; then
+	tries=2
+	while [ $tries -gt 0 ] && [ $freepgs -lt $needpgs ]; do
 		lackpgs=$(( $needpgs - $freepgs ))
+		echo 3 > /proc/sys/vm/drop_caches
 		echo $(( $lackpgs + $nr_hugepgs )) > /proc/sys/vm/nr_hugepages
 		if [ $? -ne 0 ]; then
 			echo "Please run this test as root"
 			exit 1
 		fi
+		while read name size unit; do
+			if [ "$name" = "HugePages_Free:" ]; then
+				freepgs=$size
+			fi
+		done < /proc/meminfo
+		tries=$((tries - 1))
+	done
+	if [ $freepgs -lt $needpgs ]; then
+		printf "Not enough huge pages available (%d < %d)\n" \
+		       $freepgs $needpgs
+		exit 1
 	fi
 else
 	echo "no hugetlbfs support in kernel?"