aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-05-08 23:43:30 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-05-08 23:43:30 -0400
commit2868b2513aa732a99ea4a0a6bf10dc93c1f3dac2 (patch)
treec8c772c63a4bbd9963c3f78aea701f5716177907 /tools
parent00d959333513a41959d3b85ba3e35320ec8844e5 (diff)
parent945f8f5f863321de0dc5c13b3d446d4dbf41531e (diff)
Merge tag 'linux-kselftest-4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
Pull kselftest updates from Shuah Khan: "This update consists of: - important fixes for build failures and clean target related warnings to address regressions introduced in commit 88baa78d1f31 ("selftests: remove duplicated all and clean target") - several minor spelling fixes in and log messages and comment blocks. - Enabling configs for better test coverage in ftrace, vm, and cpufreq tests. - .gitignore changes" * tag 'linux-kselftest-4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: (26 commits) selftests: x86: add missing executables to .gitignore selftests: watchdog: accept multiple params on command line selftests: create cpufreq kconfig fragments selftests: x86: override clean in lib.mk to fix warnings selftests: sync: override clean in lib.mk to fix warnings selftests: splice: override clean in lib.mk to fix warnings selftests: gpio: fix clean target to remove all generated files and dirs selftests: add gpio generated files to .gitignore selftests: powerpc: override clean in lib.mk to fix warnings selftests: gpio: override clean in lib.mk to fix warnings selftests: futex: override clean in lib.mk to fix warnings selftests: lib.mk: define CLEAN macro to allow Makefiles to override clean selftests: splice: fix clean target to not remove default_file_splice_read.sh selftests: gpio: add config fragment for gpio-mockup selftests: breakpoints: allow to cross-compile for aarch64/arm64 selftests/Makefile: Add missed PHONY targets selftests/vm/run_vmtests: Fix wrong comment selftests/Makefile: Add missed closing `"` in comment selftests/vm/run_vmtests: Polish output text selftests/timers: fix spelling mistake: "Asynchronous" ...
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/.gitignore4
-rw-r--r--tools/testing/selftests/Makefile4
-rw-r--r--tools/testing/selftests/breakpoints/Makefile2
-rw-r--r--tools/testing/selftests/cpufreq/config15
-rw-r--r--tools/testing/selftests/ftrace/config1
-rw-r--r--tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc2
-rw-r--r--tools/testing/selftests/futex/Makefile9
-rw-r--r--tools/testing/selftests/gpio/Makefile11
-rw-r--r--tools/testing/selftests/gpio/config2
-rw-r--r--tools/testing/selftests/lib.mk6
-rw-r--r--tools/testing/selftests/lib/config3
-rw-r--r--tools/testing/selftests/powerpc/Makefile3
-rw-r--r--tools/testing/selftests/splice/Makefile3
-rw-r--r--tools/testing/selftests/sync/Makefile3
-rw-r--r--tools/testing/selftests/timers/clocksource-switch.c2
-rw-r--r--tools/testing/selftests/vm/config1
-rw-r--r--tools/testing/selftests/vm/map_hugetlb.c2
-rw-r--r--tools/testing/selftests/vm/mlock2-tests.c12
-rw-r--r--tools/testing/selftests/vm/on-fault-limit.c2
-rwxr-xr-xtools/testing/selftests/vm/run_vmtests26
-rw-r--r--tools/testing/selftests/vm/thuge-gen.c2
-rw-r--r--tools/testing/selftests/watchdog/watchdog-test.c61
-rw-r--r--tools/testing/selftests/x86/.gitignore13
-rw-r--r--tools/testing/selftests/x86/Makefile3
24 files changed, 124 insertions, 68 deletions
diff --git a/tools/testing/selftests/.gitignore b/tools/testing/selftests/.gitignore
index f0600d20ce7d..91750352459d 100644
--- a/tools/testing/selftests/.gitignore
+++ b/tools/testing/selftests/.gitignore
@@ -1 +1,5 @@
1kselftest 1kselftest
2gpiogpio-event-mon
3gpiogpio-hammer
4gpioinclude/
5gpiolsgpio
diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index d8593f1251ec..26ce4f7168be 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -39,7 +39,7 @@ TARGETS += x86
39TARGETS += zram 39TARGETS += zram
40#Please keep the TARGETS list alphabetically sorted 40#Please keep the TARGETS list alphabetically sorted
41# Run "make quicktest=1 run_tests" or 41# Run "make quicktest=1 run_tests" or
42# "make quicktest=1 kselftest from top level Makefile 42# "make quicktest=1 kselftest" from top level Makefile
43 43
44TARGETS_HOTPLUG = cpu-hotplug 44TARGETS_HOTPLUG = cpu-hotplug
45TARGETS_HOTPLUG += memory-hotplug 45TARGETS_HOTPLUG += memory-hotplug
@@ -133,4 +133,4 @@ clean:
133 make OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\ 133 make OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
134 done; 134 done;
135 135
136.PHONY: install 136.PHONY: all run_tests hotplug run_hotplug clean_hotplug run_pstore_crash install clean
diff --git a/tools/testing/selftests/breakpoints/Makefile b/tools/testing/selftests/breakpoints/Makefile
index 72aa103e4141..6b214b7b10fb 100644
--- a/tools/testing/selftests/breakpoints/Makefile
+++ b/tools/testing/selftests/breakpoints/Makefile
@@ -5,7 +5,7 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
5ifeq ($(ARCH),x86) 5ifeq ($(ARCH),x86)
6TEST_GEN_PROGS := breakpoint_test 6TEST_GEN_PROGS := breakpoint_test
7endif 7endif
8ifeq ($(ARCH),aarch64) 8ifneq (,$(filter $(ARCH),aarch64 arm64))
9TEST_GEN_PROGS := breakpoint_test_arm64 9TEST_GEN_PROGS := breakpoint_test_arm64
10endif 10endif
11 11
diff --git a/tools/testing/selftests/cpufreq/config b/tools/testing/selftests/cpufreq/config
new file mode 100644
index 000000000000..27ff72ebd0f5
--- /dev/null
+++ b/tools/testing/selftests/cpufreq/config
@@ -0,0 +1,15 @@
1CONFIG_CPU_FREQ=y
2CONFIG_CPU_FREQ_STAT=y
3CONFIG_CPU_FREQ_GOV_POWERSAVE=y
4CONFIG_CPU_FREQ_GOV_USERSPACE=y
5CONFIG_CPU_FREQ_GOV_ONDEMAND=y
6CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
7CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y
8CONFIG_DEBUG_RT_MUTEXES=y
9CONFIG_DEBUG_PI_LIST=y
10CONFIG_DEBUG_SPINLOCK=y
11CONFIG_DEBUG_MUTEXES=y
12CONFIG_DEBUG_LOCK_ALLOC=y
13CONFIG_PROVE_LOCKING=y
14CONFIG_LOCKDEP=y
15CONFIG_DEBUG_ATOMIC_SLEEP=y
diff --git a/tools/testing/selftests/ftrace/config b/tools/testing/selftests/ftrace/config
index ef8214661612..8a1c9f949fe0 100644
--- a/tools/testing/selftests/ftrace/config
+++ b/tools/testing/selftests/ftrace/config
@@ -1 +1,2 @@
1CONFIG_KPROBES=y
1CONFIG_FTRACE=y 2CONFIG_FTRACE=y
diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
index 0a78705b43b2..c75faefb4fff 100644
--- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
@@ -26,7 +26,7 @@ check_types() {
26 test $X2 = $X3 26 test $X2 = $X3
27 test 0x$X3 = $3 27 test 0x$X3 = $3
28 28
29 B4=`printf "%x" $4` 29 B4=`printf "%02x" $4`
30 B3=`echo -n $X3 | tail -c 3 | head -c 2` 30 B3=`echo -n $X3 | tail -c 3 | head -c 2`
31 test $B3 = $B4 31 test $B3 = $B4
32} 32}
diff --git a/tools/testing/selftests/futex/Makefile b/tools/testing/selftests/futex/Makefile
index 653c5cd9e44d..e2fbb890aef9 100644
--- a/tools/testing/selftests/futex/Makefile
+++ b/tools/testing/selftests/futex/Makefile
@@ -8,7 +8,7 @@ include ../lib.mk
8 8
9all: 9all:
10 for DIR in $(SUBDIRS); do \ 10 for DIR in $(SUBDIRS); do \
11 BUILD_TARGET=$$OUTPUT/$$DIR; \ 11 BUILD_TARGET=$(OUTPUT)/$$DIR; \
12 mkdir $$BUILD_TARGET -p; \ 12 mkdir $$BUILD_TARGET -p; \
13 make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\ 13 make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
14 done 14 done
@@ -22,7 +22,7 @@ override define INSTALL_RULE
22 install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) 22 install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES)
23 23
24 @for SUBDIR in $(SUBDIRS); do \ 24 @for SUBDIR in $(SUBDIRS); do \
25 BUILD_TARGET=$$OUTPUT/$$SUBDIR; \ 25 BUILD_TARGET=$(OUTPUT)/$$SUBDIR; \
26 mkdir $$BUILD_TARGET -p; \ 26 mkdir $$BUILD_TARGET -p; \
27 $(MAKE) OUTPUT=$$BUILD_TARGET -C $$SUBDIR INSTALL_PATH=$(INSTALL_PATH)/$$SUBDIR install; \ 27 $(MAKE) OUTPUT=$$BUILD_TARGET -C $$SUBDIR INSTALL_PATH=$(INSTALL_PATH)/$$SUBDIR install; \
28 done; 28 done;
@@ -32,9 +32,10 @@ override define EMIT_TESTS
32 echo "./run.sh" 32 echo "./run.sh"
33endef 33endef
34 34
35clean: 35override define CLEAN
36 for DIR in $(SUBDIRS); do \ 36 for DIR in $(SUBDIRS); do \
37 BUILD_TARGET=$$OUTPUT/$$DIR; \ 37 BUILD_TARGET=$(OUTPUT)/$$DIR; \
38 mkdir $$BUILD_TARGET -p; \ 38 mkdir $$BUILD_TARGET -p; \
39 make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\ 39 make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
40 done 40 done
41endef
diff --git a/tools/testing/selftests/gpio/Makefile b/tools/testing/selftests/gpio/Makefile
index 205e4d10e085..298929df97e6 100644
--- a/tools/testing/selftests/gpio/Makefile
+++ b/tools/testing/selftests/gpio/Makefile
@@ -2,13 +2,20 @@
2TEST_PROGS := gpio-mockup.sh 2TEST_PROGS := gpio-mockup.sh
3TEST_FILES := gpio-mockup-sysfs.sh $(BINARIES) 3TEST_FILES := gpio-mockup-sysfs.sh $(BINARIES)
4BINARIES := gpio-mockup-chardev 4BINARIES := gpio-mockup-chardev
5EXTRA_PROGS := ../gpiogpio-event-mon ../gpiogpio-hammer ../gpiolsgpio
6EXTRA_DIRS := ../gpioinclude/
7EXTRA_OBJS := ../gpiogpio-event-mon-in.o ../gpiogpio-event-mon.o
8EXTRA_OBJS += ../gpiogpio-hammer-in.o ../gpiogpio-utils.o ../gpiolsgpio-in.o
9EXTRA_OBJS += ../gpiolsgpio.o
5 10
6include ../lib.mk 11include ../lib.mk
7 12
8all: $(BINARIES) 13all: $(BINARIES)
9 14
10clean: 15override define CLEAN
11 $(RM) $(BINARIES) 16 $(RM) $(BINARIES) $(EXTRA_PROGS) $(EXTRA_OBJS)
17 $(RM) -r $(EXTRA_DIRS)
18endef
12 19
13CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/ 20CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/
14LDLIBS += -lmount -I/usr/include/libmount 21LDLIBS += -lmount -I/usr/include/libmount
diff --git a/tools/testing/selftests/gpio/config b/tools/testing/selftests/gpio/config
new file mode 100644
index 000000000000..abaa6902b7b6
--- /dev/null
+++ b/tools/testing/selftests/gpio/config
@@ -0,0 +1,2 @@
1CONFIG_GPIOLIB=y
2CONFIG_GPIO_MOCKUP=m
diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 775c589ac3c0..959273c3a52e 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -51,8 +51,12 @@ endef
51emit_tests: 51emit_tests:
52 $(EMIT_TESTS) 52 $(EMIT_TESTS)
53 53
54clean: 54define CLEAN
55 $(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(EXTRA_CLEAN) 55 $(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(EXTRA_CLEAN)
56endef
57
58clean:
59 $(CLEAN)
56 60
57$(OUTPUT)/%:%.c 61$(OUTPUT)/%:%.c
58 $(LINK.c) $^ $(LDLIBS) -o $@ 62 $(LINK.c) $^ $(LDLIBS) -o $@
diff --git a/tools/testing/selftests/lib/config b/tools/testing/selftests/lib/config
new file mode 100644
index 000000000000..126933bcc950
--- /dev/null
+++ b/tools/testing/selftests/lib/config
@@ -0,0 +1,3 @@
1CONFIG_TEST_PRINTF=m
2CONFIG_TEST_BITMAP=m
3CONFIG_PRIME_NUMBERS=m
diff --git a/tools/testing/selftests/powerpc/Makefile b/tools/testing/selftests/powerpc/Makefile
index 03e1617367d3..72c3ac2323e1 100644
--- a/tools/testing/selftests/powerpc/Makefile
+++ b/tools/testing/selftests/powerpc/Makefile
@@ -60,12 +60,13 @@ override define EMIT_TESTS
60 done; 60 done;
61endef 61endef
62 62
63clean: 63override define CLEAN
64 @for TARGET in $(SUB_DIRS); do \ 64 @for TARGET in $(SUB_DIRS); do \
65 BUILD_TARGET=$(OUTPUT)/$$TARGET; \ 65 BUILD_TARGET=$(OUTPUT)/$$TARGET; \
66 $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean; \ 66 $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean; \
67 done; 67 done;
68 rm -f tags 68 rm -f tags
69endef
69 70
70tags: 71tags:
71 find . -name '*.c' -o -name '*.h' | xargs ctags 72 find . -name '*.c' -o -name '*.h' | xargs ctags
diff --git a/tools/testing/selftests/splice/Makefile b/tools/testing/selftests/splice/Makefile
index de51f439d4a6..9fc78e5e5451 100644
--- a/tools/testing/selftests/splice/Makefile
+++ b/tools/testing/selftests/splice/Makefile
@@ -4,5 +4,4 @@ all: $(TEST_PROGS) $(EXTRA)
4 4
5include ../lib.mk 5include ../lib.mk
6 6
7clean: 7EXTRA_CLEAN := $(EXTRA)
8 rm -fr $(TEST_PROGS) $(EXTRA)
diff --git a/tools/testing/selftests/sync/Makefile b/tools/testing/selftests/sync/Makefile
index 87ac400507c0..4981c6b6d050 100644
--- a/tools/testing/selftests/sync/Makefile
+++ b/tools/testing/selftests/sync/Makefile
@@ -20,5 +20,4 @@ TESTS += sync_stress_merge.o
20 20
21sync_test: $(OBJS) $(TESTS) 21sync_test: $(OBJS) $(TESTS)
22 22
23clean: 23EXTRA_CLEAN := sync_test $(OBJS) $(TESTS)
24 $(RM) sync_test $(OBJS) $(TESTS)
diff --git a/tools/testing/selftests/timers/clocksource-switch.c b/tools/testing/selftests/timers/clocksource-switch.c
index fd88e3025bed..5ff165373f8b 100644
--- a/tools/testing/selftests/timers/clocksource-switch.c
+++ b/tools/testing/selftests/timers/clocksource-switch.c
@@ -159,7 +159,7 @@ int main(int argv, char **argc)
159 } 159 }
160 160
161 161
162 printf("Running Asyncrhonous Switching Tests...\n"); 162 printf("Running Asynchronous Switching Tests...\n");
163 pid = fork(); 163 pid = fork();
164 if (!pid) 164 if (!pid)
165 return run_tests(60); 165 return run_tests(60);
diff --git a/tools/testing/selftests/vm/config b/tools/testing/selftests/vm/config
index 698c7ed28a26..1c0d76cb5adf 100644
--- a/tools/testing/selftests/vm/config
+++ b/tools/testing/selftests/vm/config
@@ -1 +1,2 @@
1CONFIG_SYSVIPC=y
1CONFIG_USERFAULTFD=y 2CONFIG_USERFAULTFD=y
diff --git a/tools/testing/selftests/vm/map_hugetlb.c b/tools/testing/selftests/vm/map_hugetlb.c
index addcd6fc1ecc..77687ab59f77 100644
--- a/tools/testing/selftests/vm/map_hugetlb.c
+++ b/tools/testing/selftests/vm/map_hugetlb.c
@@ -62,7 +62,7 @@ int main(void)
62 void *addr; 62 void *addr;
63 int ret; 63 int ret;
64 64
65 addr = mmap(ADDR, LENGTH, PROTECTION, FLAGS, 0, 0); 65 addr = mmap(ADDR, LENGTH, PROTECTION, FLAGS, -1, 0);
66 if (addr == MAP_FAILED) { 66 if (addr == MAP_FAILED) {
67 perror("mmap"); 67 perror("mmap");
68 exit(1); 68 exit(1);
diff --git a/tools/testing/selftests/vm/mlock2-tests.c b/tools/testing/selftests/vm/mlock2-tests.c
index ff0cda2b19c9..e5dbc87b4297 100644
--- a/tools/testing/selftests/vm/mlock2-tests.c
+++ b/tools/testing/selftests/vm/mlock2-tests.c
@@ -293,7 +293,7 @@ static int test_mlock_lock()
293 unsigned long page_size = getpagesize(); 293 unsigned long page_size = getpagesize();
294 294
295 map = mmap(NULL, 2 * page_size, PROT_READ | PROT_WRITE, 295 map = mmap(NULL, 2 * page_size, PROT_READ | PROT_WRITE,
296 MAP_ANONYMOUS | MAP_PRIVATE, 0, 0); 296 MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
297 if (map == MAP_FAILED) { 297 if (map == MAP_FAILED) {
298 perror("test_mlock_locked mmap"); 298 perror("test_mlock_locked mmap");
299 goto out; 299 goto out;
@@ -402,7 +402,7 @@ static int test_mlock_onfault()
402 unsigned long page_size = getpagesize(); 402 unsigned long page_size = getpagesize();
403 403
404 map = mmap(NULL, 2 * page_size, PROT_READ | PROT_WRITE, 404 map = mmap(NULL, 2 * page_size, PROT_READ | PROT_WRITE,
405 MAP_ANONYMOUS | MAP_PRIVATE, 0, 0); 405 MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
406 if (map == MAP_FAILED) { 406 if (map == MAP_FAILED) {
407 perror("test_mlock_locked mmap"); 407 perror("test_mlock_locked mmap");
408 goto out; 408 goto out;
@@ -445,7 +445,7 @@ static int test_lock_onfault_of_present()
445 uint64_t page1_flags, page2_flags; 445 uint64_t page1_flags, page2_flags;
446 446
447 map = mmap(NULL, 2 * page_size, PROT_READ | PROT_WRITE, 447 map = mmap(NULL, 2 * page_size, PROT_READ | PROT_WRITE,
448 MAP_ANONYMOUS | MAP_PRIVATE, 0, 0); 448 MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
449 if (map == MAP_FAILED) { 449 if (map == MAP_FAILED) {
450 perror("test_mlock_locked mmap"); 450 perror("test_mlock_locked mmap");
451 goto out; 451 goto out;
@@ -492,7 +492,7 @@ static int test_munlockall()
492 unsigned long page_size = getpagesize(); 492 unsigned long page_size = getpagesize();
493 493
494 map = mmap(NULL, 2 * page_size, PROT_READ | PROT_WRITE, 494 map = mmap(NULL, 2 * page_size, PROT_READ | PROT_WRITE,
495 MAP_ANONYMOUS | MAP_PRIVATE, 0, 0); 495 MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
496 496
497 if (map == MAP_FAILED) { 497 if (map == MAP_FAILED) {
498 perror("test_munlockall mmap"); 498 perror("test_munlockall mmap");
@@ -518,7 +518,7 @@ static int test_munlockall()
518 munmap(map, 2 * page_size); 518 munmap(map, 2 * page_size);
519 519
520 map = mmap(NULL, 2 * page_size, PROT_READ | PROT_WRITE, 520 map = mmap(NULL, 2 * page_size, PROT_READ | PROT_WRITE,
521 MAP_ANONYMOUS | MAP_PRIVATE, 0, 0); 521 MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
522 522
523 if (map == MAP_FAILED) { 523 if (map == MAP_FAILED) {
524 perror("test_munlockall second mmap"); 524 perror("test_munlockall second mmap");
@@ -573,7 +573,7 @@ static int test_vma_management(bool call_mlock)
573 struct vm_boundaries page3; 573 struct vm_boundaries page3;
574 574
575 map = mmap(NULL, 3 * page_size, PROT_READ | PROT_WRITE, 575 map = mmap(NULL, 3 * page_size, PROT_READ | PROT_WRITE,
576 MAP_ANONYMOUS | MAP_PRIVATE, 0, 0); 576 MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
577 if (map == MAP_FAILED) { 577 if (map == MAP_FAILED) {
578 perror("mmap()"); 578 perror("mmap()");
579 return ret; 579 return ret;
diff --git a/tools/testing/selftests/vm/on-fault-limit.c b/tools/testing/selftests/vm/on-fault-limit.c
index 0ae458f32fdb..7f96a5c2e292 100644
--- a/tools/testing/selftests/vm/on-fault-limit.c
+++ b/tools/testing/selftests/vm/on-fault-limit.c
@@ -26,7 +26,7 @@ static int test_limit(void)
26 } 26 }
27 27
28 map = mmap(NULL, 2 * lims.rlim_max, PROT_READ | PROT_WRITE, 28 map = mmap(NULL, 2 * lims.rlim_max, PROT_READ | PROT_WRITE,
29 MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, 0, 0); 29 MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, -1, 0);
30 if (map != MAP_FAILED) 30 if (map != MAP_FAILED)
31 printf("mmap should have failed, but didn't\n"); 31 printf("mmap should have failed, but didn't\n");
32 else { 32 else {
diff --git a/tools/testing/selftests/vm/run_vmtests b/tools/testing/selftests/vm/run_vmtests
index 0640923ded7e..07548a1fa901 100755
--- a/tools/testing/selftests/vm/run_vmtests
+++ b/tools/testing/selftests/vm/run_vmtests
@@ -49,9 +49,9 @@ fi
49mkdir $mnt 49mkdir $mnt
50mount -t hugetlbfs none $mnt 50mount -t hugetlbfs none $mnt
51 51
52echo "--------------------" 52echo "---------------------"
53echo "running hugepage-mmap" 53echo "running hugepage-mmap"
54echo "--------------------" 54echo "---------------------"
55./hugepage-mmap 55./hugepage-mmap
56if [ $? -ne 0 ]; then 56if [ $? -ne 0 ]; then
57 echo "[FAIL]" 57 echo "[FAIL]"
@@ -77,9 +77,9 @@ fi
77echo $shmmax > /proc/sys/kernel/shmmax 77echo $shmmax > /proc/sys/kernel/shmmax
78echo $shmall > /proc/sys/kernel/shmall 78echo $shmall > /proc/sys/kernel/shmall
79 79
80echo "--------------------" 80echo "-------------------"
81echo "running map_hugetlb" 81echo "running map_hugetlb"
82echo "--------------------" 82echo "-------------------"
83./map_hugetlb 83./map_hugetlb
84if [ $? -ne 0 ]; then 84if [ $? -ne 0 ]; then
85 echo "[FAIL]" 85 echo "[FAIL]"
@@ -92,9 +92,9 @@ echo "NOTE: The above hugetlb tests provide minimal coverage. Use"
92echo " https://github.com/libhugetlbfs/libhugetlbfs.git for" 92echo " https://github.com/libhugetlbfs/libhugetlbfs.git for"
93echo " hugetlb regression testing." 93echo " hugetlb regression testing."
94 94
95echo "--------------------" 95echo "-------------------"
96echo "running userfaultfd" 96echo "running userfaultfd"
97echo "--------------------" 97echo "-------------------"
98./userfaultfd anon 128 32 98./userfaultfd anon 128 32
99if [ $? -ne 0 ]; then 99if [ $? -ne 0 ]; then
100 echo "[FAIL]" 100 echo "[FAIL]"
@@ -103,10 +103,10 @@ else
103 echo "[PASS]" 103 echo "[PASS]"
104fi 104fi
105 105
106echo "----------------------------" 106echo "---------------------------"
107echo "running userfaultfd_hugetlb" 107echo "running userfaultfd_hugetlb"
108echo "----------------------------" 108echo "---------------------------"
109# 258MB total huge pages == 128MB src and 128MB dst 109# 256MB total huge pages == 128MB src and 128MB dst
110./userfaultfd hugetlb 128 32 $mnt/ufd_test_file 110./userfaultfd hugetlb 128 32 $mnt/ufd_test_file
111if [ $? -ne 0 ]; then 111if [ $? -ne 0 ]; then
112 echo "[FAIL]" 112 echo "[FAIL]"
@@ -116,9 +116,9 @@ else
116fi 116fi
117rm -f $mnt/ufd_test_file 117rm -f $mnt/ufd_test_file
118 118
119echo "----------------------------" 119echo "-------------------------"
120echo "running userfaultfd_shmem" 120echo "running userfaultfd_shmem"
121echo "----------------------------" 121echo "-------------------------"
122./userfaultfd shmem 128 32 122./userfaultfd shmem 128 32
123if [ $? -ne 0 ]; then 123if [ $? -ne 0 ]; then
124 echo "[FAIL]" 124 echo "[FAIL]"
@@ -143,9 +143,9 @@ else
143 echo "[PASS]" 143 echo "[PASS]"
144fi 144fi
145 145
146echo "--------------------" 146echo "----------------------"
147echo "running on-fault-limit" 147echo "running on-fault-limit"
148echo "--------------------" 148echo "----------------------"
149sudo -u nobody ./on-fault-limit 149sudo -u nobody ./on-fault-limit
150if [ $? -ne 0 ]; then 150if [ $? -ne 0 ]; then
151 echo "[FAIL]" 151 echo "[FAIL]"
diff --git a/tools/testing/selftests/vm/thuge-gen.c b/tools/testing/selftests/vm/thuge-gen.c
index 0bc737a75150..88a2ab535e01 100644
--- a/tools/testing/selftests/vm/thuge-gen.c
+++ b/tools/testing/selftests/vm/thuge-gen.c
@@ -146,7 +146,7 @@ void test_mmap(unsigned long size, unsigned flags)
146 146
147 before = read_free(size); 147 before = read_free(size);
148 map = mmap(NULL, size*NUM_PAGES, PROT_READ|PROT_WRITE, 148 map = mmap(NULL, size*NUM_PAGES, PROT_READ|PROT_WRITE,
149 MAP_PRIVATE|MAP_ANONYMOUS|MAP_HUGETLB|flags, 0, 0); 149 MAP_PRIVATE|MAP_ANONYMOUS|MAP_HUGETLB|flags, -1, 0);
150 150
151 if (map == (char *)-1) err("mmap"); 151 if (map == (char *)-1) err("mmap");
152 memset(map, 0xff, size*NUM_PAGES); 152 memset(map, 0xff, size*NUM_PAGES);
diff --git a/tools/testing/selftests/watchdog/watchdog-test.c b/tools/testing/selftests/watchdog/watchdog-test.c
index 6983d05097e2..a74c9d739d07 100644
--- a/tools/testing/selftests/watchdog/watchdog-test.c
+++ b/tools/testing/selftests/watchdog/watchdog-test.c
@@ -24,9 +24,11 @@ const char v = 'V';
24static void keep_alive(void) 24static void keep_alive(void)
25{ 25{
26 int dummy; 26 int dummy;
27 int ret;
27 28
28 printf("."); 29 ret = ioctl(fd, WDIOC_KEEPALIVE, &dummy);
29 ioctl(fd, WDIOC_KEEPALIVE, &dummy); 30 if (!ret)
31 printf(".");
30} 32}
31 33
32/* 34/*
@@ -51,6 +53,7 @@ int main(int argc, char *argv[])
51 int flags; 53 int flags;
52 unsigned int ping_rate = 1; 54 unsigned int ping_rate = 1;
53 int ret; 55 int ret;
56 int i;
54 57
55 setbuf(stdout, NULL); 58 setbuf(stdout, NULL);
56 59
@@ -61,31 +64,35 @@ int main(int argc, char *argv[])
61 exit(-1); 64 exit(-1);
62 } 65 }
63 66
64 if (argc > 1) { 67 for (i = 1; i < argc; i++) {
65 if (!strncasecmp(argv[1], "-d", 2)) { 68 if (!strncasecmp(argv[i], "-d", 2)) {
66 flags = WDIOS_DISABLECARD; 69 flags = WDIOS_DISABLECARD;
67 ioctl(fd, WDIOC_SETOPTIONS, &flags); 70 ret = ioctl(fd, WDIOC_SETOPTIONS, &flags);
68 printf("Watchdog card disabled.\n"); 71 if (!ret)
69 goto end; 72 printf("Watchdog card disabled.\n");
70 } else if (!strncasecmp(argv[1], "-e", 2)) { 73 } else if (!strncasecmp(argv[i], "-e", 2)) {
71 flags = WDIOS_ENABLECARD; 74 flags = WDIOS_ENABLECARD;
72 ioctl(fd, WDIOC_SETOPTIONS, &flags); 75 ret = ioctl(fd, WDIOC_SETOPTIONS, &flags);
73 printf("Watchdog card enabled.\n"); 76 if (!ret)
74 goto end; 77 printf("Watchdog card enabled.\n");
75 } else if (!strncasecmp(argv[1], "-t", 2) && argv[2]) { 78 } else if (!strncasecmp(argv[i], "-t", 2) && argv[2]) {
76 flags = atoi(argv[2]); 79 flags = atoi(argv[i + 1]);
77 ioctl(fd, WDIOC_SETTIMEOUT, &flags); 80 ret = ioctl(fd, WDIOC_SETTIMEOUT, &flags);
78 printf("Watchdog timeout set to %u seconds.\n", flags); 81 if (!ret)
79 goto end; 82 printf("Watchdog timeout set to %u seconds.\n", flags);
80 } else if (!strncasecmp(argv[1], "-p", 2) && argv[2]) { 83 i++;
81 ping_rate = strtoul(argv[2], NULL, 0); 84 } else if (!strncasecmp(argv[i], "-p", 2) && argv[2]) {
82 printf("Watchdog ping rate set to %u seconds.\n", ping_rate); 85 ping_rate = strtoul(argv[i + 1], NULL, 0);
83 } else { 86 printf("Watchdog ping rate set to %u seconds.\n", ping_rate);
84 printf("-d to disable, -e to enable, -t <n> to set " \ 87 i++;
85 "the timeout,\n-p <n> to set the ping rate, and \n"); 88 } else {
86 printf("run by itself to tick the card.\n"); 89 printf("-d to disable, -e to enable, -t <n> to set "
87 goto end; 90 "the timeout,\n-p <n> to set the ping rate, and ");
88 } 91 printf("run by itself to tick the card.\n");
92 printf("Parameters are parsed left-to-right in real-time.\n");
93 printf("Example: %s -d -t 10 -p 5 -e\n", argv[0]);
94 goto end;
95 }
89 } 96 }
90 97
91 printf("Watchdog Ticking Away!\n"); 98 printf("Watchdog Ticking Away!\n");
diff --git a/tools/testing/selftests/x86/.gitignore b/tools/testing/selftests/x86/.gitignore
index 15034fef9698..7757f73ff9a3 100644
--- a/tools/testing/selftests/x86/.gitignore
+++ b/tools/testing/selftests/x86/.gitignore
@@ -1,2 +1,15 @@
1*_32 1*_32
2*_64 2*_64
3single_step_syscall
4sysret_ss_attrs
5syscall_nt
6ptrace_syscall
7test_mremap_vdso
8check_initial_reg_state
9sigreturn
10ldt_gdt
11iopl
12mpx-mini-test
13ioperm
14protection_keys
15test_vdso
diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile
index 38e0a9ca5d71..97f187e2663f 100644
--- a/tools/testing/selftests/x86/Makefile
+++ b/tools/testing/selftests/x86/Makefile
@@ -40,8 +40,7 @@ all_32: $(BINARIES_32)
40 40
41all_64: $(BINARIES_64) 41all_64: $(BINARIES_64)
42 42
43clean: 43EXTRA_CLEAN := $(BINARIES_32) $(BINARIES_64)
44 $(RM) $(BINARIES_32) $(BINARIES_64)
45 44
46$(BINARIES_32): $(OUTPUT)/%_32: %.c 45$(BINARIES_32): $(OUTPUT)/%_32: %.c
47 $(CC) -m32 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $^ -lrt -ldl -lm 46 $(CC) -m32 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $^ -lrt -ldl -lm