aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-03-17 22:37:08 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-03-17 22:37:08 -0400
commit3d15cfdb1b77536c205d8e49c0312219ddf162ec (patch)
tree8615e83fc3765920be21e5bc2e157862b42d8d29
parent5cd0911a9e0e408f28079a5e36a981217bf47520 (diff)
parent6accd8e9bf22749f621fb7fb57995fa65f4cd873 (diff)
Merge tag 'linux-kselftest-4.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
Pull Kselftest updates from Shuah Khan: "This update for Kselftest adds: - A new feature to create test-specific kconfig fragments. This feature helps configure Kselftests to test specific Kernel Configuration options as opposed to defconfig. - A new test for Media Controller API - A few fixes" * tag 'linux-kselftest-4.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: selftests: media_dcevice_test fix usage information selftests: media_dcevice_test fix to handle ioctl failure case selftests: add missing .gitignore file or entry Makefile: add kselftest-merge selftests: create test-specific kconfig fragments selftests: breakpoint: add step_after_suspend_test selftests: add a new test for Media Controller API
-rw-r--r--Makefile10
-rw-r--r--tools/testing/selftests/breakpoints/.gitignore1
-rw-r--r--tools/testing/selftests/breakpoints/Makefile4
-rw-r--r--tools/testing/selftests/breakpoints/step_after_suspend_test.c218
-rw-r--r--tools/testing/selftests/cpu-hotplug/config2
-rw-r--r--tools/testing/selftests/firmware/config1
-rw-r--r--tools/testing/selftests/ftrace/config1
-rw-r--r--tools/testing/selftests/ipc/.gitignore1
-rw-r--r--tools/testing/selftests/ipc/config2
-rw-r--r--tools/testing/selftests/media_tests/.gitignore1
-rw-r--r--tools/testing/selftests/media_tests/Makefile7
-rw-r--r--tools/testing/selftests/media_tests/media_device_test.c95
-rw-r--r--tools/testing/selftests/memory-hotplug/config4
-rw-r--r--tools/testing/selftests/mount/config2
-rw-r--r--tools/testing/selftests/net/config3
-rw-r--r--tools/testing/selftests/pstore/config4
-rw-r--r--tools/testing/selftests/seccomp/config2
-rw-r--r--tools/testing/selftests/static_keys/config1
-rw-r--r--tools/testing/selftests/user/config1
-rw-r--r--tools/testing/selftests/vm/config1
-rw-r--r--tools/testing/selftests/zram/config2
21 files changed, 362 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 7b3ecdcdc6c1..6798c6b4775d 100644
--- a/Makefile
+++ b/Makefile
@@ -1087,6 +1087,14 @@ kselftest:
1087kselftest-clean: 1087kselftest-clean:
1088 $(Q)$(MAKE) -C tools/testing/selftests clean 1088 $(Q)$(MAKE) -C tools/testing/selftests clean
1089 1089
1090PHONY += kselftest-merge
1091kselftest-merge:
1092 $(if $(wildcard $(objtree)/.config),, $(error No .config exists, config your kernel first!))
1093 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
1094 -m $(objtree)/.config \
1095 $(srctree)/tools/testing/selftests/*/config
1096 +$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
1097
1090# --------------------------------------------------------------------------- 1098# ---------------------------------------------------------------------------
1091# Modules 1099# Modules
1092 1100
@@ -1295,6 +1303,8 @@ help:
1295 @echo ' Build, install, and boot kernel before' 1303 @echo ' Build, install, and boot kernel before'
1296 @echo ' running kselftest on it' 1304 @echo ' running kselftest on it'
1297 @echo ' kselftest-clean - Remove all generated kselftest files' 1305 @echo ' kselftest-clean - Remove all generated kselftest files'
1306 @echo ' kselftest-merge - Merge all the config dependencies of kselftest to existed'
1307 @echo ' .config.'
1298 @echo '' 1308 @echo ''
1299 @echo 'Kernel packaging:' 1309 @echo 'Kernel packaging:'
1300 @$(MAKE) $(build)=$(package-dir) help 1310 @$(MAKE) $(build)=$(package-dir) help
diff --git a/tools/testing/selftests/breakpoints/.gitignore b/tools/testing/selftests/breakpoints/.gitignore
index 9b3193d06608..a23bb4a6f06c 100644
--- a/tools/testing/selftests/breakpoints/.gitignore
+++ b/tools/testing/selftests/breakpoints/.gitignore
@@ -1 +1,2 @@
1breakpoint_test 1breakpoint_test
2step_after_suspend_test
diff --git a/tools/testing/selftests/breakpoints/Makefile b/tools/testing/selftests/breakpoints/Makefile
index c0d957015f52..74e533fd4bc5 100644
--- a/tools/testing/selftests/breakpoints/Makefile
+++ b/tools/testing/selftests/breakpoints/Makefile
@@ -6,9 +6,11 @@ ifeq ($(ARCH),x86)
6TEST_PROGS := breakpoint_test 6TEST_PROGS := breakpoint_test
7endif 7endif
8 8
9TEST_PROGS += step_after_suspend_test
10
9all: $(TEST_PROGS) 11all: $(TEST_PROGS)
10 12
11include ../lib.mk 13include ../lib.mk
12 14
13clean: 15clean:
14 rm -fr breakpoint_test 16 rm -fr breakpoint_test step_after_suspend_test
diff --git a/tools/testing/selftests/breakpoints/step_after_suspend_test.c b/tools/testing/selftests/breakpoints/step_after_suspend_test.c
new file mode 100644
index 000000000000..60b8a95dac26
--- /dev/null
+++ b/tools/testing/selftests/breakpoints/step_after_suspend_test.c
@@ -0,0 +1,218 @@
1/*
2 * Copyright (C) 2016 Google, Inc.
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 */
14
15#define _GNU_SOURCE
16
17#include <errno.h>
18#include <fcntl.h>
19#include <sched.h>
20#include <signal.h>
21#include <stdbool.h>
22#include <stdio.h>
23#include <string.h>
24#include <unistd.h>
25#include <sys/ptrace.h>
26#include <sys/stat.h>
27#include <sys/timerfd.h>
28#include <sys/types.h>
29#include <sys/wait.h>
30
31#include "../kselftest.h"
32
33void child(int cpu)
34{
35 cpu_set_t set;
36
37 CPU_ZERO(&set);
38 CPU_SET(cpu, &set);
39 if (sched_setaffinity(0, sizeof(set), &set) != 0) {
40 perror("sched_setaffinity() failed");
41 _exit(1);
42 }
43
44 if (ptrace(PTRACE_TRACEME, 0, NULL, NULL) != 0) {
45 perror("ptrace(PTRACE_TRACEME) failed");
46 _exit(1);
47 }
48
49 if (raise(SIGSTOP) != 0) {
50 perror("raise(SIGSTOP) failed");
51 _exit(1);
52 }
53
54 _exit(0);
55}
56
57bool run_test(int cpu)
58{
59 int status;
60 pid_t pid = fork();
61 pid_t wpid;
62
63 if (pid < 0) {
64 perror("fork() failed");
65 return false;
66 }
67 if (pid == 0)
68 child(cpu);
69
70 wpid = waitpid(pid, &status, __WALL);
71 if (wpid != pid) {
72 perror("waitpid() failed");
73 return false;
74 }
75 if (!WIFSTOPPED(status)) {
76 printf("child did not stop\n");
77 return false;
78 }
79 if (WSTOPSIG(status) != SIGSTOP) {
80 printf("child did not stop with SIGSTOP\n");
81 return false;
82 }
83
84 if (ptrace(PTRACE_SINGLESTEP, pid, NULL, NULL) < 0) {
85 if (errno == EIO) {
86 printf("ptrace(PTRACE_SINGLESTEP) not supported on this architecture\n");
87 ksft_exit_skip();
88 }
89 perror("ptrace(PTRACE_SINGLESTEP) failed");
90 return false;
91 }
92
93 wpid = waitpid(pid, &status, __WALL);
94 if (wpid != pid) {
95 perror("waitpid() failed");
96 return false;
97 }
98 if (WIFEXITED(status)) {
99 printf("child did not single-step\n");
100 return false;
101 }
102 if (!WIFSTOPPED(status)) {
103 printf("child did not stop\n");
104 return false;
105 }
106 if (WSTOPSIG(status) != SIGTRAP) {
107 printf("child did not stop with SIGTRAP\n");
108