linux-kselftest-4.16-rc1

This update to Kselftest consists of fixes, cleanups, and SPDX license
 additions.
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABCAAGBQJadJYsAAoJEAsCRMQNDUMctVQQALNwjN8c/MOW248OelupZooT
 +aht2xdIE8g+277CisFwAcBVJST9JOdmwh8qdTnOBsN76bW9RyJQKJGBGYMYVjoD
 cZvnLwa7PykSISRI34xwYh83Ruj3D8+8bJezQkkRoLSU8GUlgKOKa+V9JVPQ/QOE
 /ZSL8Qwc/7EMGweEjmjznIhhAq54teVBgTdotifwz87XWLWYL2AGL+YILFSnKiK+
 RiMxPP1jks/iHqQvlmRRsSBJuN/rjYMqrYZ8nBFsImnRqVKJLWtW5uZYeNxurr+C
 CsL8vf/Sornd06oMJdss+iADh/AetabNt9jTYOlPsvO5vj1P6ooYKwSbTDmoK71S
 K7BaXXwVOEzWtCVHY769EARP2ZFmQd7VKVQjOO0yiA1vKa0bpAEVhC/E9GYsjh2r
 2G6H+txTokLSKLx03q2fmjbspyhXZl8mwvdGhET92T439v2g6bF1KIglUbgbz9Sb
 C+RSWfYQCFncMvyGctfTFx6An2ubGYPPjBqIBlUmIwIRd6n4U7c3GIwOCRJS4Gu9
 zvMXZozfA2YVbHrqBBevCfPnYnreo70pSJNJNNS2Nc7ZQIxQM3GRtxWMl0pWDxPO
 91jz+csqSXxR5qMQ8aymbNRKOkepS5cFWXGs1iyAkctQAxh15UGdNFJgt/0N17Wh
 VtwiOq6av5tGxFfzHuHl
 =gpS1
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2018-02-03 13:01:19 -08:00
commit 6cb7903e37
15 changed files with 56 additions and 23 deletions

View File

@ -116,8 +116,15 @@ ifdef INSTALL_PATH
@# Ask all targets to emit their test scripts
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 "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 \
BUILD_TARGET=$$BUILD/$$TARGET; \

View File

@ -12,9 +12,24 @@ case `uname -m` in
*) OFFS=0;;
esac
echo "Setup up to 256 kprobes"
grep t /proc/kallsyms | cut -f3 -d" " | grep -v .*\\..* | \
head -n 256 | while read i; do echo p ${i}+${OFFS} ; done > kprobe_events ||:
if [ -d events/kprobes ]; then
echo 0 > events/kprobes/enable
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 0 > events/kprobes/enable

View File

@ -1,13 +1,11 @@
#!/bin/bash
#
# SPDX-License-Identifier: GPL-2.0
# gen_kselftest_tar
# Generate kselftest tarball
# Author: Shuah Khan <shuahkh@osg.samsung.com>
# 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()
{

View File

@ -1,3 +1,4 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* kselftest.h: kselftest framework return codes to include from
* selftests.
@ -5,7 +6,6 @@
* Copyright (c) 2014 Shuah Khan <shuahkh@osg.samsung.com>
* Copyright (c) 2014 Samsung Electronics Co., Ltd.
*
* This file is released under the GPLv2.
*/
#ifndef __KSELFTEST_H
#define __KSELFTEST_H

View File

@ -1,13 +1,11 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
#
# Kselftest Install
# Install kselftest tests
# Author: Shuah Khan <shuahkh@osg.samsung.com>
# 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`
main()

View File

@ -77,7 +77,7 @@ endif
define EMIT_TESTS
@for TEST in $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) $(TEST_PROGS); do \
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;
endef

View File

@ -1,8 +1,5 @@
# SPDX-License-Identifier: GPL-2.0
TEST_PROGS := media_device_test media_device_open video_device_test
all: $(TEST_PROGS)
TEST_GEN_PROGS := media_device_test media_device_open video_device_test
all: $(TEST_GEN_PROGS)
include ../lib.mk
clean:
rm -fr media_device_test media_device_open video_device_test

View File

@ -1,10 +1,11 @@
// SPDX-License-Identifier: GPL-2.0
/*
* media_device_open.c - Media Controller Device Open Test
*
* Copyright (c) 2016 Shuah Khan <shuahkh@osg.samsung.com>
* Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* This file is released under the GPLv2.
*/
/*

View File

@ -1,10 +1,11 @@
// SPDX-License-Identifier: GPL-2.0
/*
* media_device_test.c - Media Controller Device ioctl loop Test
*
* Copyright (c) 2016 Shuah Khan <shuahkh@osg.samsung.com>
* Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* This file is released under the GPLv2.
*/
/*

View File

@ -1,10 +1,11 @@
// SPDX-License-Identifier: GPL-2.0
/*
* video_device_test - Video Device Test
*
* Copyright (c) 2016 Shuah Khan <shuahkh@osg.samsung.com>
* Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* This file is released under the GPLv2.
*/
/*

View File

@ -70,7 +70,7 @@ int main(int argc, char *argv[])
return pr_err("NS_GET_PARENT returned a wrong namespace");
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);

View File

@ -1717,7 +1717,7 @@ void tracer_ptrace(struct __test_metadata *_metadata, pid_t tracee,
if (nr == __NR_getpid)
change_syscall(_metadata, tracee, __NR_getppid);
if (nr == __NR_open)
if (nr == __NR_openat)
change_syscall(_metadata, tracee, -1);
}
@ -1792,7 +1792,7 @@ TEST_F(TRACE_syscall, ptrace_syscall_dropped)
true);
/* 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)

View File

@ -10,3 +10,4 @@ userfaultfd
mlock-intersect-test
mlock-random-test
virtual_address_range
gup_benchmark

View File

@ -137,6 +137,8 @@ int check_compaction(unsigned long mem_free, unsigned int hugepage_size)
printf("No of huge pages allocated = %d\n",
(atoi(nr_hugepages)));
lseek(fd, 0, SEEK_SET);
if (write(fd, initial_nr_hugepages, strlen(initial_nr_hugepages))
!= strlen(initial_nr_hugepages)) {
perror("Failed to write value to /proc/sys/vm/nr_hugepages\n");

View File

@ -27,14 +27,26 @@ UNAME_M := $(shell uname -m)
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)
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)
all: all_32
TEST_PROGS += $(BINARIES_32)
$(foreach t,$(TARGETS_C_32BIT_ALL),$(eval $(call gen-target-rule-32,$(t))))
endif
ifeq ($(CAN_BUILD_X86_64),1)
all: all_64
TEST_PROGS += $(BINARIES_64)
$(foreach t,$(TARGETS_C_64BIT_ALL),$(eval $(call gen-target-rule-64,$(t))))
endif
all_32: $(BINARIES_32)