From 36adc0000d169b6d8615730ec6ec68b029cf5e01 Mon Sep 17 00:00:00 2001 From: Fathi Boudra Date: Mon, 20 Mar 2017 12:18:20 +0200 Subject: selftests: lib: add config fragment for bitmap, printf and prime numbers tests test_bitmap, test_printf and prime_numbers are expected to be built as modules. Signed-off-by: Fathi Boudra Tested-by: Naresh Kamboju Signed-off-by: Shuah Khan --- tools/testing/selftests/lib/config | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 tools/testing/selftests/lib/config 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 @@ +CONFIG_TEST_PRINTF=m +CONFIG_TEST_BITMAP=m +CONFIG_PRIME_NUMBERS=m -- cgit v1.2.3 From f13b1731743b6dc132416a81e1d5206a89f67e21 Mon Sep 17 00:00:00 2001 From: Fathi Boudra Date: Mon, 20 Mar 2017 12:18:21 +0200 Subject: selftests: ftrace: add CONFIG_KPROBES=y to the config fragment ftrace/kprobe tests require kprobes events. Enable kprobes to run these tests. Signed-off-by: Fathi Boudra Tested-by: Naresh Kamboju Signed-off-by: Shuah Khan --- tools/testing/selftests/ftrace/config | 1 + 1 file changed, 1 insertion(+) 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 @@ +CONFIG_KPROBES=y CONFIG_FTRACE=y -- cgit v1.2.3 From 7ba31340920f6fe6c97a29bccc2ba434395525bd Mon Sep 17 00:00:00 2001 From: Fathi Boudra Date: Mon, 20 Mar 2017 12:18:22 +0200 Subject: selftests: vm: add CONFIG_SYSVIPC=y to the config fragment vm tests rely on shared memory settings. Enable system V IPC to run these tests. Signed-off-by: Fathi Boudra Tested-by: Naresh Kamboju Signed-off-by: Shuah Khan --- tools/testing/selftests/vm/config | 1 + 1 file changed, 1 insertion(+) 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 @@ +CONFIG_SYSVIPC=y CONFIG_USERFAULTFD=y -- cgit v1.2.3 From 9e14ef602b9e19b5e3d4594494e45a00ed2bc6ca Mon Sep 17 00:00:00 2001 From: Masami Hiramatsu Date: Thu, 23 Mar 2017 22:33:32 +0900 Subject: kselftest: ftrace: Fix to compare a zero-filled hex value Fix to compare a zero-filled hexadecimal value with a part of string of long hexadecimal value. In check_types(), the last part of testcase compares with the hex value formatted by "%x" with a part of a string of long hex value (trimmed by tail -c and head -c). However, if that part of long hex value contains zero (e.g. "05" of "a3082059"), printf generated value (e.g. "5") is diffrent string, and the test case failed. To fix this, pass "%02x" instead of "%x" to printf. Signed-off-by: Masami Hiramatsu Acked-by: Steven Rostedt (VMware) Signed-off-by: Shuah Khan --- tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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() { test $X2 = $X3 test 0x$X3 = $3 - B4=`printf "%x" $4` + B4=`printf "%02x" $4` B3=`echo -n $X3 | tail -c 3 | head -c 2` test $B3 = $B4 } -- cgit v1.2.3 From bfedc31c4f2c1af3b509bbdc0aae051e8ad7d3ae Mon Sep 17 00:00:00 2001 From: Darren Hart Date: Fri, 24 Mar 2017 09:18:54 -0700 Subject: selftests/futex: Fix build error with OUTPUT variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The use of $$OUTPUT in the target shell commands resulted in an empty string followed by an absolute path for which mkdir failed: $ make -C tools/testing/selftests/futex make: Entering directory '/home/dvhart/source/linux/linux-pdx86/tools/testing/selftests/futex' Makefile:36: warning: overriding recipe for target 'clean' ../lib.mk:55: warning: ignoring old recipe for target 'clean' for DIR in functional; do \ BUILD_TARGET=$OUTPUT/$DIR; \ mkdir $BUILD_TARGET -p; \ make OUTPUT=$BUILD_TARGET -C $DIR all;\ done mkdir: cannot create directory ‘/functional’: Permission denied Replace $$OUTPUT with $(OUTPUT) when referring to the Makefile OUTPUT variable. The above make command now completes successfully. Fixes: a8ba798bc8ec ("selftests: enable O and KBUILD_OUTPUT") Signed-off-by: Darren Hart (VMware) Cc: linux-kselftest@vger.kernel.org Cc: bamvor.zhangjian@huawei.com Cc: Shuah Khan Signed-off-by: Shuah Khan --- tools/testing/selftests/futex/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/futex/Makefile b/tools/testing/selftests/futex/Makefile index 653c5cd9e44d..c8095e628e13 100644 --- a/tools/testing/selftests/futex/Makefile +++ b/tools/testing/selftests/futex/Makefile @@ -8,7 +8,7 @@ include ../lib.mk all: for DIR in $(SUBDIRS); do \ - BUILD_TARGET=$$OUTPUT/$$DIR; \ + BUILD_TARGET=$(OUTPUT)/$$DIR; \ mkdir $$BUILD_TARGET -p; \ make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\ done @@ -22,7 +22,7 @@ override define INSTALL_RULE install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) @for SUBDIR in $(SUBDIRS); do \ - BUILD_TARGET=$$OUTPUT/$$SUBDIR; \ + BUILD_TARGET=$(OUTPUT)/$$SUBDIR; \ mkdir $$BUILD_TARGET -p; \ $(MAKE) OUTPUT=$$BUILD_TARGET -C $$SUBDIR INSTALL_PATH=$(INSTALL_PATH)/$$SUBDIR install; \ done; @@ -34,7 +34,7 @@ endef clean: for DIR in $(SUBDIRS); do \ - BUILD_TARGET=$$OUTPUT/$$DIR; \ + BUILD_TARGET=$(OUTPUT)/$$DIR; \ mkdir $$BUILD_TARGET -p; \ make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\ done -- cgit v1.2.3 From 70d1a4e66854ae8aa26d9474ae282b46d7087770 Mon Sep 17 00:00:00 2001 From: SeongJae Park Date: Wed, 15 Mar 2017 22:19:26 +0900 Subject: selftests/vm: Set mmap()'s fd as -1 for MAP_ANONYMOUS flag Man page of mmap() says that portable applications should ensure fd argument to be -1 if MAP_ANONYMOUS flag is set as below: ``` The mapping is not backed by any file; its contents are initialized to zero. The fd and offset arguments are ignored; however, some implementations require fd to be -1 if MAP_ANONYMOUS (or MAP_ANON) is specified, and portable applications should ensure this. ``` However, few mmap() calls under selftests/vm/ uses 0 as fd though they use MAP_ANONYMOUS flag. This commit changes the argument to be -1 as recommended. Signed-off-by: SeongJae Park Acked-by: Andrew Morton Signed-off-by: Shuah Khan --- tools/testing/selftests/vm/map_hugetlb.c | 2 +- tools/testing/selftests/vm/mlock2-tests.c | 12 ++++++------ tools/testing/selftests/vm/on-fault-limit.c | 2 +- tools/testing/selftests/vm/thuge-gen.c | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) 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) void *addr; int ret; - addr = mmap(ADDR, LENGTH, PROTECTION, FLAGS, 0, 0); + addr = mmap(ADDR, LENGTH, PROTECTION, FLAGS, -1, 0); if (addr == MAP_FAILED) { perror("mmap"); 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() unsigned long page_size = getpagesize(); map = mmap(NULL, 2 * page_size, PROT_READ | PROT_WRITE, - MAP_ANONYMOUS | MAP_PRIVATE, 0, 0); + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); if (map == MAP_FAILED) { perror("test_mlock_locked mmap"); goto out; @@ -402,7 +402,7 @@ static int test_mlock_onfault() unsigned long page_size = getpagesize(); map = mmap(NULL, 2 * page_size, PROT_READ | PROT_WRITE, - MAP_ANONYMOUS | MAP_PRIVATE, 0, 0); + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); if (map == MAP_FAILED) { perror("test_mlock_locked mmap"); goto out; @@ -445,7 +445,7 @@ static int test_lock_onfault_of_present() uint64_t page1_flags, page2_flags; map = mmap(NULL, 2 * page_size, PROT_READ | PROT_WRITE, - MAP_ANONYMOUS | MAP_PRIVATE, 0, 0); + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); if (map == MAP_FAILED) { perror("test_mlock_locked mmap"); goto out; @@ -492,7 +492,7 @@ static int test_munlockall() unsigned long page_size = getpagesize(); map = mmap(NULL, 2 * page_size, PROT_READ | PROT_WRITE, - MAP_ANONYMOUS | MAP_PRIVATE, 0, 0); + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); if (map == MAP_FAILED) { perror("test_munlockall mmap"); @@ -518,7 +518,7 @@ static int test_munlockall() munmap(map, 2 * page_size); map = mmap(NULL, 2 * page_size, PROT_READ | PROT_WRITE, - MAP_ANONYMOUS | MAP_PRIVATE, 0, 0); + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); if (map == MAP_FAILED) { perror("test_munlockall second mmap"); @@ -573,7 +573,7 @@ static int test_vma_management(bool call_mlock) struct vm_boundaries page3; map = mmap(NULL, 3 * page_size, PROT_READ | PROT_WRITE, - MAP_ANONYMOUS | MAP_PRIVATE, 0, 0); + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); if (map == MAP_FAILED) { perror("mmap()"); 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) } map = mmap(NULL, 2 * lims.rlim_max, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, 0, 0); + MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, -1, 0); if (map != MAP_FAILED) printf("mmap should have failed, but didn't\n"); else { 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) before = read_free(size); map = mmap(NULL, size*NUM_PAGES, PROT_READ|PROT_WRITE, - MAP_PRIVATE|MAP_ANONYMOUS|MAP_HUGETLB|flags, 0, 0); + MAP_PRIVATE|MAP_ANONYMOUS|MAP_HUGETLB|flags, -1, 0); if (map == (char *)-1) err("mmap"); memset(map, 0xff, size*NUM_PAGES); -- cgit v1.2.3 From 05844f83132250d47514721b6801791972745082 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Wed, 12 Apr 2017 14:48:17 +0100 Subject: selftests/timers: fix spelling mistake: "Asynchronous" trivial fix to spelling mistake in printed message. Signed-off-by: Colin Ian King Signed-off-by: Shuah Khan --- tools/testing/selftests/timers/clocksource-switch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) } - printf("Running Asyncrhonous Switching Tests...\n"); + printf("Running Asynchronous Switching Tests...\n"); pid = fork(); if (!pid) return run_tests(60); -- cgit v1.2.3 From 2b8713e14be5712956e10121000c5417c225ddfd Mon Sep 17 00:00:00 2001 From: SeongJae Park Date: Fri, 14 Apr 2017 01:58:49 +0900 Subject: selftests/vm/run_vmtests: Polish output text Few currently running test notification messages from run_vmtests output have mismatched highlight lines. This commit fixes them to fit in length. Signed-off-by: SeongJae Park Signed-off-by: Shuah Khan --- tools/testing/selftests/vm/run_vmtests | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tools/testing/selftests/vm/run_vmtests b/tools/testing/selftests/vm/run_vmtests index c92f6cf31d0a..0091bde3f25f 100755 --- a/tools/testing/selftests/vm/run_vmtests +++ b/tools/testing/selftests/vm/run_vmtests @@ -49,9 +49,9 @@ fi mkdir $mnt mount -t hugetlbfs none $mnt -echo "--------------------" +echo "---------------------" echo "running hugepage-mmap" -echo "--------------------" +echo "---------------------" ./hugepage-mmap if [ $? -ne 0 ]; then echo "[FAIL]" @@ -77,9 +77,9 @@ fi echo $shmmax > /proc/sys/kernel/shmmax echo $shmall > /proc/sys/kernel/shmall -echo "--------------------" +echo "-------------------" echo "running map_hugetlb" -echo "--------------------" +echo "-------------------" ./map_hugetlb if [ $? -ne 0 ]; then echo "[FAIL]" @@ -92,9 +92,9 @@ echo "NOTE: The above hugetlb tests provide minimal coverage. Use" echo " https://github.com/libhugetlbfs/libhugetlbfs.git for" echo " hugetlb regression testing." -echo "--------------------" +echo "-------------------" echo "running userfaultfd" -echo "--------------------" +echo "-------------------" ./userfaultfd 128 32 if [ $? -ne 0 ]; then echo "[FAIL]" @@ -103,9 +103,9 @@ else echo "[PASS]" fi -echo "----------------------------" +echo "---------------------------" echo "running userfaultfd_hugetlb" -echo "----------------------------" +echo "---------------------------" # 258MB total huge pages == 128MB src and 128MB dst ./userfaultfd_hugetlb 128 32 $mnt/ufd_test_file if [ $? -ne 0 ]; then @@ -116,9 +116,9 @@ else fi rm -f $mnt/ufd_test_file -echo "----------------------------" +echo "-------------------------" echo "running userfaultfd_shmem" -echo "----------------------------" +echo "-------------------------" ./userfaultfd_shmem 128 32 if [ $? -ne 0 ]; then echo "[FAIL]" @@ -143,9 +143,9 @@ else echo "[PASS]" fi -echo "--------------------" +echo "----------------------" echo "running on-fault-limit" -echo "--------------------" +echo "----------------------" sudo -u nobody ./on-fault-limit if [ $? -ne 0 ]; then echo "[FAIL]" -- cgit v1.2.3 From c6a13fafa85d11282dd88945fe9b60f51b88ef65 Mon Sep 17 00:00:00 2001 From: SeongJae Park Date: Fri, 14 Apr 2017 08:43:16 +0900 Subject: selftests/Makefile: Add missed closing `"` in comment A comment for make command usage in `selftets/Makefile` has opening `"` but no closing `"`. This commit adds the missed `"` in the comment. Signed-off-by: SeongJae Park Signed-off-by: Shuah Khan --- tools/testing/selftests/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile index d8593f1251ec..395ab296c084 100644 --- a/tools/testing/selftests/Makefile +++ b/tools/testing/selftests/Makefile @@ -39,7 +39,7 @@ TARGETS += x86 TARGETS += zram #Please keep the TARGETS list alphabetically sorted # Run "make quicktest=1 run_tests" or -# "make quicktest=1 kselftest from top level Makefile +# "make quicktest=1 kselftest" from top level Makefile TARGETS_HOTPLUG = cpu-hotplug TARGETS_HOTPLUG += memory-hotplug -- cgit v1.2.3 From ff80d9152fd71c07d4e80eccfa135880c44aef0f Mon Sep 17 00:00:00 2001 From: SeongJae Park Date: Fri, 14 Apr 2017 08:49:21 +0900 Subject: selftests/vm/run_vmtests: Fix wrong comment A comment in `run_vmtests` is wrong because it is saying `128MB + 128MB == 258MB`. This commit fixes the comment. Signed-off-by: SeongJae Park Signed-off-by: Shuah Khan --- tools/testing/selftests/vm/run_vmtests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/vm/run_vmtests b/tools/testing/selftests/vm/run_vmtests index 0091bde3f25f..2ed05ad00daa 100755 --- a/tools/testing/selftests/vm/run_vmtests +++ b/tools/testing/selftests/vm/run_vmtests @@ -106,7 +106,7 @@ fi echo "---------------------------" echo "running userfaultfd_hugetlb" echo "---------------------------" -# 258MB total huge pages == 128MB src and 128MB dst +# 256MB total huge pages == 128MB src and 128MB dst ./userfaultfd_hugetlb 128 32 $mnt/ufd_test_file if [ $? -ne 0 ]; then echo "[FAIL]" -- cgit v1.2.3 From 584f34f1721c3b5d2f8488b4afee1186a3f41cf7 Mon Sep 17 00:00:00 2001 From: SeongJae Park Date: Fri, 14 Apr 2017 08:44:46 +0900 Subject: selftests/Makefile: Add missed PHONY targets `selftests/Makefile` is defining only `install` as entire PHONY target though there are few more PHONY targets including `run_tests`. This commit defines them as the PHONY targets. Signed-off-by: SeongJae Park Signed-off-by: Shuah Khan --- tools/testing/selftests/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile index 395ab296c084..26ce4f7168be 100644 --- a/tools/testing/selftests/Makefile +++ b/tools/testing/selftests/Makefile @@ -133,4 +133,4 @@ clean: make OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\ done; -.PHONY: install +.PHONY: all run_tests hotplug run_hotplug clean_hotplug run_pstore_crash install clean -- cgit v1.2.3 From b13f76664d68b9b9fc0827c5dcfe6811232db5f7 Mon Sep 17 00:00:00 2001 From: Fathi Boudra Date: Wed, 22 Mar 2017 20:04:58 +0200 Subject: selftests: breakpoints: allow to cross-compile for aarch64/arm64 To build breakpoint_test_arm64, ARCH value is only tested for "aarch64". It covers only the native build because it's computed from uname -m output. For cross-compilation, ARCH is set to arm64 and prevent to cross-compile the test. Fix the test to allow both native and cross-compilation of the test. Note: glibc is missing several of the TRAP_* constants in the userspace definitions. Specifically TRAP_BRANCH and TRAP_HWBKPT. See https://sourceware.org/bugzilla/show_bug.cgi?id=21286 Signed-off-by: Fathi Boudra Tested-by: Naresh Kamboju Signed-off-by: Shuah Khan --- tools/testing/selftests/breakpoints/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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/) ifeq ($(ARCH),x86) TEST_GEN_PROGS := breakpoint_test endif -ifeq ($(ARCH),aarch64) +ifneq (,$(filter $(ARCH),aarch64 arm64)) TEST_GEN_PROGS := breakpoint_test_arm64 endif -- cgit v1.2.3 From 8a246230bd2e822f440ebf4e7424fabb4d42da24 Mon Sep 17 00:00:00 2001 From: Fathi Boudra Date: Fri, 31 Mar 2017 11:41:30 +0300 Subject: selftests: gpio: add config fragment for gpio-mockup The gpio test requires to insert the gpio mockup module (CONFIG_GPIO_MOCKUP). The gpio mockup driver depends on gpiolib (CONFIG_GPIOLIB). CONFIG_GPIO_SYSFS is selected automatically by the gpio mockup driver. Tested on x86_64 and arm64 with defconfig and kselftest-merge. Signed-off-by: Fathi Boudra Signed-off-by: Shuah Khan --- tools/testing/selftests/gpio/config | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 tools/testing/selftests/gpio/config 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 @@ +CONFIG_GPIOLIB=y +CONFIG_GPIO_MOCKUP=m -- cgit v1.2.3 From 8edd210d9b121681f7e69dc087ae80d7043008e9 Mon Sep 17 00:00:00 2001 From: Shuah Khan Date: Fri, 21 Apr 2017 15:35:31 -0600 Subject: selftests: splice: fix clean target to not remove default_file_splice_read.sh splice clean target removes the shell script default_file_splice_read.sh that runs the splice test. Fix it to not remove this file. Signed-off-by: Shuah Khan --- tools/testing/selftests/splice/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/splice/Makefile b/tools/testing/selftests/splice/Makefile index de51f439d4a6..559512c2075e 100644 --- a/tools/testing/selftests/splice/Makefile +++ b/tools/testing/selftests/splice/Makefile @@ -5,4 +5,4 @@ all: $(TEST_PROGS) $(EXTRA) include ../lib.mk clean: - rm -fr $(TEST_PROGS) $(EXTRA) + rm -fr $(EXTRA) -- cgit v1.2.3 From df6438f9a726c8f803e03708c83928e439fd5e2f Mon Sep 17 00:00:00 2001 From: Shuah Khan Date: Fri, 21 Apr 2017 16:07:51 -0600 Subject: selftests: lib.mk: define CLEAN macro to allow Makefiles to override clean Define CLEAN macro to allow Makefiles to override common clean target in lib.mk. This will help fix the following failures: warning: overriding recipe for target 'clean' ../lib.mk:55: warning: ignoring old recipe for target 'clean' Fixes: 88baa78d1f31 ("selftests: remove duplicated all and clean target") Signed-off-by: Shuah Khan Acked-by: Michael Ellerman --- tools/testing/selftests/lib.mk | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 emit_tests: $(EMIT_TESTS) -clean: +define CLEAN $(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(EXTRA_CLEAN) +endef + +clean: + $(CLEAN) $(OUTPUT)/%:%.c $(LINK.c) $^ $(LDLIBS) -o $@ -- cgit v1.2.3 From b1c0f540c8e6944a8cae1bcbab60068fb7b40734 Mon Sep 17 00:00:00 2001 From: Shuah Khan Date: Fri, 21 Apr 2017 16:12:22 -0600 Subject: selftests: futex: override clean in lib.mk to fix warnings Add override for lib.mk clean to fix the following warnings from clean target run. Makefile:36: warning: overriding recipe for target 'clean' ../lib.mk:55: warning: ignoring old recipe for target 'clean' Signed-off-by: Shuah Khan --- tools/testing/selftests/futex/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/futex/Makefile b/tools/testing/selftests/futex/Makefile index c8095e628e13..e2fbb890aef9 100644 --- a/tools/testing/selftests/futex/Makefile +++ b/tools/testing/selftests/futex/Makefile @@ -32,9 +32,10 @@ override define EMIT_TESTS echo "./run.sh" endef -clean: +override define CLEAN for DIR in $(SUBDIRS); do \ BUILD_TARGET=$(OUTPUT)/$$DIR; \ mkdir $$BUILD_TARGET -p; \ make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\ done +endef -- cgit v1.2.3 From 6dd89010ff3620d60fc9d604218791641d06831c Mon Sep 17 00:00:00 2001 From: Shuah Khan Date: Fri, 21 Apr 2017 16:19:50 -0600 Subject: selftests: gpio: override clean in lib.mk to fix warnings Add override for lib.mk clean to fix the following warnings from clean target run. Makefile:11: warning: overriding recipe for target 'clean' ../lib.mk:55: warning: ignoring old recipe for target 'clean' Signed-off-by: Shuah Khan --- tools/testing/selftests/gpio/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/gpio/Makefile b/tools/testing/selftests/gpio/Makefile index 205e4d10e085..4f6d9e0169b2 100644 --- a/tools/testing/selftests/gpio/Makefile +++ b/tools/testing/selftests/gpio/Makefile @@ -7,8 +7,9 @@ include ../lib.mk all: $(BINARIES) -clean: +override define CLEAN $(RM) $(BINARIES) +endef CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/ LDLIBS += -lmount -I/usr/include/libmount -- cgit v1.2.3 From 337f1e366c75ec88d9bbae59c0703d4289458b29 Mon Sep 17 00:00:00 2001 From: Shuah Khan Date: Fri, 21 Apr 2017 16:22:10 -0600 Subject: selftests: powerpc: override clean in lib.mk to fix warnings Add override for lib.mk clean to fix the following warnings from clean target run. Makefile:63: warning: overriding recipe for target 'clean' ../lib.mk:55: warning: ignoring old recipe for target 'clean' Signed-off-by: Shuah Khan --- tools/testing/selftests/powerpc/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/powerpc/Makefile b/tools/testing/selftests/powerpc/Makefile index 1c5d0575802e..8d9fc64c8761 100644 --- a/tools/testing/selftests/powerpc/Makefile +++ b/tools/testing/selftests/powerpc/Makefile @@ -59,12 +59,13 @@ override define EMIT_TESTS done; endef -clean: +override define CLEAN @for TARGET in $(SUB_DIRS); do \ BUILD_TARGET=$$OUTPUT/$$TARGET; \ $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean; \ done; rm -f tags +endef tags: find . -name '*.c' -o -name '*.h' | xargs ctags -- cgit v1.2.3 From 26d5ad3b96cf9c2a161c8e685e427966c91c587b Mon Sep 17 00:00:00 2001 From: Shuah Khan Date: Fri, 21 Apr 2017 18:00:39 -0600 Subject: selftests: add gpio generated files to .gitignore gpio test generates files in selftests directory. Add them to .gitignore. Signed-off-by: Shuah Khan --- tools/testing/selftests/.gitignore | 4 ++++ 1 file changed, 4 insertions(+) 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 @@ kselftest +gpiogpio-event-mon +gpiogpio-hammer +gpioinclude/ +gpiolsgpio -- cgit v1.2.3 From 51c6bd7cbe0366b642d8ac90d98739c39ab091a9 Mon Sep 17 00:00:00 2001 From: Shuah Khan Date: Fri, 21 Apr 2017 18:01:51 -0600 Subject: selftests: gpio: fix clean target to remove all generated files and dirs gpio test creates executables, object files, and include directory under selftests directory. Enhance clean target to remove all files it generates. Signed-off-by: Shuah Khan --- tools/testing/selftests/gpio/Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/gpio/Makefile b/tools/testing/selftests/gpio/Makefile index 4f6d9e0169b2..298929df97e6 100644 --- a/tools/testing/selftests/gpio/Makefile +++ b/tools/testing/selftests/gpio/Makefile @@ -2,13 +2,19 @@ TEST_PROGS := gpio-mockup.sh TEST_FILES := gpio-mockup-sysfs.sh $(BINARIES) BINARIES := gpio-mockup-chardev +EXTRA_PROGS := ../gpiogpio-event-mon ../gpiogpio-hammer ../gpiolsgpio +EXTRA_DIRS := ../gpioinclude/ +EXTRA_OBJS := ../gpiogpio-event-mon-in.o ../gpiogpio-event-mon.o +EXTRA_OBJS += ../gpiogpio-hammer-in.o ../gpiogpio-utils.o ../gpiolsgpio-in.o +EXTRA_OBJS += ../gpiolsgpio.o include ../lib.mk all: $(BINARIES) override define CLEAN - $(RM) $(BINARIES) + $(RM) $(BINARIES) $(EXTRA_PROGS) $(EXTRA_OBJS) + $(RM) -r $(EXTRA_DIRS) endef CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/ -- cgit v1.2.3 From de0c6742ffd89b48970fefc8ccf9f5ac43ba17c6 Mon Sep 17 00:00:00 2001 From: Shuah Khan Date: Fri, 21 Apr 2017 16:24:09 -0600 Subject: selftests: splice: override clean in lib.mk to fix warnings Add override with EXTRA_CLEAN for lib.mk clean to fix the following warnings from clean target run. Makefile:8: warning: overriding recipe for target 'clean' ../lib.mk:55: warning: ignoring old recipe for target 'clean' Signed-off-by: Shuah Khan --- tools/testing/selftests/splice/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/testing/selftests/splice/Makefile b/tools/testing/selftests/splice/Makefile index 559512c2075e..9fc78e5e5451 100644 --- a/tools/testing/selftests/splice/Makefile +++ b/tools/testing/selftests/splice/Makefile @@ -4,5 +4,4 @@ all: $(TEST_PROGS) $(EXTRA) include ../lib.mk -clean: - rm -fr $(EXTRA) +EXTRA_CLEAN := $(EXTRA) -- cgit v1.2.3 From 8ab02e0962bf91126797fefb9775dd1ffa54d29d Mon Sep 17 00:00:00 2001 From: Shuah Khan Date: Fri, 21 Apr 2017 16:25:25 -0600 Subject: selftests: sync: override clean in lib.mk to fix warnings Add override with EXTRA_CLEAN for lib.mk clean to fix the following warnings from clean target run. Makefile:24: warning: overriding recipe for target 'clean' ../lib.mk:55: warning: ignoring old recipe for target 'clean' Signed-off-by: Shuah Khan --- tools/testing/selftests/sync/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 sync_test: $(OBJS) $(TESTS) -clean: - $(RM) sync_test $(OBJS) $(TESTS) +EXTRA_CLEAN := sync_test $(OBJS) $(TESTS) -- cgit v1.2.3 From eebed11a3d6b013054b130665b48620a969062e9 Mon Sep 17 00:00:00 2001 From: Shuah Khan Date: Fri, 21 Apr 2017 16:26:16 -0600 Subject: selftests: x86: override clean in lib.mk to fix warnings Add override with EXTRA_CLEAN for lib.mk clean to fix the following warnings from clean target run. Makefile:44: warning: overriding recipe for target 'clean' ../lib.mk:55: warning: ignoring old recipe for target 'clean' Signed-off-by: Shuah Khan --- tools/testing/selftests/x86/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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) all_64: $(BINARIES_64) -clean: - $(RM) $(BINARIES_32) $(BINARIES_64) +EXTRA_CLEAN := $(BINARIES_32) $(BINARIES_64) $(BINARIES_32): $(OUTPUT)/%_32: %.c $(CC) -m32 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $^ -lrt -ldl -lm -- cgit v1.2.3 From 83896c68fd32895ba4ff685c4df9d1e794dfb4fe Mon Sep 17 00:00:00 2001 From: Naresh Kamboju Date: Wed, 26 Apr 2017 15:39:37 +0530 Subject: selftests: create cpufreq kconfig fragments For the better test coverage of cpufreq driver code these extra configurations are needed. Enable cpufreq governors and stats. Signed-off-by: Naresh Kamboju Acked-by: Viresh Kumar Signed-off-by: Shuah Khan --- tools/testing/selftests/cpufreq/config | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tools/testing/selftests/cpufreq/config 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 @@ +CONFIG_CPU_FREQ=y +CONFIG_CPU_FREQ_STAT=y +CONFIG_CPU_FREQ_GOV_POWERSAVE=y +CONFIG_CPU_FREQ_GOV_USERSPACE=y +CONFIG_CPU_FREQ_GOV_ONDEMAND=y +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y +CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y +CONFIG_DEBUG_RT_MUTEXES=y +CONFIG_DEBUG_PI_LIST=y +CONFIG_DEBUG_SPINLOCK=y +CONFIG_DEBUG_MUTEXES=y +CONFIG_DEBUG_LOCK_ALLOC=y +CONFIG_PROVE_LOCKING=y +CONFIG_LOCKDEP=y +CONFIG_DEBUG_ATOMIC_SLEEP=y -- cgit v1.2.3 From 1dbdcc810928a2c1acdd0bbfce9495f63610a0d1 Mon Sep 17 00:00:00 2001 From: Timur Tabi Date: Mon, 1 May 2017 14:23:04 -0500 Subject: selftests: watchdog: accept multiple params on command line Watchdog drivers are not required to retain programming information, such as timeouts, after the watchdog device is closed. Therefore, the watchdog test should be able to perform multiple actions after opening the watchdog device. For example, to set the timeout to 10s and ping every 5s: watchdog-test -t 10 -p 5 -e Also, display the periodic decimal point only if the keep-alive call succeeds. Signed-off-by: Timur Tabi Reviewed-by: Guenter Roeck Signed-off-by: Shuah Khan --- tools/testing/selftests/watchdog/watchdog-test.c | 61 +++++++++++++----------- 1 file changed, 34 insertions(+), 27 deletions(-) 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'; static void keep_alive(void) { int dummy; + int ret; - printf("."); - ioctl(fd, WDIOC_KEEPALIVE, &dummy); + ret = ioctl(fd, WDIOC_KEEPALIVE, &dummy); + if (!ret) + printf("."); } /* @@ -51,6 +53,7 @@ int main(int argc, char *argv[]) int flags; unsigned int ping_rate = 1; int ret; + int i; setbuf(stdout, NULL); @@ -61,31 +64,35 @@ int main(int argc, char *argv[]) exit(-1); } - if (argc > 1) { - if (!strncasecmp(argv[1], "-d", 2)) { - flags = WDIOS_DISABLECARD; - ioctl(fd, WDIOC_SETOPTIONS, &flags); - printf("Watchdog card disabled.\n"); - goto end; - } else if (!strncasecmp(argv[1], "-e", 2)) { - flags = WDIOS_ENABLECARD; - ioctl(fd, WDIOC_SETOPTIONS, &flags); - printf("Watchdog card enabled.\n"); - goto end; - } else if (!strncasecmp(argv[1], "-t", 2) && argv[2]) { - flags = atoi(argv[2]); - ioctl(fd, WDIOC_SETTIMEOUT, &flags); - printf("Watchdog timeout set to %u seconds.\n", flags); - goto end; - } else if (!strncasecmp(argv[1], "-p", 2) && argv[2]) { - ping_rate = strtoul(argv[2], NULL, 0); - printf("Watchdog ping rate set to %u seconds.\n", ping_rate); - } else { - printf("-d to disable, -e to enable, -t to set " \ - "the timeout,\n-p to set the ping rate, and \n"); - printf("run by itself to tick the card.\n"); - goto end; - } + for (i = 1; i < argc; i++) { + if (!strncasecmp(argv[i], "-d", 2)) { + flags = WDIOS_DISABLECARD; + ret = ioctl(fd, WDIOC_SETOPTIONS, &flags); + if (!ret) + printf("Watchdog card disabled.\n"); + } else if (!strncasecmp(argv[i], "-e", 2)) { + flags = WDIOS_ENABLECARD; + ret = ioctl(fd, WDIOC_SETOPTIONS, &flags); + if (!ret) + printf("Watchdog card enabled.\n"); + } else if (!strncasecmp(argv[i], "-t", 2) && argv[2]) { + flags = atoi(argv[i + 1]); + ret = ioctl(fd, WDIOC_SETTIMEOUT, &flags); + if (!ret) + printf("Watchdog timeout set to %u seconds.\n", flags); + i++; + } else if (!strncasecmp(argv[i], "-p", 2) && argv[2]) { + ping_rate = strtoul(argv[i + 1], NULL, 0); + printf("Watchdog ping rate set to %u seconds.\n", ping_rate); + i++; + } else { + printf("-d to disable, -e to enable, -t to set " + "the timeout,\n-p to set the ping rate, and "); + printf("run by itself to tick the card.\n"); + printf("Parameters are parsed left-to-right in real-time.\n"); + printf("Example: %s -d -t 10 -p 5 -e\n", argv[0]); + goto end; + } } printf("Watchdog Ticking Away!\n"); -- cgit v1.2.3 From 945f8f5f863321de0dc5c13b3d446d4dbf41531e Mon Sep 17 00:00:00 2001 From: Shuah Khan Date: Tue, 2 May 2017 11:00:22 -0600 Subject: selftests: x86: add missing executables to .gitignore Executables that are common for both x86_32 and x86_64 are missing from .gitignore. Add them. Signed-off-by: Shuah Khan --- tools/testing/selftests/x86/.gitignore | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 @@ *_32 *_64 +single_step_syscall +sysret_ss_attrs +syscall_nt +ptrace_syscall +test_mremap_vdso +check_initial_reg_state +sigreturn +ldt_gdt +iopl +mpx-mini-test +ioperm +protection_keys +test_vdso -- cgit v1.2.3