Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull kselftest fixes from Shuah Khan:
"This update contains 7 fixes for problems ranging from build failurs
to incorrect error reporting"

* tag 'linux-kselftest-4.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
selftests: exec: revert to default emit rule
selftests: change install command to rsync
selftests: mqueue: simplify the Makefile
selftests: mqueue: allow extra cflags
selftests: rename jump label to static_keys
selftests/seccomp: add support for s390
seltests/zram: fix syntax error

+52 -34
+1 -1
tools/testing/selftests/Makefile
··· 16 16 TARGETS += ptrace 17 17 TARGETS += seccomp 18 18 TARGETS += size 19 + TARGETS += static_keys 19 20 TARGETS += sysctl 20 21 ifneq (1, $(quicktest)) 21 22 TARGETS += timers 22 23 endif 23 24 TARGETS += user 24 - TARGETS += jumplabel 25 25 TARGETS += vm 26 26 TARGETS += x86 27 27 TARGETS += zram
+1 -3
tools/testing/selftests/exec/Makefile
··· 1 1 CFLAGS = -Wall 2 2 BINARIES = execveat 3 - DEPS = execveat.symlink execveat.denatured script 3 + DEPS = execveat.symlink execveat.denatured script subdir 4 4 all: $(BINARIES) $(DEPS) 5 5 6 6 subdir: ··· 21 21 TEST_FILES := $(DEPS) 22 22 23 23 include ../lib.mk 24 - 25 - override EMIT_TESTS := echo "mkdir -p subdir; (./execveat && echo \"selftests: execveat [PASS]\") || echo \"selftests: execveat [FAIL]\"" 26 24 27 25 clean: 28 26 rm -rf $(BINARIES) $(DEPS) subdir.moved execveat.moved xxxxx*
+1 -1
tools/testing/selftests/ftrace/Makefile
··· 1 1 all: 2 2 3 3 TEST_PROGS := ftracetest 4 - TEST_DIRS := test.d/ 4 + TEST_DIRS := test.d 5 5 6 6 include ../lib.mk 7 7
+4 -7
tools/testing/selftests/lib.mk
··· 12 12 $(RUN_TESTS) 13 13 14 14 define INSTALL_RULE 15 - @if [ "X$(TEST_PROGS)$(TEST_PROGS_EXTENDED)$(TEST_FILES)" != "X" ]; then \ 16 - mkdir -p $(INSTALL_PATH); \ 17 - for TEST_DIR in $(TEST_DIRS); do \ 18 - cp -r $$TEST_DIR $(INSTALL_PATH); \ 19 - done; \ 20 - echo "install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES)"; \ 21 - install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES); \ 15 + @if [ "X$(TEST_PROGS)$(TEST_PROGS_EXTENDED)$(TEST_FILES)" != "X" ]; then \ 16 + mkdir -p ${INSTALL_PATH}; \ 17 + echo "rsync -a $(TEST_DIRS) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(INSTALL_PATH)/"; \ 18 + rsync -a $(TEST_DIRS) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(INSTALL_PATH)/; \ 22 19 fi 23 20 endef 24 21
+4 -6
tools/testing/selftests/mqueue/Makefile
··· 1 - CFLAGS = -O2 1 + CFLAGS += -O2 2 + LDLIBS = -lrt -lpthread -lpopt 3 + TEST_PROGS := mq_open_tests mq_perf_tests 2 4 3 - all: 4 - $(CC) $(CFLAGS) mq_open_tests.c -o mq_open_tests -lrt 5 - $(CC) $(CFLAGS) -o mq_perf_tests mq_perf_tests.c -lrt -lpthread -lpopt 5 + all: $(TEST_PROGS) 6 6 7 7 include ../lib.mk 8 8 ··· 10 10 @./mq_open_tests /test1 || echo "selftests: mq_open_tests [FAIL]" 11 11 @./mq_perf_tests || echo "selftests: mq_perf_tests [FAIL]" 12 12 endef 13 - 14 - TEST_PROGS := mq_open_tests mq_perf_tests 15 13 16 14 override define EMIT_TESTS 17 15 echo "./mq_open_tests /test1 || echo \"selftests: mq_open_tests [FAIL]\""
+36 -1
tools/testing/selftests/seccomp/seccomp_bpf.c
··· 1210 1210 # define ARCH_REGS struct pt_regs 1211 1211 # define SYSCALL_NUM gpr[0] 1212 1212 # define SYSCALL_RET gpr[3] 1213 + #elif defined(__s390__) 1214 + # define ARCH_REGS s390_regs 1215 + # define SYSCALL_NUM gprs[2] 1216 + # define SYSCALL_RET gprs[2] 1213 1217 #else 1214 1218 # error "Do not know how to find your architecture's registers and syscalls" 1215 1219 #endif ··· 1247 1243 ret = ptrace(PTRACE_GETREGSET, tracee, NT_PRSTATUS, &iov); 1248 1244 EXPECT_EQ(0, ret); 1249 1245 1250 - #if defined(__x86_64__) || defined(__i386__) || defined(__aarch64__) || defined(__powerpc__) 1246 + #if defined(__x86_64__) || defined(__i386__) || defined(__aarch64__) || \ 1247 + defined(__powerpc__) || defined(__s390__) 1251 1248 { 1252 1249 regs.SYSCALL_NUM = syscall; 1253 1250 } ··· 1286 1281 ret = ptrace(PTRACE_GETEVENTMSG, tracee, NULL, &msg); 1287 1282 EXPECT_EQ(0, ret); 1288 1283 1284 + /* Validate and take action on expected syscalls. */ 1289 1285 switch (msg) { 1290 1286 case 0x1002: 1291 1287 /* change getpid to getppid. */ 1288 + EXPECT_EQ(__NR_getpid, get_syscall(_metadata, tracee)); 1292 1289 change_syscall(_metadata, tracee, __NR_getppid); 1293 1290 break; 1294 1291 case 0x1003: 1295 1292 /* skip gettid. */ 1293 + EXPECT_EQ(__NR_gettid, get_syscall(_metadata, tracee)); 1296 1294 change_syscall(_metadata, tracee, -1); 1297 1295 break; 1298 1296 case 0x1004: 1299 1297 /* do nothing (allow getppid) */ 1298 + EXPECT_EQ(__NR_getppid, get_syscall(_metadata, tracee)); 1300 1299 break; 1301 1300 default: 1302 1301 EXPECT_EQ(0, msg) { ··· 1418 1409 # define __NR_seccomp 277 1419 1410 # elif defined(__powerpc__) 1420 1411 # define __NR_seccomp 358 1412 + # elif defined(__s390__) 1413 + # define __NR_seccomp 348 1421 1414 # else 1422 1415 # warning "seccomp syscall number unknown for this architecture" 1423 1416 # define __NR_seccomp 0xffff ··· 1464 1453 1465 1454 /* Reject insane operation. */ 1466 1455 ret = seccomp(-1, 0, &prog); 1456 + ASSERT_NE(ENOSYS, errno) { 1457 + TH_LOG("Kernel does not support seccomp syscall!"); 1458 + } 1467 1459 EXPECT_EQ(EINVAL, errno) { 1468 1460 TH_LOG("Did not reject crazy op value!"); 1469 1461 } ··· 1515 1501 } 1516 1502 1517 1503 ret = seccomp(SECCOMP_SET_MODE_FILTER, 0, &prog); 1504 + ASSERT_NE(ENOSYS, errno) { 1505 + TH_LOG("Kernel does not support seccomp syscall!"); 1506 + } 1518 1507 EXPECT_EQ(0, ret) { 1519 1508 TH_LOG("Could not install filter!"); 1520 1509 } ··· 1552 1535 1553 1536 ret = seccomp(SECCOMP_SET_MODE_FILTER, SECCOMP_FLAG_FILTER_TSYNC, 1554 1537 &prog); 1538 + ASSERT_NE(ENOSYS, errno) { 1539 + TH_LOG("Kernel does not support seccomp syscall!"); 1540 + } 1555 1541 EXPECT_EQ(0, ret) { 1556 1542 TH_LOG("Could not install initial filter with TSYNC!"); 1557 1543 } ··· 1714 1694 1715 1695 /* Check prctl failure detection by requesting sib 0 diverge. */ 1716 1696 ret = seccomp(SECCOMP_SET_MODE_FILTER, 0, &prog); 1697 + ASSERT_NE(ENOSYS, errno) { 1698 + TH_LOG("Kernel does not support seccomp syscall!"); 1699 + } 1717 1700 ASSERT_EQ(0, ret) { 1718 1701 TH_LOG("setting filter failed"); 1719 1702 } ··· 1754 1731 } 1755 1732 1756 1733 ret = seccomp(SECCOMP_SET_MODE_FILTER, 0, &self->root_prog); 1734 + ASSERT_NE(ENOSYS, errno) { 1735 + TH_LOG("Kernel does not support seccomp syscall!"); 1736 + } 1757 1737 ASSERT_EQ(0, ret) { 1758 1738 TH_LOG("Kernel does not support SECCOMP_SET_MODE_FILTER!"); 1759 1739 } ··· 1831 1805 1832 1806 ret = seccomp(SECCOMP_SET_MODE_FILTER, SECCOMP_FLAG_FILTER_TSYNC, 1833 1807 &self->apply_prog); 1808 + ASSERT_NE(ENOSYS, errno) { 1809 + TH_LOG("Kernel does not support seccomp syscall!"); 1810 + } 1834 1811 ASSERT_EQ(0, ret) { 1835 1812 TH_LOG("Could install filter on all threads!"); 1836 1813 } ··· 1862 1833 } 1863 1834 1864 1835 ret = seccomp(SECCOMP_SET_MODE_FILTER, 0, &self->root_prog); 1836 + ASSERT_NE(ENOSYS, errno) { 1837 + TH_LOG("Kernel does not support seccomp syscall!"); 1838 + } 1865 1839 ASSERT_EQ(0, ret) { 1866 1840 TH_LOG("Kernel does not support SECCOMP_SET_MODE_FILTER!"); 1867 1841 } ··· 1922 1890 } 1923 1891 1924 1892 ret = seccomp(SECCOMP_SET_MODE_FILTER, 0, &self->root_prog); 1893 + ASSERT_NE(ENOSYS, errno) { 1894 + TH_LOG("Kernel does not support seccomp syscall!"); 1895 + } 1925 1896 ASSERT_EQ(0, ret) { 1926 1897 TH_LOG("Kernel does not support SECCOMP_SET_MODE_FILTER!"); 1927 1898 }
+2 -5
tools/testing/selftests/seccomp/test_harness.h
··· 370 370 __typeof__(_expected) __exp = (_expected); \ 371 371 __typeof__(_seen) __seen = (_seen); \ 372 372 if (!(__exp _t __seen)) { \ 373 - unsigned long long __exp_print = 0; \ 374 - unsigned long long __seen_print = 0; \ 375 - /* Avoid casting complaints the scariest way we can. */ \ 376 - memcpy(&__exp_print, &__exp, sizeof(__exp)); \ 377 - memcpy(&__seen_print, &__seen, sizeof(__seen)); \ 373 + unsigned long long __exp_print = (unsigned long long)__exp; \ 374 + unsigned long long __seen_print = (unsigned long long)__seen; \ 378 375 __TH_LOG("Expected %s (%llu) %s %s (%llu)", \ 379 376 #_expected, __exp_print, #_t, \ 380 377 #_seen, __seen_print); \
+1 -9
tools/testing/selftests/zram/zram.sh
··· 1 1 #!/bin/bash 2 2 TCID="zram.sh" 3 3 4 - check_prereqs() 5 - { 6 - local msg="skip all tests:" 7 - 8 - if [ $UID != 0 ]; then 9 - echo $msg must be run as root >&2 10 - exit 0 11 - fi 12 - } 4 + . ./zram_lib.sh 13 5 14 6 run_zram () { 15 7 echo "--------------------"
+2 -1
tools/testing/selftests/zram/zram_lib.sh
··· 23 23 check_prereqs() 24 24 { 25 25 local msg="skip all tests:" 26 + local uid=$(id -u) 26 27 27 - if [ $UID != 0 ]; then 28 + if [ $uid -ne 0 ]; then 28 29 echo $msg must be run as root >&2 29 30 exit 0 30 31 fi