Commit a747acc0 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'linux-kselftest-next-6.6-rc2' of...

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

Pull kselftest fixes from Shuah Khan:

 - kselftest runner script to propagate SIGTERM to runner child
   to avoid kselftest hang

 - install symlinks required for test execution to avoid test
   failures

 - kselftest dependency checker script argument parsing

* tag 'linux-kselftest-next-6.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
  selftests: Keep symlinks, when possible
  selftests: fix dependency checker script
  kselftest/runner.sh: Propagate SIGTERM to runner child
  selftests/ftrace: Correctly enable event in instance-event.tc
parents fb52c87a 3f3f3841
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ instance_read() {

instance_set() {
        while :; do
                echo 1 > foo/events/sched/sched_switch
                echo 1 > foo/events/sched/sched_switch/enable
        done 2> /dev/null
}

+2 −1
Original line number Diff line number Diff line
@@ -36,7 +36,8 @@ tap_timeout()
{
	# Make sure tests will time out if utility is available.
	if [ -x /usr/bin/timeout ] ; then
		/usr/bin/timeout --foreground "$kselftest_timeout" $1
		/usr/bin/timeout --foreground "$kselftest_timeout" \
			/usr/bin/timeout "$kselftest_timeout" $1
	else
		$1
	fi
+65 −12
Original line number Diff line number Diff line
@@ -92,6 +92,10 @@ pass_cnt=0
# Get all TARGETS from selftests Makefile
targets=$(grep -E "^TARGETS +|^TARGETS =" Makefile | cut -d "=" -f2)

# Initially, in LDLIBS related lines, the dep checker needs
# to ignore lines containing the following strings:
filter="\$(VAR_LDLIBS)\|pkg-config\|PKG_CONFIG\|IOURING_EXTRA_LIBS"

# Single test case
if [ $# -eq 2 ]
then
@@ -100,6 +104,8 @@ then
	l1_test $test
	l2_test $test
	l3_test $test
	l4_test $test
	l5_test $test

	print_results $1 $2
	exit $?
@@ -113,7 +119,7 @@ fi
# Append space at the end of the list to append more tests.

l1_tests=$(grep -r --include=Makefile "^LDLIBS" | \
		grep -v "VAR_LDLIBS" | awk -F: '{print $1}')
		grep -v "$filter" | awk -F: '{print $1}' | uniq)

# Level 2: LDLIBS set dynamically.
#
@@ -126,7 +132,7 @@ l1_tests=$(grep -r --include=Makefile "^LDLIBS" | \
# Append space at the end of the list to append more tests.

l2_tests=$(grep -r --include=Makefile ": LDLIBS" | \
		grep -v "VAR_LDLIBS" | awk -F: '{print $1}')
		grep -v "$filter" | awk -F: '{print $1}' | uniq)

# Level 3
# memfd and others use pkg-config to find mount and fuse libs
@@ -138,11 +144,32 @@ l2_tests=$(grep -r --include=Makefile ": LDLIBS" | \
#	VAR_LDLIBS := $(shell pkg-config fuse --libs 2>/dev/null)

l3_tests=$(grep -r --include=Makefile "^VAR_LDLIBS" | \
		grep -v "pkg-config" | awk -F: '{print $1}')
		grep -v "pkg-config\|PKG_CONFIG" | awk -F: '{print $1}' | uniq)

#echo $l1_tests
#echo $l2_1_tests
#echo $l3_tests
# Level 4
# some tests may fall back to default using `|| echo -l<libname>`
# if pkg-config doesn't find the libs, instead of using VAR_LDLIBS
# as per level 3 checks.
# e.g:
# netfilter/Makefile
#	LDLIBS += $(shell $(HOSTPKG_CONFIG) --libs libmnl 2>/dev/null || echo -lmnl)
l4_tests=$(grep -r --include=Makefile "^LDLIBS" | \
		grep "pkg-config\|PKG_CONFIG" | awk -F: '{print $1}' | uniq)

# Level 5
# some tests may use IOURING_EXTRA_LIBS to add extra libs to LDLIBS,
# which in turn may be defined in a sub-Makefile
# e.g.:
# mm/Makefile
#	$(OUTPUT)/gup_longterm: LDLIBS += $(IOURING_EXTRA_LIBS)
l5_tests=$(grep -r --include=Makefile "LDLIBS +=.*\$(IOURING_EXTRA_LIBS)" | \
	awk -F: '{print $1}' | uniq)

#echo l1_tests $l1_tests
#echo l2_tests $l2_tests
#echo l3_tests $l3_tests
#echo l4_tests $l4_tests
#echo l5_tests $l5_tests

all_tests
print_results $1 $2
@@ -164,24 +191,32 @@ all_tests()
	for test in $l3_tests; do
		l3_test $test
	done

	for test in $l4_tests; do
		l4_test $test
	done

	for test in $l5_tests; do
		l5_test $test
	done
}

# Use same parsing used for l1_tests and pick libraries this time.
l1_test()
{
	test_libs=$(grep --include=Makefile "^LDLIBS" $test | \
			grep -v "VAR_LDLIBS" | \
			grep -v "$filter" | \
			sed -e 's/\:/ /' | \
			sed -e 's/+/ /' | cut -d "=" -f 2)

	check_libs $test $test_libs
}

# Use same parsing used for l2__tests and pick libraries this time.
# Use same parsing used for l2_tests and pick libraries this time.
l2_test()
{
	test_libs=$(grep --include=Makefile ": LDLIBS" $test | \
			grep -v "VAR_LDLIBS" | \
			grep -v "$filter" | \
			sed -e 's/\:/ /' | sed -e 's/+/ /' | \
			cut -d "=" -f 2)

@@ -197,6 +232,24 @@ l3_test()
	check_libs $test $test_libs
}

l4_test()
{
	test_libs=$(grep --include=Makefile "^VAR_LDLIBS\|^LDLIBS" $test | \
			grep "\(pkg-config\|PKG_CONFIG\).*|| echo " | \
			sed -e 's/.*|| echo //' | sed -e 's/)$//')

	check_libs $test $test_libs
}

l5_test()
{
	tests=$(find $(dirname "$test") -type f -name "*.mk")
	test_libs=$(grep "^IOURING_EXTRA_LIBS +\?=" $tests | \
			cut -d "=" -f 2)

	check_libs $test $test_libs
}

check_libs()
{

+2 −2
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ endef
run_tests: all
ifdef building_out_of_srctree
	@if [ "X$(TEST_PROGS)$(TEST_PROGS_EXTENDED)$(TEST_FILES)" != "X" ]; then \
		rsync -aLq $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(OUTPUT); \
		rsync -aq --copy-unsafe-links $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(OUTPUT); \
	fi
	@if [ "X$(TEST_PROGS)" != "X" ]; then \
		$(call RUN_TESTS, $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) \
@@ -120,7 +120,7 @@ endif

define INSTALL_SINGLE_RULE
	$(if $(INSTALL_LIST),@mkdir -p $(INSTALL_PATH))
	$(if $(INSTALL_LIST),rsync -aL $(INSTALL_LIST) $(INSTALL_PATH)/)
	$(if $(INSTALL_LIST),rsync -a --copy-unsafe-links $(INSTALL_LIST) $(INSTALL_PATH)/)
endef

define INSTALL_RULE