Merge tag 'linux-kselftest-4.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest

Pull kselftest fixes from Shuah Khan:

- fix new sparc64 adi driver test compile errors on non-sparc systems

- fix config fragment for sync framework for improved test coverage

- fix several tests to return correct Kselftest skip code

* tag 'linux-kselftest-4.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
selftests: sparc64: Add missing SPDX License Identifiers
selftests: sparc64: delete RUN_TESTS and EMIT_TESTS overrides
selftests: sparc64: Fix to do nothing on non-sparc64
selftests: sync: add config fragment for testing sync framework
selftests: vm: return Kselftest Skip code for skipped tests
selftests: zram: return Kselftest Skip code for skipped tests
selftests: user: return Kselftest Skip code for skipped tests
selftests: sysctl: return Kselftest Skip code for skipped tests
selftests: static_keys: return Kselftest Skip code for skipped tests
selftests: pstore: return Kselftest Skip code for skipped tests

+79 -27
+4 -1
tools/testing/selftests/pstore/pstore_post_reboot_tests
··· 7 7 # 8 8 # Released under the terms of the GPL v2. 9 9 10 + # Kselftest framework requirement - SKIP code is 4. 11 + ksft_skip=4 12 + 10 13 . ./common_tests 11 14 12 15 if [ -e $REBOOT_FLAG ]; then 13 16 rm $REBOOT_FLAG 14 17 else 15 18 prlog "pstore_crash_test has not been executed yet. we skip further tests." 16 - exit 0 19 + exit $ksft_skip 17 20 fi 18 21 19 22 prlog -n "Mounting pstore filesystem ... "
+12 -8
tools/testing/selftests/sparc64/Makefile
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + uname_M := $(shell uname -m 2>/dev/null || echo not) 3 + ARCH ?= $(shell echo $(uname_M) | sed -e s/x86_64/x86/) 4 + 5 + ifneq ($(ARCH),sparc64) 6 + nothing: 7 + .PHONY: all clean run_tests install 8 + .SILENT: 9 + else 10 + 1 11 SUBDIRS := drivers 2 12 3 13 TEST_PROGS := run.sh 14 + 4 15 5 16 .PHONY: all clean 6 17 ··· 29 18 fi \ 30 19 done 31 20 32 - override define RUN_TESTS 33 - @cd $(OUTPUT); ./run.sh 34 - endef 35 - 36 21 override define INSTALL_RULE 37 22 mkdir -p $(INSTALL_PATH) 38 23 install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) ··· 40 33 done; 41 34 endef 42 35 43 - override define EMIT_TESTS 44 - echo "./run.sh" 45 - endef 46 - 47 36 override define CLEAN 48 37 @for DIR in $(SUBDIRS); do \ 49 38 BUILD_TARGET=$(OUTPUT)/$$DIR; \ ··· 47 44 make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\ 48 45 done 49 46 endef 47 + endif
+1 -1
tools/testing/selftests/sparc64/drivers/Makefile
··· 1 - 1 + # SPDX-License-Identifier: GPL-2.0 2 2 INCLUDEDIR := -I. 3 3 CFLAGS := $(CFLAGS) $(INCLUDEDIR) -Wall -O2 -g 4 4
+13
tools/testing/selftests/static_keys/test_static_keys.sh
··· 2 2 # SPDX-License-Identifier: GPL-2.0 3 3 # Runs static keys kernel module tests 4 4 5 + # Kselftest framework requirement - SKIP code is 4. 6 + ksft_skip=4 7 + 8 + if ! /sbin/modprobe -q -n test_static_key_base; then 9 + echo "static_key: module test_static_key_base is not found [SKIP]" 10 + exit $ksft_skip 11 + fi 12 + 13 + if ! /sbin/modprobe -q -n test_static_keys; then 14 + echo "static_key: module test_static_keys is not found [SKIP]" 15 + exit $ksft_skip 16 + fi 17 + 5 18 if /sbin/modprobe -q test_static_key_base; then 6 19 if /sbin/modprobe -q test_static_keys; then 7 20 echo "static_key: ok"
+4
tools/testing/selftests/sync/config
··· 1 + CONFIG_STAGING=y 2 + CONFIG_ANDROID=y 3 + CONFIG_SYNC=y 4 + CONFIG_SW_SYNC=y
+13 -7
tools/testing/selftests/sysctl/sysctl.sh
··· 14 14 15 15 # This performs a series tests against the proc sysctl interface. 16 16 17 + # Kselftest framework requirement - SKIP code is 4. 18 + ksft_skip=4 19 + 17 20 TEST_NAME="sysctl" 18 21 TEST_DRIVER="test_${TEST_NAME}" 19 22 TEST_DIR=$(dirname $0) ··· 44 41 echo "$0: $DIR not present" >&2 45 42 echo "You must have the following enabled in your kernel:" >&2 46 43 cat $TEST_DIR/config >&2 47 - exit 1 44 + exit $ksft_skip 48 45 fi 49 46 } 50 47 ··· 101 98 uid=$(id -u) 102 99 if [ $uid -ne 0 ]; then 103 100 echo $msg must be run as root >&2 104 - exit 0 101 + exit $ksft_skip 105 102 fi 106 103 107 104 if ! which perl 2> /dev/null > /dev/null; then 108 105 echo "$0: You need perl installed" 109 - exit 1 106 + exit $ksft_skip 110 107 fi 111 108 if ! which getconf 2> /dev/null > /dev/null; then 112 109 echo "$0: You need getconf installed" 113 - exit 1 110 + exit $ksft_skip 114 111 fi 115 112 if ! which diff 2> /dev/null > /dev/null; then 116 113 echo "$0: You need diff installed" 117 - exit 1 114 + exit $ksft_skip 118 115 fi 119 116 } 120 117 121 118 function load_req_mod() 122 119 { 123 - trap "test_modprobe" EXIT 124 - 125 120 if [ ! -d $DIR ]; then 121 + if ! modprobe -q -n $TEST_DRIVER; then 122 + echo "$0: module $TEST_DRIVER not found [SKIP]" 123 + exit $ksft_skip 124 + fi 126 125 modprobe $TEST_DRIVER 127 126 if [ $? -ne 0 ]; then 128 127 exit ··· 770 765 test_reqs 771 766 allow_user_defaults 772 767 check_production_sysctl_writes_strict 768 + test_modprobe 773 769 load_req_mod 774 770 775 771 trap "test_finish" EXIT
+7
tools/testing/selftests/user/test_user_copy.sh
··· 2 2 # SPDX-License-Identifier: GPL-2.0 3 3 # Runs copy_to/from_user infrastructure using test_user_copy kernel module 4 4 5 + # Kselftest framework requirement - SKIP code is 4. 6 + ksft_skip=4 7 + 8 + if ! /sbin/modprobe -q -n test_user_copy; then 9 + echo "user: module test_user_copy is not found [SKIP]" 10 + exit $ksft_skip 11 + fi 5 12 if /sbin/modprobe -q test_user_copy; then 6 13 /sbin/modprobe -q -r test_user_copy 7 14 echo "user_copy: ok"
+3 -1
tools/testing/selftests/vm/compaction_test.c
··· 16 16 #include <unistd.h> 17 17 #include <string.h> 18 18 19 + #include "../kselftest.h" 20 + 19 21 #define MAP_SIZE 1048576 20 22 21 23 struct map_list { ··· 171 169 printf("Either the sysctl compact_unevictable_allowed is not\n" 172 170 "set to 1 or couldn't read the proc file.\n" 173 171 "Skipping the test\n"); 174 - return 0; 172 + return KSFT_SKIP; 175 173 } 176 174 177 175 lim.rlim_cur = RLIM_INFINITY;
+7 -5
tools/testing/selftests/vm/mlock2-tests.c
··· 9 9 #include <stdbool.h> 10 10 #include "mlock2.h" 11 11 12 + #include "../kselftest.h" 13 + 12 14 struct vm_boundaries { 13 15 unsigned long start; 14 16 unsigned long end; ··· 305 303 if (mlock2_(map, 2 * page_size, 0)) { 306 304 if (errno == ENOSYS) { 307 305 printf("Cannot call new mlock family, skipping test\n"); 308 - _exit(0); 306 + _exit(KSFT_SKIP); 309 307 } 310 308 perror("mlock2(0)"); 311 309 goto unmap; ··· 414 412 if (mlock2_(map, 2 * page_size, MLOCK_ONFAULT)) { 415 413 if (errno == ENOSYS) { 416 414 printf("Cannot call new mlock family, skipping test\n"); 417 - _exit(0); 415 + _exit(KSFT_SKIP); 418 416 } 419 417 perror("mlock2(MLOCK_ONFAULT)"); 420 418 goto unmap; ··· 427 425 if (munlock(map, 2 * page_size)) { 428 426 if (errno == ENOSYS) { 429 427 printf("Cannot call new mlock family, skipping test\n"); 430 - _exit(0); 428 + _exit(KSFT_SKIP); 431 429 } 432 430 perror("munlock()"); 433 431 goto unmap; ··· 459 457 if (mlock2_(map, 2 * page_size, MLOCK_ONFAULT)) { 460 458 if (errno == ENOSYS) { 461 459 printf("Cannot call new mlock family, skipping test\n"); 462 - _exit(0); 460 + _exit(KSFT_SKIP); 463 461 } 464 462 perror("mlock2(MLOCK_ONFAULT)"); 465 463 goto unmap; ··· 585 583 if (call_mlock && mlock2_(map, 3 * page_size, MLOCK_ONFAULT)) { 586 584 if (errno == ENOSYS) { 587 585 printf("Cannot call new mlock family, skipping test\n"); 588 - _exit(0); 586 + _exit(KSFT_SKIP); 589 587 } 590 588 perror("mlock(ONFAULT)\n"); 591 589 goto out;
+4 -1
tools/testing/selftests/vm/run_vmtests
··· 2 2 # SPDX-License-Identifier: GPL-2.0 3 3 #please run as root 4 4 5 + # Kselftest framework requirement - SKIP code is 4. 6 + ksft_skip=4 7 + 5 8 mnt=./huge 6 9 exitcode=0 7 10 ··· 39 36 echo $(( $lackpgs + $nr_hugepgs )) > /proc/sys/vm/nr_hugepages 40 37 if [ $? -ne 0 ]; then 41 38 echo "Please run this test as root" 42 - exit 1 39 + exit $ksft_skip 43 40 fi 44 41 while read name size unit; do 45 42 if [ "$name" = "HugePages_Free:" ]; then
+3 -1
tools/testing/selftests/vm/userfaultfd.c
··· 69 69 #include <setjmp.h> 70 70 #include <stdbool.h> 71 71 72 + #include "../kselftest.h" 73 + 72 74 #ifdef __NR_userfaultfd 73 75 74 76 static unsigned long nr_cpus, nr_pages, nr_pages_per_cpu, page_size; ··· 1324 1322 int main(void) 1325 1323 { 1326 1324 printf("skip: Skipping userfaultfd test (missing __NR_userfaultfd)\n"); 1327 - return 0; 1325 + return KSFT_SKIP; 1328 1326 } 1329 1327 1330 1328 #endif /* __NR_userfaultfd */
+4 -1
tools/testing/selftests/zram/zram.sh
··· 2 2 # SPDX-License-Identifier: GPL-2.0 3 3 TCID="zram.sh" 4 4 5 + # Kselftest framework requirement - SKIP code is 4. 6 + ksft_skip=4 7 + 5 8 . ./zram_lib.sh 6 9 7 10 run_zram () { ··· 27 24 else 28 25 echo "$TCID : No zram.ko module or /dev/zram0 device file not found" 29 26 echo "$TCID : CONFIG_ZRAM is not set" 30 - exit 1 27 + exit $ksft_skip 31 28 fi
+4 -1
tools/testing/selftests/zram/zram_lib.sh
··· 18 18 dev_makeswap=-1 19 19 dev_mounted=-1 20 20 21 + # Kselftest framework requirement - SKIP code is 4. 22 + ksft_skip=4 23 + 21 24 trap INT 22 25 23 26 check_prereqs() ··· 30 27 31 28 if [ $uid -ne 0 ]; then 32 29 echo $msg must be run as root >&2 33 - exit 0 30 + exit $ksft_skip 34 31 fi 35 32 } 36 33