This patch set:
adds ability to run and emit script for tests args to lib.mk.
lib.mk provides a way to override the default RUN_TESTS and
EMIT_TESTS, however in the cases where a test has several
executables that don't require any special args and/or handling
and some that do, overrding will be cumbersome. Add variables
RUN_TESTS_WITH_ARGS, and EMIT_TESTS_WITH_ARGS to enable a test to
run and exmit script for such special executables.
Timers test Makefile is changed to use the shared logic for running
and installing tests.
Shuah Khan (2):
selftests: add ability to run and emit script for tests args to lib.mk
selftests/timers: change to use shared logic to run and install tests
tools/testing/selftests/lib.mk | 6 ++++++
tools/testing/selftests/timers/Makefile | 20 +++++++++++---------
2 files changed, 17 insertions(+), 9 deletions(-)
--
2.1.0
Add ability to run, emit, install tests take arguments to the
shared logic in lib.mk. lib.mk provides a way to override the
default RUN_TESTS and EMIT_TESTS, however in the cases where a
test has several executables that don't require any special args
and/or handling and some that do, overrding will be cumbersome.
Add variables RUN_TESTS_WITH_ARGS, and EMIT_TESTS_WITH_ARGS to
enable a test to run and exmit script for such special executables.
Signed-off-by: Shuah Khan <redacted>
---
tools/testing/selftests/lib.mk | 6 ++++++
1 file changed, 6 insertions(+)
Change the timers Makefile to make use of shared run and install
logic in lib.mk. Destructive tests are installed. Regular tests
are emited to run_kselftest script to match the run_tests behavior.
Signed-off-by: Shuah Khan <redacted>
---
tools/testing/selftests/timers/Makefile | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
@@ -7,19 +7,21 @@ bins = posix_timers nanosleep inconsistency-check nsleep-lat raw_skew \alarmtimer-suspendchange_skewskew_consistencyclocksource-switch\leap-a-dayleapcrashset-taiset-2038+TEST_PROGS=posix_timersnanosleepnsleep-latset-timer-latmqueue-lat\+inconsistency-checkraw_skew+TEST_FILES=threadtestalarmtimer-suspendvalid-adjtimexchange_skew\+skew_consistencyclocksource-switchleap-a-dayleapcrash\+set-taiset-2038++RUN_TESTS_WITH_ARGS:=./threadtest-t30-n8||echo"selftests: threadtest [FAIL]"++EMIT_TESTS_WITH_ARGS:=echo"$(RUN_TESTS_WITH_ARGS)"+all:${bins}# these are all "safe" tests that don't modify# system time or require escalated privledges-run_tests:all-./posix_timers-./nanosleep-./nsleep-lat-./set-timer-lat-./mqueue-lat-./inconsistency-check-./raw_skew-./threadtest-t30-n8+include ../lib.mk# these tests require escalated privledges# and may modify the system time or trigger
From: John Stultz <hidden> Date: 2015-03-14 03:14:06
On Fri, Mar 13, 2015 at 3:57 PM, Shuah Khan [off-list ref] wrote:
quoted hunk
Change the timers Makefile to make use of shared run and install
logic in lib.mk. Destructive tests are installed. Regular tests
are emited to run_kselftest script to match the run_tests behavior.
Signed-off-by: Shuah Khan <redacted>
---
tools/testing/selftests/timers/Makefile | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
So my make-foo isn't very strong, but no objections from me.
My only thoughts:
1) Would it be better if threadtest can be made to have better
defaults for kselftest so you don't need that extra logic?
2) While I get that TEST_FILES is likely going to be used to copy the
destructive tests over, It feels a little like its being bundled in
with something like data files that tests might need, which seems sort
of hackish. Would TEST_PROGS_EXTENDED or something be more clear and
make more sense?
thanks
-john
From: Michael Ellerman <hidden> Date: 2015-03-15 08:42:50
On 14 March 2015 09:57:51 GMT+11:00, Shuah Khan [off-list ref] wrote:
quoted hunk
Change the timers Makefile to make use of shared run and install
logic in lib.mk. Destructive tests are installed. Regular tests
are emited to run_kselftest script to match the run_tests behavior.
Signed-off-by: Shuah Khan <redacted>
---
tools/testing/selftests/timers/Makefile | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
You shouldn't need this separate variable. As long as you override RUN_TESTS after you include lib.mk you can include the default value, eg:
override RUN_TESTS := $(RUN_TESTS) ./threadtest -t 30 -n 8 || echo "selftests: threadtest [FAIL]"
I'll test that in the morning and send a proper patch.
cheers
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2015-03-16 02:46:49
On Sun, 2015-03-15 at 19:42 +1100, Michael Ellerman wrote:
On 14 March 2015 09:57:51 GMT+11:00, Shuah Khan [off-list ref] wrote:
quoted
Change the timers Makefile to make use of shared run and install
logic in lib.mk. Destructive tests are installed. Regular tests
are emited to run_kselftest script to match the run_tests behavior.
Signed-off-by: Shuah Khan <redacted>
---
tools/testing/selftests/timers/Makefile | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
You shouldn't need this separate variable. As long as you override RUN_TESTS after you include lib.mk you can include the default value, eg:
override RUN_TESTS := $(RUN_TESTS) ./threadtest -t 30 -n 8 || echo "selftests: threadtest [FAIL]"
I'll test that in the morning and send a proper patch.
From 5ea5ea0e5adee5317978965acc4594dce648da63 Mon Sep 17 00:00:00 2001
From: Michael Ellerman <mpe-Gsx/Oe8HsFggBc27wqDAHg@public.gmane.org>
Date: Mon, 16 Mar 2015 13:38:06 +1100
Subject: [PATCH] selftests/timers: Use shared logic to run and install tests
Change the timers Makefile to make use of shared run and install logic
in lib.mk. Destructive tests are installed. Regular tests are emited to
run_kselftest script to match the run_tests behavior.
Signed-off-by: Michael Ellerman <mpe-Gsx/Oe8HsFggBc27wqDAHg@public.gmane.org>
---
tools/testing/selftests/timers/Makefile | 33 +++++++++++++++++----------------
1 file changed, 17 insertions(+), 16 deletions(-)
@@ -1,25 +1,26 @@-CC=$(CROSS_COMPILE)gccBUILD_FLAGS=-DKTESTCFLAGS+=-O3-Wl,-no-as-needed-Wall$(BUILD_FLAGS)LDFLAGS+=-lrt-lpthread-bins=posix_timersnanosleepinconsistency-checknsleep-latraw_skew\-set-timer-latthreadtestmqueue-latvalid-adjtimex\-alarmtimer-suspendchange_skewskew_consistencyclocksource-switch\-leap-a-dayleapcrashset-taiset-2038--all:${bins}# these are all "safe" tests that don't modify# system time or require escalated privledges-run_tests:all-./posix_timers-./nanosleep-./nsleep-lat-./set-timer-lat-./mqueue-lat-./inconsistency-check-./raw_skew-./threadtest-t30-n8+TEST_PROGS=posix_timersnanosleepnsleep-latset-timer-latmqueue-lat\+inconsistency-checkraw_skew++TEST_FILES=threadtestalarmtimer-suspendvalid-adjtimexchange_skew\+skew_consistencyclocksource-switchleap-a-dayleapcrash\+set-taiset-2038++bins=$(TEST_PROGS)$(TEST_FILES)++all:${bins}++include ../lib.mk++THREADTEST:=./threadtest-t30-n8||echo"selftests: threadtest [FAIL]"++override RUN_TESTS := $(RUN_TESTS)$(THREADTEST)+override EMIT_TESTS := $(EMIT_TESTS)echo "$(THREADTEST)"# these tests require escalated privledges# and may modify the system time or trigger
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2015-03-16 02:48:52
On Fri, 2015-03-13 at 20:14 -0700, John Stultz wrote:
On Fri, Mar 13, 2015 at 3:57 PM, Shuah Khan [off-list ref] wrote:
quoted
Change the timers Makefile to make use of shared run and install
logic in lib.mk. Destructive tests are installed. Regular tests
are emited to run_kselftest script to match the run_tests behavior.
Signed-off-by: Shuah Khan <redacted>
---
tools/testing/selftests/timers/Makefile | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
So my make-foo isn't very strong, but no objections from me.
My only thoughts:
1) Would it be better if threadtest can be made to have better
defaults for kselftest so you don't need that extra logic?
That would help. But with the patch I just sent I think it's no bother, it's
only a little extra logic and it's only in the timers Makefile.
2) While I get that TEST_FILES is likely going to be used to copy the
destructive tests over, It feels a little like its being bundled in
with something like data files that tests might need, which seems sort
of hackish. Would TEST_PROGS_EXTENDED or something be more clear and
make more sense?
That doesn't really bother me. You're right that TEST_FILES is originally
intended for data files etc. but I don't think it's a big hack to use it for
other tests that shouldn't be run by default. Still if it bothers you I'm happy
to add a separate variable for it, they are cheap :)
cheers
On Fri, Mar 13, 2015 at 3:57 PM, Shuah Khan [off-list ref] wrote:
quoted
Change the timers Makefile to make use of shared run and install
logic in lib.mk. Destructive tests are installed. Regular tests
are emited to run_kselftest script to match the run_tests behavior.
Signed-off-by: Shuah Khan <redacted>
---
tools/testing/selftests/timers/Makefile | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
So my make-foo isn't very strong, but no objections from me.
My only thoughts:
1) Would it be better if threadtest can be made to have better
defaults for kselftest so you don't need that extra logic?
Yes. If you can change the threadset to run with -t 30 -n 8
in default case, that would make the logic simpler. Can you
send me a patch to do this?
2) While I get that TEST_FILES is likely going to be used to copy the
destructive tests over, It feels a little like its being bundled in
with something like data files that tests might need, which seems sort
of hackish. Would TEST_PROGS_EXTENDED or something be more clear and
make more sense?
I agree with you on this. TEST_FILES usage is an overload.
-- Shuah
--
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shuahkh@osg.samsung.com | (970) 217-8978
On Fri, 2015-03-13 at 20:14 -0700, John Stultz wrote:
quoted
On Fri, Mar 13, 2015 at 3:57 PM, Shuah Khan [off-list ref] wrote:
quoted
Change the timers Makefile to make use of shared run and install
logic in lib.mk. Destructive tests are installed. Regular tests
are emited to run_kselftest script to match the run_tests behavior.
Signed-off-by: Shuah Khan <redacted>
---
tools/testing/selftests/timers/Makefile | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
So my make-foo isn't very strong, but no objections from me.
My only thoughts:
1) Would it be better if threadtest can be made to have better
defaults for kselftest so you don't need that extra logic?
That would help. But with the patch I just sent I think it's no bother, it's
only a little extra logic and it's only in the timers Makefile.
Let's go with a threadtest patch with better defaults. It will emit
scripts logic as well. Awesome. I just saw John's new patch in my
Inbox. Thanks.
quoted
2) While I get that TEST_FILES is likely going to be used to copy the
destructive tests over, It feels a little like its being bundled in
with something like data files that tests might need, which seems sort
of hackish. Would TEST_PROGS_EXTENDED or something be more clear and
make more sense?
That doesn't really bother me. You're right that TEST_FILES is originally
intended for data files etc. but I don't think it's a big hack to use it for
other tests that shouldn't be run by default. Still if it bothers you I'm happy
to add a separate variable for it, they are cheap :)
Michael,
Could you please make the change from TEST_FILES to TEST_PROGS_EXTENDED
which is definitely better than overloading TEST_FILES?
I think this would probably only change Add Install target patch. You
can send me patch v5 with that change and I will override the next with
your new one. Thanks for doing this.
thanks,
-- Shuah
--
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org | (970) 217-8978
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2015-03-19 00:21:52
On Wed, 2015-03-18 at 09:55 -0600, Shuah Khan wrote:
On 03/15/2015 08:48 PM, Michael Ellerman wrote:
quoted
On Fri, 2015-03-13 at 20:14 -0700, John Stultz wrote:
quoted
My only thoughts:
1) Would it be better if threadtest can be made to have better
defaults for kselftest so you don't need that extra logic?
That would help. But with the patch I just sent I think it's no bother, it's
only a little extra logic and it's only in the timers Makefile.
Let's go with a threadtest patch with better defaults. It will emit
scripts logic as well. Awesome. I just saw John's new patch in my
Inbox. Thanks.
Fine by me.
quoted
quoted
2) While I get that TEST_FILES is likely going to be used to copy the
destructive tests over, It feels a little like its being bundled in
with something like data files that tests might need, which seems sort
of hackish. Would TEST_PROGS_EXTENDED or something be more clear and
make more sense?
That doesn't really bother me. You're right that TEST_FILES is originally
intended for data files etc. but I don't think it's a big hack to use it for
other tests that shouldn't be run by default. Still if it bothers you I'm happy
to add a separate variable for it, they are cheap :)
Could you please make the change from TEST_FILES to TEST_PROGS_EXTENDED
which is definitely better than overloading TEST_FILES?
I don't see the point, but I don't care that much.
I think this would probably only change Add Install target patch. You
can send me patch v5 with that change and I will override the next with
your new one. Thanks for doing this.
You shouldn't rebase your next branch, people may have already merged it (like
me). You should apply it as an additional patch on top.
Patch sent.
cheers