selftests: Install settings files to fix TIMEOUT failures
Subsystems (7)
PATCH 1/1 selftests: Install settings files to fix TIMEOUT failures
Commit 852c8cbf34d3 ("selftests/kselftest/runner.sh: Add 45 second timeout per test") added a 45 second timeout for tests, and also added a way for tests to customise the timeout via a settings file.
For example the ftrace tests take multiple minutes to run, so they were given longer in commit b43e78f65b1d ("tracing/selftests: Turn off timeout setting").
This works when the tests are run from the source tree. However if the tests are installed with "make -C tools/testing/selftests install", the settings files are not copied into the install directory. When the tests are then run from the install directory the longer timeouts are not applied and the tests timeout incorrectly.
So add the settings files to TEST_FILES of the appropriate Makefiles to cause the settings files to be installed using the existing install logic.
--- tools/testing/selftests/ftrace/Makefile | 2 +- tools/testing/selftests/livepatch/Makefile | 2 ++ tools/testing/selftests/net/mptcp/Makefile | 2 ++ tools/testing/selftests/rseq/Makefile | 2 ++ tools/testing/selftests/rtc/Makefile | 2 ++ 5 files changed, 9 insertions(+), 1 deletion(-)
tools/testing/selftests/ftrace/Makefile +1 -1
@@ -2,7 +2,7 @@ all: TEST_PROGS := ftracetest -TEST_FILES := test.d +TEST_FILES := test.d settings EXTRA_CLEAN := $(OUTPUT)/logs/* include ../lib.mk
tools/testing/selftests/livepatch/Makefile +2 -0
@@ -8,4 +8,6 @@ TEST_PROGS := \ test-state.sh \ test-ftrace.sh +TEST_FILES := settings + include ../lib.mk
tools/testing/selftests/net/mptcp/Makefile +2 -0
@@ -8,6 +8,8 @@ TEST_PROGS := mptcp_connect.sh TEST_GEN_FILES = mptcp_connect +TEST_FILES := settings + EXTRA_CLEAN := *.pcap include ../../lib.mk
tools/testing/selftests/rseq/Makefile +2 -0
@@ -19,6 +19,8 @@ TEST_GEN_PROGS_EXTENDED = librseq.so TEST_PROGS = run_param_test.sh +TEST_FILES := settings + include ../lib.mk $(OUTPUT)/librseq.so: rseq.c rseq.h rseq-*.h
tools/testing/selftests/rtc/Makefile +2 -0
@@ -6,4 +6,6 @@ TEST_GEN_PROGS = rtctest TEST_GEN_PROGS_EXTENDED = setdate +TEST_FILES := settings + include ../lib.mk
Signature · 1 line
2.21.1
Quoted 84 lines · Michael Ellerman
Commit
852c8cbf34d3("selftests/kselftest/runner.sh: Add 45 second timeout per test") added a 45 second timeout for tests, and also added a way for tests to customise the timeout via a settings file.For example the ftrace tests take multiple minutes to run, so they were given longer in commit
b43e78f65b1d("tracing/selftests: Turn off timeout setting").This works when the tests are run from the source tree. However if the tests are installed with "make -C
tools/testing/selftestsinstall", the settings files are not copied into the install directory. When the tests are then run from the install directory the longer timeouts are not applied and the tests timeout incorrectly.So add the settings files to
TEST_FILESof the appropriate Makefiles to cause the settings files to be installed using the existing install logic.Fixes 852c8cbf34d3 ("selftests/kselftest/runner.sh: Add 45 second timeout per test")Signed-off-by Michael Ellerman <[email protected]>--- tools/testing/selftests/ftrace/Makefile | 2 +- tools/testing/selftests/livepatch/Makefile | 2 ++ tools/testing/selftests/net/mptcp/Makefile | 2 ++ tools/testing/selftests/rseq/Makefile | 2 ++ tools/testing/selftests/rtc/Makefile | 2 ++ 5 files changed, 9 insertions(+), 1 deletion(-)tools/testing/selftests/ftrace/Makefile +1
-1@@ -2,7 +2,7 @@ all: TEST_PROGS := ftracetest -TEST_FILES := test.d +TEST_FILES := test.d settings EXTRA_CLEAN := $(OUTPUT)/logs/* include ../lib.mktools/testing/selftests/livepatch/Makefile +2
-0@@ -8,4 +8,6 @@ TEST_PROGS := \ test-state.sh \ test-ftrace.sh +TEST_FILES := settings + include ../lib.mktools/testing/selftests/net/mptcp/Makefile +2
-0@@ -8,6 +8,8 @@ TEST_PROGS := mptcp_connect.sh TEST_GEN_FILES = mptcp_connect +TEST_FILES := settings + EXTRA_CLEAN := *.pcap include ../../lib.mktools/testing/selftests/rseq/Makefile +2
-0@@ -19,6 +19,8 @@ TEST_GEN_PROGS_EXTENDED = librseq.so TEST_PROGS = run_param_test.sh +TEST_FILES := settings + include ../lib.mk $(OUTPUT)/librseq.so: rseq.c rseq.h rseq-*.htools/testing/selftests/rtc/Makefile +0
-0
tools/testing/selftests/rtc/Makefile TEST_GEN_PROGS = rtctest · line 11
Quoted 6 lines
tools/testing/selftests/rtc/Makefile +2
-0@@ -6,4 +6,6 @@ TEST_GEN_PROGS = rtctest TEST_GEN_PROGS_EXTENDED = setdate +TEST_FILES := settings + include ../lib.mk
Looks good to me,
-- Joe
Shuah Khan
maintainerQuoted 83 lines · Joe Lawrence
Quoted 77 lines · Michael Ellerman
Commit
852c8cbf34d3("selftests/kselftest/runner.sh: Add 45 second timeout per test") added a 45 second timeout for tests, and also added a way for tests to customise the timeout via a settings file.For example the ftrace tests take multiple minutes to run, so they were given longer in commit
b43e78f65b1d("tracing/selftests: Turn off timeout setting").This works when the tests are run from the source tree. However if the tests are installed with "make -C
tools/testing/selftestsinstall", the settings files are not copied into the install directory. When the tests are then run from the install directory the longer timeouts are not applied and the tests timeout incorrectly.So add the settings files to
TEST_FILESof the appropriate Makefiles to cause the settings files to be installed using the existing install logic.Fixes 852c8cbf34d3 ("selftests/kselftest/runner.sh: Add 45 second timeout per test")Signed-off-by Michael Ellerman <[email protected]>---
tools/testing/selftests/ftrace/Makefile | 2 +-tools/testing/selftests/livepatch/Makefile| 2 ++tools/testing/selftests/net/mptcp/Makefile| 2 ++ tools/testing/selftests/rseq/Makefile | 2 ++ tools/testing/selftests/rtc/Makefile | 2 ++5 files changed, 9 insertions(+), 1 deletion(-)tools/testing/selftests/ftrace/Makefile +0
-0@@ -2,7 +2,7 @@all:
TEST_PROGS:= ftracetesttools/testing/selftests/ftrace/Makefile +1
-1-TEST_FILES := test.d +TEST_FILES := test.d settings
EXTRA_CLEAN:= $(OUTPUT)/logs/*
include../lib.mktools/testing/selftests/livepatch/Makefile +0
-0@@ -8,4 +8,6 @@ TEST_PROGS := \ test-state.sh \
test-ftrace.shtools/testing/selftests/livepatch/Makefile +2
-0+TEST_FILES := settings +include
../lib.mktools/testing/selftests/net/mptcp/Makefile +0
-0@@ -8,6 +8,8 @@ TEST_PROGS := mptcp_connect.sh
TEST_GEN_FILES=mptcp_connecttools/testing/selftests/net/mptcp/Makefile +2
-0+TEST_FILES := settings +
EXTRA_CLEAN:= *.pcap
include../../lib.mktools/testing/selftests/rseq/Makefile +0
-0@@ -19,6 +19,8 @@ TEST_GEN_PROGS_EXTENDED = librseq.so
TEST_PROGS=run_param_test.shtools/testing/selftests/rseq/Makefile +2
-0+TEST_FILES := settings +include
../lib.mk
$(OUTPUT)/librseq.so:rseq.crseq.hrseq-*.htools/testing/selftests/rtc/Makefile +0
-0@@ -6,4 +6,6 @@ TEST_GEN_PROGS = rtctest
TEST_GEN_PROGS_EXTENDED= setdatetools/testing/selftests/rtc/Makefile +2
-0+TEST_FILES := settings +Quoted 2 lines
include
../lib.mkLooks good to me,
Quoted 2 lines
Acked-by Joe Lawrence <[email protected]>
Thanks for Ack. I already applied it to kselftest fixes branch.
https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/log/?h=fixes
thanks,
-- Shuah
Quoted 8 lines · Michael Ellerman
Commit
852c8cbf34d3("selftests/kselftest/runner.sh: Add 45 second timeout per test") added a 45 second timeout for tests, and also added a way for tests to customise the timeout via a settings file.For example the ftrace tests take multiple minutes to run, so they were given longer in commit
b43e78f65b1d("tracing/selftests: Turn off timeout setting").
Quoted 5 lines
This works when the tests are run from the source tree. However if the tests are installed with "make -C
tools/testing/selftestsinstall", the settings files are not copied into the install directory. When the tests are then run from the install directory the longer timeouts are not applied and the tests timeout incorrectly.
Eek, yes, nice catch.
Quoted 3 lines
So add the settings files to
TEST_FILESof the appropriate Makefiles to cause the settings files to be installed using the existing install logic.
Instead, shouldn't lib.mk "notice" the settings file and automatically include it in TEST_FILES instead of having to do this in each separate Makefile?
-Kees
Signature · 1 line
Kees Cook
Shuah Khan
maintainerQuoted 17 lines · Kees Cook
Quoted 8 lines · Michael Ellerman
Commit
852c8cbf34d3("selftests/kselftest/runner.sh: Add 45 second timeout per test") added a 45 second timeout for tests, and also added a way for tests to customise the timeout via a settings file.For example the ftrace tests take multiple minutes to run, so they were given longer in commit
b43e78f65b1d("tracing/selftests: Turn off timeout setting").Quoted 5 lines
This works when the tests are run from the source tree. However if the tests are installed with "make -C
tools/testing/selftestsinstall", the settings files are not copied into the install directory. When the tests are then run from the install directory the longer timeouts are not applied and the tests timeout incorrectly.Eek, yes, nice catch.
Quoted 8 lines
Quoted 3 lines
So add the settings files to
TEST_FILESof the appropriate Makefiles to cause the settings files to be installed using the existing install logic.Instead, shouldn't lib.mk "notice" the settings file and automatically include it in
TEST_FILESinstead of having to do this in each separateMakefile?
Let's keep it custom per test for now.
thanks,
-- Shuah
Quoted 22 lines · Shuah Khan
Quoted 21 lines · Kees Cook
Quoted 8 lines · Michael Ellerman
Commit
852c8cbf34d3("selftests/kselftest/runner.sh: Add 45 second timeout per test") added a 45 second timeout for tests, and also added a way for tests to customise the timeout via a settings file.For example the ftrace tests take multiple minutes to run, so they were given longer in commit
b43e78f65b1d("tracing/selftests: Turn off timeout setting").Quoted 5 lines
This works when the tests are run from the source tree. However if the tests are installed with "make -C
tools/testing/selftestsinstall", the settings files are not copied into the install directory. When the tests are then run from the install directory the longer timeouts are not applied and the tests timeout incorrectly.Eek, yes, nice catch.
Quoted 3 lines
So add the settings files to
TEST_FILESof the appropriate Makefiles to cause the settings files to be installed using the existing install logic.
Quoted 6 lines
Quoted 4 lines
Instead, shouldn't lib.mk "notice" the settings file and automatically include it in
TEST_FILESinstead of having to do this in each separateMakefile?Let's keep it custom per test for now.
Yeah that seems less magical.
FWIW the patch below does work, so it's a small patch, but I'm not sure it's worth the added complexity vs just listing the file in the few tests that need it.
cheers
tools/testing/selftests/lib.mk +4 -0
@@ -20,6 +20,10 @@ TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS)) TEST_GEN_PROGS_EXTENDED := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS_EXTENDED)) TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES)) +ifeq ($(wildcard settings),settings) + TEST_FILES += settings +endif + ifdef KSFT_KHDR_INSTALL top_srcdir ?= ../../../.. include $(top_srcdir)/scripts/subarch.include
Shuah Khan
maintainerQuoted 28 lines · Michael Ellerman
Quoted 27 lines · Shuah Khan
Quoted 25 lines · Kees Cook
Quoted 8 lines · Michael Ellerman
Commit
852c8cbf34d3("selftests/kselftest/runner.sh: Add 45 second timeout per test") added a 45 second timeout for tests, and also added a way for tests to customise the timeout via a settings file.For example the ftrace tests take multiple minutes to run, so they were given longer in commit
b43e78f65b1d("tracing/selftests: Turn off timeout setting").Quoted 5 lines
This works when the tests are run from the source tree. However if the tests are installed with "make -C
tools/testing/selftestsinstall", the settings files are not copied into the install directory. When the tests are then run from the install directory the longer timeouts are not applied and the tests timeout incorrectly.Eek, yes, nice catch.
Quoted 3 lines
So add the settings files to
TEST_FILESof the appropriate Makefiles to cause the settings files to be installed using the existing install logic.Instead, shouldn't lib.mk "notice" the settings file and automatically include it in
TEST_FILESinstead of having to do this in each separateMakefile?
Quoted 7 lines
Quoted 1 line
Let's keep it custom per test for now.
Yeah that seems less magical.
FWIW the patch below does work, so it's a small patch, but I'm not sure it's worth the added complexity vs just listing the file in the few tests that need it.
I am not seeing a whole lot of benefit in doing this in lib.mk Test authors have to think about which files to include in TEST_FILES and add it to Makefile anyway.
My second reason is I would like authors to think about the settings as opposed to just duplicate from another test. This timeout changes the kselftest run-time and behavior.
I am also finding making features generic has downsides to it unless we are smart about it. We have several overrides already for things that made perfect sense to make generic.
Quoted 6 lines
tools/testing/selftests/lib.mk +0
-0
tools/testing/selftests/lib.mk TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS)) · line 29
Quoted 10 lines
tools/testing/selftests/lib.mk +4
-0@@ -20,6 +20,10 @@ TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS)) TEST_GEN_PROGS_EXTENDED := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS_EXTENDED)) TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES)) +ifeq ($(wildcard settings),settings) + TEST_FILES += settings +endif + ifdef KSFT_KHDR_INSTALL top_srcdir ?= ../../../.. include $(top_srcdir)/scripts/subarch.include
Thanks for the patch though. We can consider adding it a later time, if we see value in making this generic.
thanks,
-- Shuah