Commit b13fbe77 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'linux-kselftest-4.18-rc2' of...

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
parents 81f9c4e4 eb83d5f7
...@@ -7,13 +7,16 @@ ...@@ -7,13 +7,16 @@
# #
# Released under the terms of the GPL v2. # Released under the terms of the GPL v2.
# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4
. ./common_tests . ./common_tests
if [ -e $REBOOT_FLAG ]; then if [ -e $REBOOT_FLAG ]; then
rm $REBOOT_FLAG rm $REBOOT_FLAG
else else
prlog "pstore_crash_test has not been executed yet. we skip further tests." prlog "pstore_crash_test has not been executed yet. we skip further tests."
exit 0 exit $ksft_skip
fi fi
prlog -n "Mounting pstore filesystem ... " prlog -n "Mounting pstore filesystem ... "
......
# SPDX-License-Identifier: GPL-2.0
uname_M := $(shell uname -m 2>/dev/null || echo not)
ARCH ?= $(shell echo $(uname_M) | sed -e s/x86_64/x86/)
ifneq ($(ARCH),sparc64)
nothing:
.PHONY: all clean run_tests install
.SILENT:
else
SUBDIRS := drivers SUBDIRS := drivers
TEST_PROGS := run.sh TEST_PROGS := run.sh
.PHONY: all clean .PHONY: all clean
include ../lib.mk include ../lib.mk
...@@ -18,10 +29,6 @@ all: ...@@ -18,10 +29,6 @@ all:
fi \ fi \
done done
override define RUN_TESTS
@cd $(OUTPUT); ./run.sh
endef
override define INSTALL_RULE override define INSTALL_RULE
mkdir -p $(INSTALL_PATH) mkdir -p $(INSTALL_PATH)
install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES)
...@@ -33,10 +40,6 @@ override define INSTALL_RULE ...@@ -33,10 +40,6 @@ override define INSTALL_RULE
done; done;
endef endef
override define EMIT_TESTS
echo "./run.sh"
endef
override define CLEAN override define CLEAN
@for DIR in $(SUBDIRS); do \ @for DIR in $(SUBDIRS); do \
BUILD_TARGET=$(OUTPUT)/$$DIR; \ BUILD_TARGET=$(OUTPUT)/$$DIR; \
...@@ -44,3 +47,4 @@ override define CLEAN ...@@ -44,3 +47,4 @@ override define CLEAN
make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\ make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
done done
endef endef
endif
# SPDX-License-Identifier: GPL-2.0
INCLUDEDIR := -I. INCLUDEDIR := -I.
CFLAGS := $(CFLAGS) $(INCLUDEDIR) -Wall -O2 -g CFLAGS := $(CFLAGS) $(INCLUDEDIR) -Wall -O2 -g
......
...@@ -2,6 +2,19 @@ ...@@ -2,6 +2,19 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# Runs static keys kernel module tests # Runs static keys kernel module tests
# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4
if ! /sbin/modprobe -q -n test_static_key_base; then
echo "static_key: module test_static_key_base is not found [SKIP]"
exit $ksft_skip
fi
if ! /sbin/modprobe -q -n test_static_keys; then
echo "static_key: module test_static_keys is not found [SKIP]"
exit $ksft_skip
fi
if /sbin/modprobe -q test_static_key_base; then if /sbin/modprobe -q test_static_key_base; then
if /sbin/modprobe -q test_static_keys; then if /sbin/modprobe -q test_static_keys; then
echo "static_key: ok" echo "static_key: ok"
......
CONFIG_STAGING=y
CONFIG_ANDROID=y
CONFIG_SYNC=y
CONFIG_SW_SYNC=y
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
# This performs a series tests against the proc sysctl interface. # This performs a series tests against the proc sysctl interface.
# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4
TEST_NAME="sysctl" TEST_NAME="sysctl"
TEST_DRIVER="test_${TEST_NAME}" TEST_DRIVER="test_${TEST_NAME}"
TEST_DIR=$(dirname $0) TEST_DIR=$(dirname $0)
...@@ -41,7 +44,7 @@ test_modprobe() ...@@ -41,7 +44,7 @@ test_modprobe()
echo "$0: $DIR not present" >&2 echo "$0: $DIR not present" >&2
echo "You must have the following enabled in your kernel:" >&2 echo "You must have the following enabled in your kernel:" >&2
cat $TEST_DIR/config >&2 cat $TEST_DIR/config >&2
exit 1 exit $ksft_skip
fi fi
} }
...@@ -98,28 +101,30 @@ test_reqs() ...@@ -98,28 +101,30 @@ test_reqs()
uid=$(id -u) uid=$(id -u)
if [ $uid -ne 0 ]; then if [ $uid -ne 0 ]; then
echo $msg must be run as root >&2 echo $msg must be run as root >&2
exit 0 exit $ksft_skip
fi fi
if ! which perl 2> /dev/null > /dev/null; then if ! which perl 2> /dev/null > /dev/null; then
echo "$0: You need perl installed" echo "$0: You need perl installed"
exit 1 exit $ksft_skip
fi fi
if ! which getconf 2> /dev/null > /dev/null; then if ! which getconf 2> /dev/null > /dev/null; then
echo "$0: You need getconf installed" echo "$0: You need getconf installed"
exit 1 exit $ksft_skip
fi fi
if ! which diff 2> /dev/null > /dev/null; then if ! which diff 2> /dev/null > /dev/null; then
echo "$0: You need diff installed" echo "$0: You need diff installed"
exit 1 exit $ksft_skip
fi fi
} }
function load_req_mod() function load_req_mod()
{ {
trap "test_modprobe" EXIT
if [ ! -d $DIR ]; then if [ ! -d $DIR ]; then
if ! modprobe -q -n $TEST_DRIVER; then
echo "$0: module $TEST_DRIVER not found [SKIP]"
exit $ksft_skip
fi
modprobe $TEST_DRIVER modprobe $TEST_DRIVER
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
exit exit
...@@ -765,6 +770,7 @@ function parse_args() ...@@ -765,6 +770,7 @@ function parse_args()
test_reqs test_reqs
allow_user_defaults allow_user_defaults
check_production_sysctl_writes_strict check_production_sysctl_writes_strict
test_modprobe
load_req_mod load_req_mod
trap "test_finish" EXIT trap "test_finish" EXIT
......
...@@ -2,6 +2,13 @@ ...@@ -2,6 +2,13 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# Runs copy_to/from_user infrastructure using test_user_copy kernel module # Runs copy_to/from_user infrastructure using test_user_copy kernel module
# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4
if ! /sbin/modprobe -q -n test_user_copy; then
echo "user: module test_user_copy is not found [SKIP]"
exit $ksft_skip
fi
if /sbin/modprobe -q test_user_copy; then if /sbin/modprobe -q test_user_copy; then
/sbin/modprobe -q -r test_user_copy /sbin/modprobe -q -r test_user_copy
echo "user_copy: ok" echo "user_copy: ok"
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include "../kselftest.h"
#define MAP_SIZE 1048576 #define MAP_SIZE 1048576
struct map_list { struct map_list {
...@@ -169,7 +171,7 @@ int main(int argc, char **argv) ...@@ -169,7 +171,7 @@ int main(int argc, char **argv)
printf("Either the sysctl compact_unevictable_allowed is not\n" printf("Either the sysctl compact_unevictable_allowed is not\n"
"set to 1 or couldn't read the proc file.\n" "set to 1 or couldn't read the proc file.\n"
"Skipping the test\n"); "Skipping the test\n");
return 0; return KSFT_SKIP;
} }
lim.rlim_cur = RLIM_INFINITY; lim.rlim_cur = RLIM_INFINITY;
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
#include <stdbool.h> #include <stdbool.h>
#include "mlock2.h" #include "mlock2.h"
#include "../kselftest.h"
struct vm_boundaries { struct vm_boundaries {
unsigned long start; unsigned long start;
unsigned long end; unsigned long end;
...@@ -303,7 +305,7 @@ static int test_mlock_lock() ...@@ -303,7 +305,7 @@ static int test_mlock_lock()
if (mlock2_(map, 2 * page_size, 0)) { if (mlock2_(map, 2 * page_size, 0)) {
if (errno == ENOSYS) { if (errno == ENOSYS) {
printf("Cannot call new mlock family, skipping test\n"); printf("Cannot call new mlock family, skipping test\n");
_exit(0); _exit(KSFT_SKIP);
} }
perror("mlock2(0)"); perror("mlock2(0)");
goto unmap; goto unmap;
...@@ -412,7 +414,7 @@ static int test_mlock_onfault() ...@@ -412,7 +414,7 @@ static int test_mlock_onfault()
if (mlock2_(map, 2 * page_size, MLOCK_ONFAULT)) { if (mlock2_(map, 2 * page_size, MLOCK_ONFAULT)) {
if (errno == ENOSYS) { if (errno == ENOSYS) {
printf("Cannot call new mlock family, skipping test\n"); printf("Cannot call new mlock family, skipping test\n");
_exit(0); _exit(KSFT_SKIP);
} }
perror("mlock2(MLOCK_ONFAULT)"); perror("mlock2(MLOCK_ONFAULT)");
goto unmap; goto unmap;
...@@ -425,7 +427,7 @@ static int test_mlock_onfault() ...@@ -425,7 +427,7 @@ static int test_mlock_onfault()
if (munlock(map, 2 * page_size)) { if (munlock(map, 2 * page_size)) {
if (errno == ENOSYS) { if (errno == ENOSYS) {
printf("Cannot call new mlock family, skipping test\n"); printf("Cannot call new mlock family, skipping test\n");
_exit(0); _exit(KSFT_SKIP);
} }
perror("munlock()"); perror("munlock()");
goto unmap; goto unmap;
...@@ -457,7 +459,7 @@ static int test_lock_onfault_of_present() ...@@ -457,7 +459,7 @@ static int test_lock_onfault_of_present()
if (mlock2_(map, 2 * page_size, MLOCK_ONFAULT)) { if (mlock2_(map, 2 * page_size, MLOCK_ONFAULT)) {
if (errno == ENOSYS) { if (errno == ENOSYS) {
printf("Cannot call new mlock family, skipping test\n"); printf("Cannot call new mlock family, skipping test\n");
_exit(0); _exit(KSFT_SKIP);
} }
perror("mlock2(MLOCK_ONFAULT)"); perror("mlock2(MLOCK_ONFAULT)");
goto unmap; goto unmap;
...@@ -583,7 +585,7 @@ static int test_vma_management(bool call_mlock) ...@@ -583,7 +585,7 @@ static int test_vma_management(bool call_mlock)
if (call_mlock && mlock2_(map, 3 * page_size, MLOCK_ONFAULT)) { if (call_mlock && mlock2_(map, 3 * page_size, MLOCK_ONFAULT)) {
if (errno == ENOSYS) { if (errno == ENOSYS) {
printf("Cannot call new mlock family, skipping test\n"); printf("Cannot call new mlock family, skipping test\n");
_exit(0); _exit(KSFT_SKIP);
} }
perror("mlock(ONFAULT)\n"); perror("mlock(ONFAULT)\n");
goto out; goto out;
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
#please run as root #please run as root
# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4
mnt=./huge mnt=./huge
exitcode=0 exitcode=0
...@@ -36,7 +39,7 @@ if [ -n "$freepgs" ] && [ -n "$hpgsize_KB" ]; then ...@@ -36,7 +39,7 @@ if [ -n "$freepgs" ] && [ -n "$hpgsize_KB" ]; then
echo $(( $lackpgs + $nr_hugepgs )) > /proc/sys/vm/nr_hugepages echo $(( $lackpgs + $nr_hugepgs )) > /proc/sys/vm/nr_hugepages
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Please run this test as root" echo "Please run this test as root"
exit 1 exit $ksft_skip
fi fi
while read name size unit; do while read name size unit; do
if [ "$name" = "HugePages_Free:" ]; then if [ "$name" = "HugePages_Free:" ]; then
......
...@@ -69,6 +69,8 @@ ...@@ -69,6 +69,8 @@
#include <setjmp.h> #include <setjmp.h>
#include <stdbool.h> #include <stdbool.h>
#include "../kselftest.h"
#ifdef __NR_userfaultfd #ifdef __NR_userfaultfd
static unsigned long nr_cpus, nr_pages, nr_pages_per_cpu, page_size; static unsigned long nr_cpus, nr_pages, nr_pages_per_cpu, page_size;
...@@ -1322,7 +1324,7 @@ int main(int argc, char **argv) ...@@ -1322,7 +1324,7 @@ int main(int argc, char **argv)
int main(void) int main(void)
{ {
printf("skip: Skipping userfaultfd test (missing __NR_userfaultfd)\n"); printf("skip: Skipping userfaultfd test (missing __NR_userfaultfd)\n");
return 0; return KSFT_SKIP;
} }
#endif /* __NR_userfaultfd */ #endif /* __NR_userfaultfd */
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
TCID="zram.sh" TCID="zram.sh"
# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4
. ./zram_lib.sh . ./zram_lib.sh
run_zram () { run_zram () {
...@@ -24,5 +27,5 @@ elif [ -b /dev/zram0 ]; then ...@@ -24,5 +27,5 @@ elif [ -b /dev/zram0 ]; then
else else
echo "$TCID : No zram.ko module or /dev/zram0 device file not found" echo "$TCID : No zram.ko module or /dev/zram0 device file not found"
echo "$TCID : CONFIG_ZRAM is not set" echo "$TCID : CONFIG_ZRAM is not set"
exit 1 exit $ksft_skip
fi fi
...@@ -18,6 +18,9 @@ MODULE=0 ...@@ -18,6 +18,9 @@ MODULE=0
dev_makeswap=-1 dev_makeswap=-1
dev_mounted=-1 dev_mounted=-1
# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4
trap INT trap INT
check_prereqs() check_prereqs()
...@@ -27,7 +30,7 @@ check_prereqs() ...@@ -27,7 +30,7 @@ check_prereqs()
if [ $uid -ne 0 ]; then if [ $uid -ne 0 ]; then
echo $msg must be run as root >&2 echo $msg must be run as root >&2
exit 0 exit $ksft_skip
fi fi
} }
......
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