Commit 6cb7903e authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'linux-kselftest-4.16-rc1' of...

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

Pull kselftest updates from Shuah Khan:
 "This update to Kselftest consists of fixes, cleanups, and SPDX license
  additions"

* tag 'linux-kselftest-4.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
  selftests: vm: update .gitignore with missing generated file
  selftests/x86: Add <test_name>{,_32,_64} targets
  selftests: Fix loss of test output in run_kselftests.sh
  selftest: ftrace: Fix to add 256 kprobe events correctly
  selftest: ftrace: Fix to pick text symbols for kprobes
  selftests: media_tests: Add SPDX license identifier
  selftests: kselftest.h: Add SPDX license identifier
  selftests: kselftest_install.sh: Add SPDX license identifier
  selftests: gen_kselftest_tar.h: Add SPDX license identifier
  selftests: media_tests: Fix Makefile 'clean' target warning
  tools/testing: Fix trailing semicolon
  kselftest: fix OOM in memory compaction test
  selftests: seccomp: fix compile error seccomp_bpf
parents 23c35f48 0e9e327d
...@@ -116,8 +116,15 @@ ifdef INSTALL_PATH ...@@ -116,8 +116,15 @@ ifdef INSTALL_PATH
@# Ask all targets to emit their test scripts @# Ask all targets to emit their test scripts
echo "#!/bin/sh" > $(ALL_SCRIPT) echo "#!/bin/sh" > $(ALL_SCRIPT)
echo "cd \$$(dirname \$$0)" >> $(ALL_SCRIPT) echo "BASE_DIR=\$$(realpath \$$(dirname \$$0))" >> $(ALL_SCRIPT)
echo "cd \$$BASE_DIR" >> $(ALL_SCRIPT)
echo "ROOT=\$$PWD" >> $(ALL_SCRIPT) echo "ROOT=\$$PWD" >> $(ALL_SCRIPT)
echo "if [ \"\$$1\" = \"--summary\" ]; then" >> $(ALL_SCRIPT)
echo " OUTPUT=\$$BASE_DIR/output.log" >> $(ALL_SCRIPT)
echo " cat /dev/null > \$$OUTPUT" >> $(ALL_SCRIPT)
echo "else" >> $(ALL_SCRIPT)
echo " OUTPUT=/dev/stdout" >> $(ALL_SCRIPT)
echo "fi" >> $(ALL_SCRIPT)
for TARGET in $(TARGETS); do \ for TARGET in $(TARGETS); do \
BUILD_TARGET=$$BUILD/$$TARGET; \ BUILD_TARGET=$$BUILD/$$TARGET; \
......
...@@ -12,9 +12,24 @@ case `uname -m` in ...@@ -12,9 +12,24 @@ case `uname -m` in
*) OFFS=0;; *) OFFS=0;;
esac esac
echo "Setup up to 256 kprobes" if [ -d events/kprobes ]; then
grep t /proc/kallsyms | cut -f3 -d" " | grep -v .*\\..* | \ echo 0 > events/kprobes/enable
head -n 256 | while read i; do echo p ${i}+${OFFS} ; done > kprobe_events ||: echo > kprobe_events
fi
N=0
echo "Setup up kprobes on first available 256 text symbols"
grep -i " t " /proc/kallsyms | cut -f3 -d" " | grep -v .*\\..* | \
while read i; do
echo p ${i}+${OFFS} >> kprobe_events && N=$((N+1)) ||:
test $N -eq 256 && break
done
L=`wc -l kprobe_events`
if [ $L -ne $N ]; then
echo "The number of kprobes events ($L) is not $N"
exit_fail
fi
echo 1 > events/kprobes/enable echo 1 > events/kprobes/enable
echo 0 > events/kprobes/enable echo 0 > events/kprobes/enable
......
#!/bin/bash #!/bin/bash
# #
# SPDX-License-Identifier: GPL-2.0
# gen_kselftest_tar # gen_kselftest_tar
# Generate kselftest tarball # Generate kselftest tarball
# Author: Shuah Khan <shuahkh@osg.samsung.com> # Author: Shuah Khan <shuahkh@osg.samsung.com>
# Copyright (C) 2015 Samsung Electronics Co., Ltd. # Copyright (C) 2015 Samsung Electronics Co., Ltd.
# This software may be freely redistributed under the terms of the GNU
# General Public License (GPLv2).
# main # main
main() main()
{ {
......
/* SPDX-License-Identifier: GPL-2.0 */
/* /*
* kselftest.h: kselftest framework return codes to include from * kselftest.h: kselftest framework return codes to include from
* selftests. * selftests.
...@@ -5,7 +6,6 @@ ...@@ -5,7 +6,6 @@
* Copyright (c) 2014 Shuah Khan <shuahkh@osg.samsung.com> * Copyright (c) 2014 Shuah Khan <shuahkh@osg.samsung.com>
* Copyright (c) 2014 Samsung Electronics Co., Ltd. * Copyright (c) 2014 Samsung Electronics Co., Ltd.
* *
* This file is released under the GPLv2.
*/ */
#ifndef __KSELFTEST_H #ifndef __KSELFTEST_H
#define __KSELFTEST_H #define __KSELFTEST_H
......
#!/bin/bash #!/bin/bash
# SPDX-License-Identifier: GPL-2.0
# #
# Kselftest Install # Kselftest Install
# Install kselftest tests # Install kselftest tests
# Author: Shuah Khan <shuahkh@osg.samsung.com> # Author: Shuah Khan <shuahkh@osg.samsung.com>
# Copyright (C) 2015 Samsung Electronics Co., Ltd. # Copyright (C) 2015 Samsung Electronics Co., Ltd.
# This software may be freely redistributed under the terms of the GNU
# General Public License (GPLv2).
install_loc=`pwd` install_loc=`pwd`
main() main()
......
...@@ -77,7 +77,7 @@ endif ...@@ -77,7 +77,7 @@ endif
define EMIT_TESTS define EMIT_TESTS
@for TEST in $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) $(TEST_PROGS); do \ @for TEST in $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) $(TEST_PROGS); do \
BASENAME_TEST=`basename $$TEST`; \ BASENAME_TEST=`basename $$TEST`; \
echo "(./$$BASENAME_TEST > /tmp/$$BASENAME_TEST 2>&1 && echo \"selftests: $$BASENAME_TEST [PASS]\") || echo \"selftests: $$BASENAME_TEST [FAIL]\""; \ echo "(./$$BASENAME_TEST >> \$$OUTPUT 2>&1 && echo \"selftests: $$BASENAME_TEST [PASS]\") || echo \"selftests: $$BASENAME_TEST [FAIL]\""; \
done; done;
endef endef
......
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
TEST_PROGS := media_device_test media_device_open video_device_test TEST_GEN_PROGS := media_device_test media_device_open video_device_test
all: $(TEST_PROGS) all: $(TEST_GEN_PROGS)
include ../lib.mk include ../lib.mk
clean:
rm -fr media_device_test media_device_open video_device_test
// SPDX-License-Identifier: GPL-2.0
/* /*
* media_device_open.c - Media Controller Device Open Test * media_device_open.c - Media Controller Device Open Test
* *
* Copyright (c) 2016 Shuah Khan <shuahkh@osg.samsung.com> * Copyright (c) 2016 Shuah Khan <shuahkh@osg.samsung.com>
* Copyright (c) 2016 Samsung Electronics Co., Ltd. * Copyright (c) 2016 Samsung Electronics Co., Ltd.
* *
* This file is released under the GPLv2.
*/ */
/* /*
......
// SPDX-License-Identifier: GPL-2.0
/* /*
* media_device_test.c - Media Controller Device ioctl loop Test * media_device_test.c - Media Controller Device ioctl loop Test
* *
* Copyright (c) 2016 Shuah Khan <shuahkh@osg.samsung.com> * Copyright (c) 2016 Shuah Khan <shuahkh@osg.samsung.com>
* Copyright (c) 2016 Samsung Electronics Co., Ltd. * Copyright (c) 2016 Samsung Electronics Co., Ltd.
* *
* This file is released under the GPLv2.
*/ */
/* /*
......
// SPDX-License-Identifier: GPL-2.0
/* /*
* video_device_test - Video Device Test * video_device_test - Video Device Test
* *
* Copyright (c) 2016 Shuah Khan <shuahkh@osg.samsung.com> * Copyright (c) 2016 Shuah Khan <shuahkh@osg.samsung.com>
* Copyright (c) 2016 Samsung Electronics Co., Ltd. * Copyright (c) 2016 Samsung Electronics Co., Ltd.
* *
* This file is released under the GPLv2.
*/ */
/* /*
......
...@@ -70,7 +70,7 @@ int main(int argc, char *argv[]) ...@@ -70,7 +70,7 @@ int main(int argc, char *argv[])
return pr_err("NS_GET_PARENT returned a wrong namespace"); return pr_err("NS_GET_PARENT returned a wrong namespace");
if (ioctl(pns, NS_GET_PARENT) >= 0 || errno != EPERM) if (ioctl(pns, NS_GET_PARENT) >= 0 || errno != EPERM)
return pr_err("Don't get EPERM");; return pr_err("Don't get EPERM");
} }
kill(pid, SIGKILL); kill(pid, SIGKILL);
......
...@@ -1717,7 +1717,7 @@ void tracer_ptrace(struct __test_metadata *_metadata, pid_t tracee, ...@@ -1717,7 +1717,7 @@ void tracer_ptrace(struct __test_metadata *_metadata, pid_t tracee,
if (nr == __NR_getpid) if (nr == __NR_getpid)
change_syscall(_metadata, tracee, __NR_getppid); change_syscall(_metadata, tracee, __NR_getppid);
if (nr == __NR_open) if (nr == __NR_openat)
change_syscall(_metadata, tracee, -1); change_syscall(_metadata, tracee, -1);
} }
...@@ -1792,7 +1792,7 @@ TEST_F(TRACE_syscall, ptrace_syscall_dropped) ...@@ -1792,7 +1792,7 @@ TEST_F(TRACE_syscall, ptrace_syscall_dropped)
true); true);
/* Tracer should skip the open syscall, resulting in EPERM. */ /* Tracer should skip the open syscall, resulting in EPERM. */
EXPECT_SYSCALL_RETURN(EPERM, syscall(__NR_open)); EXPECT_SYSCALL_RETURN(EPERM, syscall(__NR_openat));
} }
TEST_F(TRACE_syscall, syscall_allowed) TEST_F(TRACE_syscall, syscall_allowed)
......
...@@ -10,3 +10,4 @@ userfaultfd ...@@ -10,3 +10,4 @@ userfaultfd
mlock-intersect-test mlock-intersect-test
mlock-random-test mlock-random-test
virtual_address_range virtual_address_range
gup_benchmark
...@@ -137,6 +137,8 @@ int check_compaction(unsigned long mem_free, unsigned int hugepage_size) ...@@ -137,6 +137,8 @@ int check_compaction(unsigned long mem_free, unsigned int hugepage_size)
printf("No of huge pages allocated = %d\n", printf("No of huge pages allocated = %d\n",
(atoi(nr_hugepages))); (atoi(nr_hugepages)));
lseek(fd, 0, SEEK_SET);
if (write(fd, initial_nr_hugepages, strlen(initial_nr_hugepages)) if (write(fd, initial_nr_hugepages, strlen(initial_nr_hugepages))
!= strlen(initial_nr_hugepages)) { != strlen(initial_nr_hugepages)) {
perror("Failed to write value to /proc/sys/vm/nr_hugepages\n"); perror("Failed to write value to /proc/sys/vm/nr_hugepages\n");
......
...@@ -27,14 +27,26 @@ UNAME_M := $(shell uname -m) ...@@ -27,14 +27,26 @@ UNAME_M := $(shell uname -m)
CAN_BUILD_I386 := $(shell ./check_cc.sh $(CC) trivial_32bit_program.c -m32) CAN_BUILD_I386 := $(shell ./check_cc.sh $(CC) trivial_32bit_program.c -m32)
CAN_BUILD_X86_64 := $(shell ./check_cc.sh $(CC) trivial_64bit_program.c) CAN_BUILD_X86_64 := $(shell ./check_cc.sh $(CC) trivial_64bit_program.c)
define gen-target-rule-32
$(1) $(1)_32: $(OUTPUT)/$(1)_32
.PHONY: $(1) $(1)_32
endef
define gen-target-rule-64
$(1) $(1)_64: $(OUTPUT)/$(1)_64
.PHONY: $(1) $(1)_64
endef
ifeq ($(CAN_BUILD_I386),1) ifeq ($(CAN_BUILD_I386),1)
all: all_32 all: all_32
TEST_PROGS += $(BINARIES_32) TEST_PROGS += $(BINARIES_32)
$(foreach t,$(TARGETS_C_32BIT_ALL),$(eval $(call gen-target-rule-32,$(t))))
endif endif
ifeq ($(CAN_BUILD_X86_64),1) ifeq ($(CAN_BUILD_X86_64),1)
all: all_64 all: all_64
TEST_PROGS += $(BINARIES_64) TEST_PROGS += $(BINARIES_64)
$(foreach t,$(TARGETS_C_64BIT_ALL),$(eval $(call gen-target-rule-64,$(t))))
endif endif
all_32: $(BINARIES_32) all_32: $(BINARIES_32)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment