selftest: Add futex functional tests
Hi Shuah,
This series begins the process of migrating my futextest tests into kselftest. I've started with only the functional tests, as the performance and stress may not be appropriate for kselftest as they stand.
I cleaned up various complaints from checkpatch, but I ignored others that would require significant rework of the testcases, such as not using volatile and not creating new typedefs.
The patches will follow, but I'm providing a pull request for your convenience as well.
The following changes since commit 0b63accf87225b5eb7e52814c374cf02d733d4bb:
tools, update rtctest.c to verify passage of time (2015-03-24 22:02:59 -0600)
are available in the git repository at:
git://git.infradead.org/users/dvhart/linux.git futextest
Darren Hart (5):
selftests: Add futex functional tests selftest/futex: Update Makefile to use lib.mk selftest/futex: Increment ksft pass and fail counters
selftest: Add futex tests to the top-level Makefile
kselftest: Add exit code defines
tools/testing/selftests/Makefile | 1 + tools/testing/selftests/futex/Makefile | 29 ++ tools/testing/selftests/futex/README | 62 ++++ tools/testing/selftests/futex/functional/Makefile | 25 ++ .../selftests/futex/functional/futex_requeue_pi.c | 402 +++++++++++++++++++++ .../functional/futex_requeue_pi_mismatched_ops.c | 136 +++++++ .../functional/futex_requeue_pi_signal_restart.c | 220 +++++++++++ .../functional/futex_wait_private_mapped_file.c | 126 +++++++ .../futex/functional/futex_wait_timeout.c | 85 +++++ .../functional/futex_wait_uninitialized_heap.c | 124 +++++++ .../futex/functional/futex_wait_wouldblock.c | 79 ++++ tools/testing/selftests/futex/functional/run.sh | 79 ++++ tools/testing/selftests/futex/include/atomic.h | 83 +++++ tools/testing/selftests/futex/include/futextest.h | 266 ++++++++++++++ tools/testing/selftests/futex/include/logging.h | 150 ++++++++ tools/testing/selftests/futex/run.sh | 33 ++ tools/testing/selftests/kselftest.h | 17 +- 17 files changed, 1912 insertions(+), 5 deletions(-) create mode 100644 tools/testing/selftests/futex/Makefile create mode 100644 tools/testing/selftests/futex/README create mode 100644 tools/testing/selftests/futex/functional/Makefile create mode 100644 tools/testing/selftests/futex/functional/futex_requeue_pi.c create mode 100644 tools/testing/selftests/futex/functional/futex_requeue_pi_mismatched_ops.c create mode 100644 tools/testing/selftests/futex/functional/futex_requeue_pi_signal_restart.c create mode 100644 tools/testing/selftests/futex/functional/futex_wait_private_mapped_file.c create mode 100644 tools/testing/selftests/futex/functional/futex_wait_timeout.c create mode 100644 tools/testing/selftests/futex/functional/futex_wait_uninitialized_heap.c create mode 100644 tools/testing/selftests/futex/functional/futex_wait_wouldblock.c create mode 100755 tools/testing/selftests/futex/functional/run.sh create mode 100644 tools/testing/selftests/futex/include/atomic.h create mode 100644 tools/testing/selftests/futex/include/futextest.h create mode 100644 tools/testing/selftests/futex/include/logging.h create mode 100755 tools/testing/selftests/futex/run.sh
Signature · 1 line
2.1.4
PATCH 1/5 selftests: Add futex functional tests
The futextest testsuite [1] provides functional, stress, and performance tests for the various futex op codes. Those tests will be of more use to futex developers if they are included with the kernel source.
Copy the core infrastructure and the functional tests into selftests. Remove reference to the performance and stress tests from the contributed sources.
Remove the Free Software Foundation address paragraph from all contributed files to avoid checkpatch complaints.
A future effort will explore moving the performance and stress tests into the kernel.
1. http://git.kernel.org/cgit/linux/kernel/git/dvhart/futextest.git
--- tools/testing/selftests/futex/Makefile | 8 + tools/testing/selftests/futex/README | 62 ++++ tools/testing/selftests/futex/functional/Makefile | 21 ++ .../selftests/futex/functional/futex_requeue_pi.c | 402 +++++++++++++++++++++ .../functional/futex_requeue_pi_mismatched_ops.c | 136 +++++++ .../functional/futex_requeue_pi_signal_restart.c | 220 +++++++++++ .../functional/futex_wait_private_mapped_file.c | 126 +++++++ .../futex/functional/futex_wait_timeout.c | 85 +++++ .../functional/futex_wait_uninitialized_heap.c | 124 +++++++ .../futex/functional/futex_wait_wouldblock.c | 79 ++++ tools/testing/selftests/futex/functional/run.sh | 79 ++++ tools/testing/selftests/futex/include/atomic.h | 83 +++++ tools/testing/selftests/futex/include/futextest.h | 266 ++++++++++++++ tools/testing/selftests/futex/include/logging.h | 147 ++++++++ tools/testing/selftests/futex/run.sh | 33 ++ 15 files changed, 1871 insertions(+) create mode 100644 tools/testing/selftests/futex/Makefile create mode 100644 tools/testing/selftests/futex/README create mode 100644 tools/testing/selftests/futex/functional/Makefile create mode 100644 tools/testing/selftests/futex/functional/futex_requeue_pi.c create mode 100644 tools/testing/selftests/futex/functional/futex_requeue_pi_mismatched_ops.c create mode 100644 tools/testing/selftests/futex/functional/futex_requeue_pi_signal_restart.c create mode 100644 tools/testing/selftests/futex/functional/futex_wait_private_mapped_file.c create mode 100644 tools/testing/selftests/futex/functional/futex_wait_timeout.c create mode 100644 tools/testing/selftests/futex/functional/futex_wait_uninitialized_heap.c create mode 100644 tools/testing/selftests/futex/functional/futex_wait_wouldblock.c create mode 100755 tools/testing/selftests/futex/functional/run.sh create mode 100644 tools/testing/selftests/futex/include/atomic.h create mode 100644 tools/testing/selftests/futex/include/futextest.h create mode 100644 tools/testing/selftests/futex/include/logging.h create mode 100755 tools/testing/selftests/futex/run.sh
tools/testing/selftests/futex/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +SUBDIRS := functional + +.PHONY: all clean +all: + for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done + +clean: + for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
tools/testing/selftests/futex/README new file +62 -0
62 lines not on this page · raw message
tools/testing/selftests/futex/functional/Makefile new file +21 -0
@@ -0,0 +1,21 @@ +INCLUDES := -I../include +CFLAGS := $(CFLAGS) -g -O2 -Wall -D_GNU_SOURCE $(INCLUDES) +LDFLAGS := $(LDFLAGS) -lpthread -lrt + +HEADERS := ../include/futextest.h +TARGETS := \ + futex_wait_timeout \ + futex_wait_wouldblock \ + futex_requeue_pi \ + futex_requeue_pi_signal_restart \ + futex_requeue_pi_mismatched_ops \ + futex_wait_uninitialized_heap \ + futex_wait_private_mapped_file + +.PHONY: all clean +all: $(TARGETS) + +$(TARGETS): $(HEADERS) + +clean: + rm -f $(TARGETS)
tools/testing/selftests/futex/functional/futex_requeue_pi.c new file +402 -0
402 lines not on this page · raw message
tools/testing/selftests/futex/functional/futex_requeue_pi_mismatched_ops.c new file +136 -0
136 lines not on this page · raw message
tools/testing/selftests/futex/functional/futex_requeue_pi_signal_restart.c new file +220 -0
220 lines not on this page · raw message
tools/testing/selftests/futex/functional/futex_wait_private_mapped_file.c new file +126 -0
126 lines not on this page · raw message
tools/testing/selftests/futex/functional/futex_wait_timeout.c new file +85 -0
85 lines not on this page · raw message
tools/testing/selftests/futex/functional/futex_wait_uninitialized_heap.c new file +124 -0
124 lines not on this page · raw message
tools/testing/selftests/futex/functional/futex_wait_wouldblock.c new file +79 -0
79 lines not on this page · raw message
tools/testing/selftests/futex/functional/run.sh new file +79 -0
79 lines not on this page · raw message
tools/testing/selftests/futex/include/atomic.h new file +83 -0
83 lines not on this page · raw message
tools/testing/selftests/futex/include/futextest.h new file +266 -0
266 lines not on this page · raw message
tools/testing/selftests/futex/include/logging.h new file +147 -0
147 lines not on this page · raw message
tools/testing/selftests/futex/run.sh new file +33 -0
@@ -0,0 +1,33 @@ +#!/bin/sh + +############################################################################### +# +# Copyright © International Business Machines Corp., 2009 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# DESCRIPTION +# Run all tests under the functional, performance, and stress directories. +# Format and summarize the results. +# +# AUTHOR +# Darren Hart <dvhart-VuQAYsv1563Yd54FQh9/[email protected]> +# +# HISTORY +# 2009-Nov-9: Initial version by Darren Hart <[email protected]> +# +############################################################################### + +# Test for a color capable shell and pass the result to the subdir scripts +USE_COLOR=0 +tput setf 7 +if [ $? -eq 0 ]; then + USE_COLOR=1 + tput sgr0 +fi +export USE_COLOR + +(cd functional; ./run.sh)
Signature · 1 line
2.1.4
PATCH 2/5 selftest/futex: Update Makefile to use lib.mk
Adapt the futextest Makefiles to use lib.mk macros for RUN_TESTS and EMIT_TESTS. For now, we reuse the run.sh mechanism provided by futextest. This doesn't provide the standard selftests: [PASS|FAIL] format, but the tests provide very similar output already.
This results in the run_kselftest.sh script for futexes including a single line: ./run.sh
--- tools/testing/selftests/futex/Makefile | 21 +++++++++++++++++++++ tools/testing/selftests/futex/functional/Makefile | 4 ++++ 2 files changed, 25 insertions(+)
tools/testing/selftests/futex/Makefile +21 -0
@@ -1,8 +1,29 @@ SUBDIRS := functional +TEST_PROGS := run.sh + .PHONY: all clean all: for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done +include ../lib.mk + +override define RUN_TESTS + ./run.sh +endef + +override define INSTALL_RULE + mkdir -p $(INSTALL_PATH) + install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) + + @for SUBDIR in $(SUBDIRS); do \ + $(MAKE) -C $$SUBDIR INSTALL_PATH=$(INSTALL_PATH)/$$SUBDIR install; \ + done; +endef + +override define EMIT_TESTS + echo "./run.sh" +endef + clean: for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
tools/testing/selftests/futex/functional/Makefile +4 -0
@@ -12,10 +12,14 @@ TARGETS := \ futex_wait_uninitialized_heap \ futex_wait_private_mapped_file +TEST_PROGS := $(TARGETS) run.sh + .PHONY: all clean all: $(TARGETS) $(TARGETS): $(HEADERS) +include ../../lib.mk + clean: rm -f $(TARGETS)
Signature · 1 line
2.1.4
Re: [PATCH 2/5] selftest/futex: Update Makefile to use lib.mk
Quoted 26 lines · Darren Hart
Adapt the futextest Makefiles to use lib.mk macros for
RUN_TESTSandEMIT_TESTS. For now, we reuse therun.shmechanism provided by futextest. This doesn't provide the standard selftests: [PASS|FAIL] format, but the tests provide very similar output already.This results in the
run_kselftest.shscript for futexes including a single line: ./run.shCc Shuah Khan <[email protected]>Cc Ingo Molnar <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Davidlohr Bueso <[email protected]>Cc KOSAKI Motohiro <[email protected]>--- tools/testing/selftests/futex/Makefile | 21 +++++++++++++++++++++ tools/testing/selftests/futex/functional/Makefile | 4 ++++ 2 files changed, 25 insertions(+)tools/testing/selftests/futex/Makefile +0
-0
tools/testing/selftests/futex/Makefile line 5
Quoted 5 lines
tools/testing/selftests/futex/Makefile +2
-0@@ -1,8 +1,29 @@ SUBDIRS := functional +TEST_PROGS := run.sh + .PHONY: all clean
lib.mk defines all & clean as PHONY for you.
tools/testing/selftests/futex/Makefile line 13
Quoted 8 lines
tools/testing/selftests/futex/Makefile +5
-0all: for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done +include ../lib.mk + +override define RUN_TESTS + ./run.sh +endef
Do you need to do this override? The standard logic should work AFAICS, or do you not want the echo logic?
tools/testing/selftests/futex/Makefile line 26
Quoted 12 lines
tools/testing/selftests/futex/Makefile +12
-0+override define INSTALL_RULE + mkdir -p $(INSTALL_PATH) + install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) + + @for SUBDIR in $(SUBDIRS); do \ + $(MAKE) -C $$SUBDIR INSTALL_PATH=$(INSTALL_PATH)/$$SUBDIR install; \ + done; +endef + +override define EMIT_TESTS + echo "./run.sh" +endef
Ditto.
cheers
Re: [PATCH 2/5] selftest/futex: Update Makefile to use lib.mk
Quoted 31 lines · Michael Ellerman
Quoted 30 lines · Darren Hart
Adapt the futextest Makefiles to use lib.mk macros for
RUN_TESTSandEMIT_TESTS. For now, we reuse therun.shmechanism provided by futextest. This doesn't provide the standard selftests: [PASS|FAIL] format, but the tests provide very similar output already.This results in the
run_kselftest.shscript for futexes including a single line: ./run.shCc Shuah Khan <[email protected]>Cc Ingo Molnar <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Davidlohr Bueso <[email protected]>Cc KOSAKI Motohiro <[email protected]>Signed-off-by Darren Hart <[email protected]>--- tools/testing/selftests/futex/Makefile | 21 +++++++++++++++++++++ tools/testing/selftests/futex/functional/Makefile | 4 ++++ 2 files changed, 25 insertions(+)tools/testing/selftests/futex/Makefile +0
-0@@ -1,8 +1,29 @@ SUBDIRS := functional
Quoted 5 lines
tools/testing/selftests/futex/Makefile line 5
Quoted 3 lines
tools/testing/selftests/futex/Makefile +2
-0+TEST_PROGS := run.sh + .PHONY: all cleanlib.mk defines all & clean as PHONY for you.
OK, I can remove this (it was just part of the originals). Shall I resent the whole series or just a follow-on patch?
Quoted 4 lines
Quoted 4 lines
tools/testing/selftests/futex/Makefile +0
-0all: for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
Quoted 9 lines
tools/testing/selftests/futex/Makefile line 13
Quoted 5 lines
tools/testing/selftests/futex/Makefile +5
-0+include ../lib.mk + +override define RUN_TESTS + ./run.sh +endefDo you need to do this override? The standard logic should work AFAICS, or do
you not want the echo logic?
The standard logic wants to run each individual test and uses the echo logic. My tests have their own pass/fail reporting mechanism. As I run many options on the same tests and have pretty-printing logic, I prefer to keep that in a run script rather than in a makefile.
I don't care for the echo logic as a mechanism, I think the reporting should be part of the test. It also doesn't scale past pass/fail - like xpass and xfail, for example.
Quoted 23 lines
Quoted 4 lines
tools/testing/selftests/futex/Makefile +3
-0+override define INSTALL_RULE + mkdir -p $(INSTALL_PATH) + install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED)tools/testing/selftests/futex/Makefile line 26
Quoted 10 lines
tools/testing/selftests/futex/Makefile +9
-0$(TEST_FILES) + + @for SUBDIR in $(SUBDIRS); do \ + $(MAKE) -C $$SUBDIR INSTALL_PATH=$(INSTALL_PATH)/$$SUBDIR install; \ + done; +endef + +override define EMIT_TESTS + echo "./run.sh" +endefDitto.
cheers
Signature · 2 lines
Darren Hart Intel Open Source Technology Center
Re: [PATCH 2/5] selftest/futex: Update Makefile to use lib.mk
Quoted 19 lines · Darren Hart
Quoted 17 lines · Michael Ellerman
Quoted 16 lines · Darren Hart
Adapt the futextest Makefiles to use lib.mk macros for
RUN_TESTSandEMIT_TESTS. For now, we reuse therun.shmechanism provided by futextest. This doesn't provide the standard selftests: [PASS|FAIL] format, but the tests provide very similar output already.This results in the
run_kselftest.shscript for futexes including a single line: ./run.shtools/testing/selftests/futex/Makefile +0
-0@@ -1,8 +1,29 @@ SUBDIRS := functional
Quoted 8 lines
Quoted 5 lines
tools/testing/selftests/futex/Makefile line 5
Quoted 3 lines
tools/testing/selftests/futex/Makefile +2
-0+TEST_PROGS := run.sh + .PHONY: all cleanlib.mk defines all & clean as PHONY for you.
OK, I can remove this (it was just part of the originals). Shall I resent the whole series or just a follow-on patch?
Up to Shuah. It's a minor nit, so probably a follow-up patch is fine.
Quoted 13 lines
Quoted 12 lines
tools/testing/selftests/futex/Makefile line 13
Quoted 8 lines
tools/testing/selftests/futex/Makefile +5
-0all: for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done +include ../lib.mk + +override define RUN_TESTS + ./run.sh +endefDo you need to do this override? The standard logic should work AFAICS, or do
you not want the echo logic?
Quoted 8 lines
The standard logic wants to run each individual test and uses the echo logic. My tests have their own pass/fail reporting mechanism. As I run many options on the same tests and have pretty-printing logic, I prefer to keep that in a run script rather than in a makefile.
I don't care for the echo logic as a mechanism, I think the reporting should be part of the test. It also doesn't scale past pass/fail - like xpass and xfail, for example.
Fare enuf.
cheers
PATCH 3/5 selftest/futex: Increment ksft pass and fail counters
In reply to Darren HartAdd kselftest.h to logging.h and increment the pass and fail counters as part of the print_result routine which is called by all futex tests.
--- tools/testing/selftests/futex/functional/Makefile | 2 +- tools/testing/selftests/futex/include/logging.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)
tools/testing/selftests/futex/functional/Makefile +1 -1
@@ -1,4 +1,4 @@ -INCLUDES := -I../include +INCLUDES := -I../include -I../../ CFLAGS := $(CFLAGS) -g -O2 -Wall -D_GNU_SOURCE $(INCLUDES) LDFLAGS := $(LDFLAGS) -lpthread -lrt
tools/testing/selftests/futex/include/logging.h +3 -0
@@ -24,6 +24,7 @@#include <string.h> #include <unistd.h> #include <linux/futex.h> +#include "kselftest.h" /* * Define PASS, ERROR, and FAIL strings with and without color escape
@@ -108,12 +109,14 @@ void print_result(int ret)switch (ret) {case RET_PASS : +ksft_inc_pass_cnt (); result =PASS ;break ;case RET_ERROR : result =ERROR ;break ;case RET_FAIL : +ksft_inc_fail_cnt (); result =FAIL ;break ; }
Signature · 1 line
2.1.4
PATCH 4/5 selftest: Add futex tests to the top-level Makefile
In reply to Darren HartEnable futex tests to be built and run with the make kselftest and associated targets.
Most of the tests require escalated privileges. These return ERROR, and run.sh continues.
--- tools/testing/selftests/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/Makefile +1 -0
@@ -4,6 +4,7 @@ TARGETS += efivarfs TARGETS += exec TARGETS += firmware TARGETS += ftrace +TARGETS += futex TARGETS += kcmp TARGETS += memfd TARGETS += memory-hotplug
Signature · 1 line
2.1.4
PATCH 5/5 kselftest: Add exit code defines
In reply to Darren HartDefine the exit codes with KSFT_PASS and similar so tests can use these directly if they choose. Also enable harnesses and other tooling to use the defines instead of hardcoding the return codes.
--- tools/testing/selftests/kselftest.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
tools/testing/selftests/kselftest.h +12 -5
@@ -13,6 +13,13 @@#include <stdlib.h> #include <unistd.h> +/* define kselftest exit codes */ +#define KSFT_PASS 0 +#define KSFT_FAIL 1 +#define KSFT_XFAIL 2 +#define KSFT_XPASS 3 +#define KSFT_SKIP 4 +/* counters */ struct ksft_count {unsigned int ksft_pass;
@@ -40,23 +47,23 @@ static inline void ksft_print_cnts(void)static inline int ksft_exit_pass (void ) { -exit (0 ); +exit (KSFT_PASS ); }static inline int ksft_exit_fail (void ) { -exit (1 ); +exit (KSFT_FAIL ); }static inline int ksft_exit_xfail (void ) { -exit (2 ); +exit (KSFT_XFAIL ); }static inline int ksft_exit_xpass (void ) { -exit (3 ); +exit (KSFT_XPASS ); }static inline int ksft_exit_skip (void ) { -exit (4 ); +exit (KSFT_SKIP ); }#endif /* __KSELFTEST_H */
Signature · 1 line
2.1.4
Re: [PATCH 5/5] kselftest: Add exit code defines
Quoted 3 lines · Darren Hart
Define the exit codes with
KSFT_PASSand similar so tests can use these directly if they choose. Also enable harnesses and other tooling to use the defines instead of hardcoding the return codes.
+1
Quoted 19 lines
tools/testing/selftests/kselftest.h +7
-0@@ -13,6 +13,13 @@#include <stdlib.h> #include <unistd.h> +/* define kselftest exit codes */ +#define KSFT_PASS 0 +#define KSFT_FAIL 1 +#define KSFT_XFAIL 2 +#define KSFT_XPASS 3 +#define KSFT_SKIP 4 +/* counters */ struct ksft_count {unsigned int ksft_pass;
tools/testing/selftests/kselftest.h static inline void ksft_print_cnts(void) · line 51
Quoted 6 lines
tools/testing/selftests/kselftest.h +1
-1@@ -40,23 +47,23 @@ static inline void ksft_print_cnts(void)static inline int ksft_exit_pass (void ) { -exit (0 ); +exit (KSFT_PASS ); }
Am I the only person who's bothered by the fact that these don't actually return int?
cheers
Re: [PATCH 5/5] kselftest: Add exit code defines
Quoted 27 lines · Michael Ellerman
Quoted 3 lines · Darren Hart
Define the exit codes with
KSFT_PASSand similar so tests can use these directly if they choose. Also enable harnesses and other tooling to use the defines instead of hardcoding the return codes.+1
Quoted 20 lines
tools/testing/selftests/kselftest.h +7
-0@@ -13,6 +13,13 @@#include <stdlib.h> #include <unistd.h> +/* define kselftest exit codes */ +#define KSFT_PASS 0 +#define KSFT_FAIL 1 +#define KSFT_XFAIL 2 +#define KSFT_XPASS 3 +#define KSFT_SKIP 4 +/* counters */ struct ksft_count {unsigned int ksft_pass;@@ -40,23 +47,23 @@ static inline void ksft_print_cnts(void)
Quoted 8 lines
tools/testing/selftests/kselftest.h static inline void ksft_print_cnts(void) · line 51
Quoted 5 lines
tools/testing/selftests/kselftest.h +1
-1static inline int ksft_exit_pass (void ) { -exit (0 ); +exit (KSFT_PASS ); }Am I the only person who's bothered by the fact that these don't actually return int?
That bothered me to, but I couldn't be bothered to go read the manuals apparently to come up with a compelling argument :-)
I also think the ksft_exit* routines should go ahead and increment the counters (at least optionally) so we don't have to call two functions.
Signature · 2 lines
Darren Hart Intel Open Source Technology Center
Re: [PATCH 5/5] kselftest: Add exit code defines
Quoted 38 lines · Darren Hart
Quoted 27 lines · Michael Ellerman
Quoted 3 lines · Darren Hart
Define the exit codes with
KSFT_PASSand similar so tests can use these directly if they choose. Also enable harnesses and other tooling to use the defines instead of hardcoding the return codes.+1
Quoted 20 lines
tools/testing/selftests/kselftest.h +7
-0@@ -13,6 +13,13 @@#include <stdlib.h> #include <unistd.h> +/* define kselftest exit codes */ +#define KSFT_PASS 0 +#define KSFT_FAIL 1 +#define KSFT_XFAIL 2 +#define KSFT_XPASS 3 +#define KSFT_SKIP 4 +/* counters */ struct ksft_count {unsigned int ksft_pass;@@ -40,23 +47,23 @@ static inline void ksft_print_cnts(void)Quoted 8 lines
tools/testing/selftests/kselftest.h static inline void ksft_print_cnts(void) · line 51
Quoted 5 lines
tools/testing/selftests/kselftest.h +1
-1static inline int ksft_exit_pass (void ) { -exit (0 ); +exit (KSFT_PASS ); }Am I the only person who's bothered by the fact that these don't actually return int?
Quoted 2 lines
That bothered me to, but I couldn't be bothered to go read the manuals apparently to come up with a compelling argument :-)
Yeah, obviously the compiler accepts it, but it's still a bit weird.
Quoted 2 lines
I also think the ksft_exit* routines should go ahead and increment the counters (at least optionally) so we don't have to call two functions.
But the ksft_exit_*() routines exit, so there's no point incrementing the counters. Unless they *also* print the counters before exiting?
To be honest I think we need to decide if the selftests are going to speak TAP or xUnit or whatever, and then switch to that. In their current form these helpers don't help much.
cheers
Re: [PATCH 5/5] kselftest: Add exit code defines
Quoted 51 lines · Michael Ellerman
Quoted 39 lines · Darren Hart
Quoted 2 lines · Michael Ellerman
Quoted 1 line · Darren Hart
Define the exit codes with
KSFT_PASSand similar so tests can usethese
Quoted 1 line
Quoted 1 line
directly if they choose. Also enable harnesses and other tooling to
use
Quoted 5 lines
Quoted 1 line
the defines instead of hardcoding the return codes.
+1
Review
Quoted 1 line
(quoted diff) +0
-0
b/tools/testing/selftests/kselftest.hQuoted 19 lines
Quoted 19 lines
index 572c888..ef1c80d 100644
tools/testing/selftests/kselftest.h +7
-0@@ -13,6 +13,13 @@#include <stdlib.h> #include <unistd.h> +/* define kselftest exit codes */ +#define KSFT_PASS 0 +#define KSFT_FAIL 1 +#define KSFT_XFAIL 2 +#define KSFT_XPASS 3 +#define KSFT_SKIP 4 +/* counters */ struct ksft_count {unsigned int ksft_pass;@@ -40,23 +47,23 @@ static inline void ksft_print_cnts(void)Quoted 7 lines
tools/testing/selftests/kselftest.h static inline void ksft_print_cnts(void) · line 51
Quoted 5 lines
tools/testing/selftests/kselftest.h +1
-1static inline int ksft_exit_pass (void ) { -exit (0 ); +exit (KSFT_PASS ); }Am I the only person who's bothered by the fact that these don't
Quoted 5 lines
actually
Quoted 1 line
return int?
That bothered me to, but I couldn't be bothered to go read the manuals apparently to come up with a compelling argument :-)
Yeah, obviously the compiler accepts it, but it's still a bit weird.
Quoted 2 lines
I also think the ksft_exit* routines should go ahead and increment the counters (at least optionally) so we don't have to call two functions.
Quoted 7 lines
But the ksft_exit_*() routines exit, so there's no point incrementing the counters. Unless they *also* print the counters before exiting?
To be honest I think we need to decide if the selftests are going to speak TAP
or xUnit or whatever, and then switch to that. In their current form these helpers don't help much.
Fair point. This isn't a space I'm well versed in, but some standard means of doing this would be welcome.
Signature · 2 lines
Darren Hart Intel Open Source Technology Center
Peter Zijlstra
reviewerRe: [PATCH 5/5] kselftest: Add exit code defines
Quoted 2 lines · Darren Hart
Fair point. This isn't a space I'm well versed in, but some standard means of doing this would be welcome.
I'm reading standard memes, time to get away from the keyboard for a little while I suppose :-)
Re: [PATCH 1/5] selftests: Add futex functional tests
In reply to Darren HartQuoted 17 lines · Darren Hart
The futextest testsuite [1] provides functional, stress, and performance tests for the various futex op codes. Those tests will be of more use to futex developers if they are included with the kernel source.
Copy the core infrastructure and the functional tests into selftests. Remove reference to the performance and stress tests from the contributed sources.
Remove the Free Software Foundation address paragraph from all contributed files to avoid checkpatch complaints.
A future effort will explore moving the performance and stress tests into the kernel.
1. http://git.kernel.org/cgit/linux/kernel/git/dvhart/futextest.git
Quoted 8 lines
Cc Shuah Khan <[email protected]>Cc Ingo Molnar <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Davidlohr Bueso <[email protected]>Cc KOSAKI Motohiro <[email protected]>
Sorry it took so long. I am just about to apply these to linux-kselftest next and ran into checkpatch errors on this patch.
Could you clean them and resend this patch. Other patches in this series are good.
thanks,
-- Shuah
Signature · 5 lines
Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) [email protected] | (970) 217-8978
Re: [PATCH 1/5] selftests: Add futex functional tests
Quoted 27 lines · Shuah Khan
Quoted 17 lines · Darren Hart
The futextest testsuite [1] provides functional, stress, and performance tests for the various futex op codes. Those tests will be of more use to futex developers if they are included with the kernel source.
Copy the core infrastructure and the functional tests into selftests. Remove reference to the performance and stress tests from the contributed sources.
Remove the Free Software Foundation address paragraph from all contributed files to avoid checkpatch complaints.
A future effort will explore moving the performance and stress tests into the kernel.
1. http://git.kernel.org/cgit/linux/kernel/git/dvhart/futextest.git
Quoted 8 lines
Cc Shuah Khan <[email protected]>Cc Ingo Molnar <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Davidlohr Bueso <[email protected]>Cc KOSAKI Motohiro <[email protected]>
Quoted 2 lines
Sorry it took so long. I am just about to apply these to linux-kselftest next and ran into checkpatch errors on this patch.
*GASP* How humiliating.... Of course. Something by late tonight.
Signature · 2 lines
Darren Hart Intel Open Source Technology Center
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 17 lines · Shuah Khan
Hi Daren,
Quoted 14 lines · Darren Hart
Hi Shuah,
This series begins the process of migrating my futextest tests into kselftest.
I've started with only the functional tests, as the performance and stress may
not be appropriate for kselftest as they stand.I cleaned up various complaints from checkpatch, but I ignored others that would
require significant rework of the testcases, such as not using volatile and not
creating new typedefs.
Quoted 7 lines
Quoted 3 lines
The patches will follow, but I'm providing a pull request for your convenience
as well.Thanks for acting on this so quickly after we talked about it at ELC. Just a quick note that I am going to get to this soon once I get the 4.1 content wrapped up. We can plan upon getting these into 4.2.
OK. Michael E. provided some feedback which I can either incorporate and respin, or I can send as a follow-on to your -next after you merge these. Which do you prefer?
Signature · 2 lines
Darren Hart Intel Open Source Technology Center
Quoted 23 lines · Darren Hart
Quoted 21 lines · Shuah Khan
Hi Daren,
Quoted 17 lines · Darren Hart
Hi Shuah,
This series begins the process of migrating my futextest tests into kselftest.
I've started with only the functional tests, as the performance and stress may
not be appropriate for kselftest as they stand.I cleaned up various complaints from checkpatch, but I ignored others that would
require significant rework of the testcases, such as not using volatile and not
creating new typedefs.The patches will follow, but I'm providing a pull request for your convenience
as well.
Quoted 8 lines
Quoted 3 lines
Thanks for acting on this so quickly after we talked about it at ELC. Just a quick note that I am going to get to this soon once I get the 4.1 content wrapped up. We can plan upon getting these into 4.2.
OK. Michael E. provided some feedback which I can either incorporate and respin, or I can send as a follow-on to your -next after you merge these. Which do you prefer?
Working through my email. Yes I see Michael had comments on install. I would have the same ones. Please re-do the patch 2/5 to use shared logic and install framework in lib.mk. This need to be done to facilitate test install. If you were to create a script for running tests, please make it non-generic and unique. For example, run.sh is a very generic name.
[PATCH 2/5] selftest/futex: Update Makefile to use lib.mk
I took a quick look at the exit code discussion. If you would like improve what is in kselftest.h, please re-do that patch.
[PATCH 5/5] kselftest: Add exit code defines
You can wait to re-do patches. I am planning to review the patch set later on this week. That way you can avoid re-spin just in case, I have other comments.
thanks,
-- Shuah
Signature · 5 lines
Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) [email protected] | (970) 217-8978
Darren Hart
reviewerQuoted 32 lines · Shuah Khan
Quoted 31 lines · Darren Hart
Quoted 17 lines · Shuah Khan
Hi Daren,
Quoted 14 lines · Darren Hart
Hi Shuah,
This series begins the process of migrating my futextest tests into kselftest.
I've started with only the functional tests, as the performance and stress may
not be appropriate for kselftest as they stand.I cleaned up various complaints from checkpatch, but I ignored others that would
require significant rework of the testcases, such as not using volatile and not
creating new typedefs.Quoted 7 lines
Quoted 3 lines
The patches will follow, but I'm providing a pull request for your convenience
as well.Thanks for acting on this so quickly after we talked about it at ELC. Just a quick note that I am going to get to this soon once I get the 4.1 content wrapped up. We can plan upon getting these into 4.2.
OK. Michael E. provided some feedback which I can either incorporate and respin, or I can send as a follow-on to your -next after you merge these. Which do you prefer?
...
Quoted 3 lines
You can wait to re-do patches. I am planning to review the patch set later on this week. That way you can avoid re-spin just in case, I have other comments.
Hi Shuah,
Did you have any additional comments for the futex tests?
Thanks,
Signature · 2 lines
Darren Hart Intel Open Source Technology Center
Quoted 40 lines · Darren Hart
Quoted 32 lines · Shuah Khan
Quoted 31 lines · Darren Hart
Quoted 17 lines · Shuah Khan
Hi Daren,
Quoted 14 lines · Darren Hart
Hi Shuah,
This series begins the process of migrating my futextest tests into kselftest.
I've started with only the functional tests, as the performance and stress may
not be appropriate for kselftest as they stand.I cleaned up various complaints from checkpatch, but I ignored others that would
require significant rework of the testcases, such as not using volatile and not
creating new typedefs.Quoted 7 lines
Quoted 3 lines
The patches will follow, but I'm providing a pull request for your convenience
as well.Thanks for acting on this so quickly after we talked about it at ELC. Just a quick note that I am going to get to this soon once I get the 4.1 content wrapped up. We can plan upon getting these into 4.2.
OK. Michael E. provided some feedback which I can either incorporate and respin, or I can send as a follow-on to your -next after you merge these. Which do you prefer?
...
Quoted 3 lines
You can wait to re-do patches. I am planning to review the patch set later on this week. That way you can avoid re-spin just in case, I have other comments.
Quoted 6 lines
Hi Shuah,
Did you have any additional comments for the futex tests?
Thanks,
Sorry Daren. I got called away on a family emergency. The patch looks good to me and I don't have any additional comments.
Assume these get pulled in for 4.2 release. I will get to them soon once the 4.1-rc1 is out.
thanks,
-- Shuah
Signature · 5 lines
Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) [email protected] | (970) 217-8978
Quoted 47 lines · Shuah Khan
Quoted 46 lines · Darren Hart
Quoted 36 lines · Shuah Khan
Quoted 35 lines · Darren Hart
Quoted 19 lines · Shuah Khan
Hi Daren,
Quoted 16 lines · Darren Hart
Hi Shuah,
This series begins the process of migrating my futextest tests into kselftest.
I've started with only the functional tests, as the performance and stress may
not be appropriate for kselftest as they stand.I cleaned up various complaints from checkpatch, but I ignored others
that would
require significant rework of the testcases, such as not using volatile
and not
creating new typedefs.Quoted 7 lines
Quoted 3 lines
The patches will follow, but I'm providing a pull request for your convenience
as well.Thanks for acting on this so quickly after we talked about it at ELC. Just a quick note that I am going to get to this soon once I get the 4.1 content wrapped up. We can plan upon getting these into 4.2.
OK. Michael E. provided some feedback which I can either incorporate and
respin, or I can send as a follow-on to your -next after you merge these.
Which do you prefer?...
Quoted 3 lines
You can wait to re-do patches. I am planning to review the patch set later on this week. That way you can avoid re-spin just in case, I have other comments.
Hi Shuah,
Quoted 8 lines
Quoted 4 lines
Did you have any additional comments for the futex tests?
Thanks,
Sorry Daren. I got called away on a family emergency. The patch looks good to me and I don't have any additional comments.
No problem, hope things are alright.
Quoted 3 lines
Assume these get pulled in for 4.2 release. I will get to them soon once the 4.1-rc1 is out.
You had some initial comments, do you want me to tend to those and resend, or will you pull as is and have me follow-up - either is fine, just let me know what you prefer.
Thanks,
Signature · 2 lines
Darren Hart Intel Open Source Technology Center
Quoted 19 lines · Darren Hart
Hi Shuah,
This series begins the process of migrating my futextest tests into kselftest. I've started with only the functional tests, as the performance and stress may not be appropriate for kselftest as they stand.
I cleaned up various complaints from checkpatch, but I ignored others that would require significant rework of the testcases, such as not using volatile and not creating new typedefs.
The patches will follow, but I'm providing a pull request for your convenience as well.
The following changes since commit
0b63accf87225b5eb7e52814c374cf02d733d4bb:tools, update
rtctest.cto verify passage of time (2015-03-24 22:02:59 -0600)are available in the git repository at:
Quoted 8 lines
git://git.infradead.org/users/dvhart/linux.gitfutextestDarren Hart (5):
selftests: Add futex functional tests selftest/futex: UpdateMakefileto use lib.mk selftest/futex: Increment ksft pass and fail counters
selftest: Add futex tests to the top-levelMakefile
kselftest: Add exit code defines
I haven't really gone through these, but given how much I use these tests from your tree, I'm very glad to see them converted for upstream. I hope its as easy to use in kselftests though.