Skip to content

Commit ca7e1fd

Browse files
committed
Merge tag 'linux-kselftest-5.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
Pull Kselftest fixes from Shuah Khan: "Fixes to build failures and other test bugs" * tag 'linux-kselftest-5.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: selftests: openat2: fix build error on newer glibc selftests: use LDLIBS for libraries instead of LDFLAGS selftests: fix too long argument selftests: allow detection of build failures Kernel selftests: tpm2: check for tpm support selftests/ftrace: Have pid filter test use instance flag selftests: fix spelling mistaked "chaigned" -> "chained"
2 parents 4b20576 + 9a0584f commit ca7e1fd

File tree

11 files changed

+50
-29
lines changed

11 files changed

+50
-29
lines changed

tools/testing/selftests/Makefile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ ifneq ($(SKIP_TARGETS),)
7777
override TARGETS := $(TMP)
7878
endif
7979

80+
# User can set FORCE_TARGETS to 1 to require all targets to be successfully
81+
# built; make will fail if any of the targets cannot be built. If
82+
# FORCE_TARGETS is not set (the default), make will succeed if at least one
83+
# of the targets gets built.
84+
FORCE_TARGETS ?=
85+
8086
# Clear LDFLAGS and MAKEFLAGS if called from main
8187
# Makefile to avoid test build failures when test
8288
# Makefile doesn't have explicit build rules.
@@ -151,7 +157,8 @@ all: khdr
151157
for TARGET in $(TARGETS); do \
152158
BUILD_TARGET=$$BUILD/$$TARGET; \
153159
mkdir $$BUILD_TARGET -p; \
154-
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET; \
160+
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET \
161+
$(if $(FORCE_TARGETS),|| exit); \
155162
ret=$$((ret * $$?)); \
156163
done; exit $$ret;
157164

@@ -205,7 +212,8 @@ ifdef INSTALL_PATH
205212
@ret=1; \
206213
for TARGET in $(TARGETS); do \
207214
BUILD_TARGET=$$BUILD/$$TARGET; \
208-
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install; \
215+
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install \
216+
$(if $(FORCE_TARGETS),|| exit); \
209217
ret=$$((ret * $$?)); \
210218
done; exit $$ret;
211219

tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/sh
22
# SPDX-License-Identifier: GPL-2.0
33
# description: ftrace - function pid filters
4+
# flags: instance
45

56
# Make sure that function pid matching filter works.
67
# Also test it on an instance directory
@@ -96,13 +97,6 @@ do_test() {
9697
}
9798

9899
do_test
99-
100-
mkdir instances/foo
101-
cd instances/foo
102-
do_test
103-
cd ../../
104-
rmdir instances/foo
105-
106100
do_reset
107101

108102
exit 0

tools/testing/selftests/futex/functional/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SPDX-License-Identifier: GPL-2.0
22
INCLUDES := -I../include -I../../
33
CFLAGS := $(CFLAGS) -g -O2 -Wall -D_GNU_SOURCE -pthread $(INCLUDES)
4-
LDFLAGS := $(LDFLAGS) -pthread -lrt
4+
LDLIBS := -lpthread -lrt
55

66
HEADERS := \
77
../include/futextest.h \

tools/testing/selftests/lib.mk

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,20 @@ else
8383
$(call RUN_TESTS, $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) $(TEST_PROGS))
8484
endif
8585

86+
define INSTALL_SINGLE_RULE
87+
$(if $(INSTALL_LIST),@mkdir -p $(INSTALL_PATH))
88+
$(if $(INSTALL_LIST),@echo rsync -a $(INSTALL_LIST) $(INSTALL_PATH)/)
89+
$(if $(INSTALL_LIST),@rsync -a $(INSTALL_LIST) $(INSTALL_PATH)/)
90+
endef
91+
8692
define INSTALL_RULE
87-
@if [ "X$(TEST_PROGS)$(TEST_PROGS_EXTENDED)$(TEST_FILES)" != "X" ]; then \
88-
mkdir -p ${INSTALL_PATH}; \
89-
echo "rsync -a $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(INSTALL_PATH)/"; \
90-
rsync -a $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(INSTALL_PATH)/; \
91-
fi
92-
@if [ "X$(TEST_GEN_PROGS)$(TEST_CUSTOM_PROGS)$(TEST_GEN_PROGS_EXTENDED)$(TEST_GEN_FILES)" != "X" ]; then \
93-
mkdir -p ${INSTALL_PATH}; \
94-
echo "rsync -a $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(INSTALL_PATH)/"; \
95-
rsync -a $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(INSTALL_PATH)/; \
96-
fi
93+
$(eval INSTALL_LIST = $(TEST_PROGS)) $(INSTALL_SINGLE_RULE)
94+
$(eval INSTALL_LIST = $(TEST_PROGS_EXTENDED)) $(INSTALL_SINGLE_RULE)
95+
$(eval INSTALL_LIST = $(TEST_FILES)) $(INSTALL_SINGLE_RULE)
96+
$(eval INSTALL_LIST = $(TEST_GEN_PROGS)) $(INSTALL_SINGLE_RULE)
97+
$(eval INSTALL_LIST = $(TEST_CUSTOM_PROGS)) $(INSTALL_SINGLE_RULE)
98+
$(eval INSTALL_LIST = $(TEST_GEN_PROGS_EXTENDED)) $(INSTALL_SINGLE_RULE)
99+
$(eval INSTALL_LIST = $(TEST_GEN_FILES)) $(INSTALL_SINGLE_RULE)
97100
endef
98101

99102
install: all

tools/testing/selftests/net/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ KSFT_KHDR_INSTALL := 1
2727
include ../lib.mk
2828

2929
$(OUTPUT)/reuseport_bpf_numa: LDLIBS += -lnuma
30-
$(OUTPUT)/tcp_mmap: LDFLAGS += -lpthread
31-
$(OUTPUT)/tcp_inq: LDFLAGS += -lpthread
30+
$(OUTPUT)/tcp_mmap: LDLIBS += -lpthread
31+
$(OUTPUT)/tcp_inq: LDLIBS += -lpthread

tools/testing/selftests/openat2/helpers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ int sys_renameat2(int olddirfd, const char *oldpath,
4646

4747
int touchat(int dfd, const char *path)
4848
{
49-
int fd = openat(dfd, path, O_CREAT);
49+
int fd = openat(dfd, path, O_CREAT, 0700);
5050
if (fd >= 0)
5151
close(fd);
5252
return fd;

tools/testing/selftests/openat2/resolve_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ void test_openat2_opath_tests(void)
230230
{ .name = "[in_root] garbage link to /root",
231231
.path = "cheeky/garbageself", .how.resolve = RESOLVE_IN_ROOT,
232232
.out.path = "root", .pass = true },
233-
{ .name = "[in_root] chainged garbage links to /root",
233+
{ .name = "[in_root] chained garbage links to /root",
234234
.path = "abscheeky/garbageself", .how.resolve = RESOLVE_IN_ROOT,
235235
.out.path = "root", .pass = true },
236236
{ .name = "[in_root] relative path to 'root'",

tools/testing/selftests/rtc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SPDX-License-Identifier: GPL-2.0
22
CFLAGS += -O3 -Wl,-no-as-needed -Wall
3-
LDFLAGS += -lrt -lpthread -lm
3+
LDLIBS += -lrt -lpthread -lm
44

55
TEST_GEN_PROGS = rtctest
66

tools/testing/selftests/timens/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ TEST_GEN_PROGS := timens timerfd timer clock_nanosleep procfs exec
22
TEST_GEN_PROGS_EXTENDED := gettime_perf
33

44
CFLAGS := -Wall -Werror -pthread
5-
LDFLAGS := -lrt -ldl
5+
LDLIBS := -lrt -ldl
66

77
include ../lib.mk

tools/testing/selftests/tpm2/test_smoke.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
#!/bin/bash
22
# SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
3+
self.flags = flags
34

4-
python -m unittest -v tpm2_tests.SmokeTest
5-
python -m unittest -v tpm2_tests.AsyncTest
5+
# Kselftest framework requirement - SKIP code is 4.
6+
ksft_skip=4
7+
8+
9+
if [ -f /dev/tpm0 ] ; then
10+
python -m unittest -v tpm2_tests.SmokeTest
11+
python -m unittest -v tpm2_tests.AsyncTest
12+
else
13+
exit $ksft_skip
14+
fi
615

716
CLEAR_CMD=$(which tpm2_clear)
817
if [ -n $CLEAR_CMD ]; then

0 commit comments

Comments
 (0)