selfttests: timers ksft_ stubs handling changes
Subsystems (3)
cover selfttests: timers ksft_ stubs handling changes
This patch series consists of changes to:
Move ksft_ stubs from individual tests into kselftest_stubs.h and change tests to include it.
Fix posix_timers and freq-step tests to run without ksft_ framework.
This is in preparation to convert timers tests to ksft TAP 13 format.
Question for John Stultz:
The conversion work will be easier without the requirement to be able to build and run these tests without ksft_ framework. So far the stubs are simpler. It is might be necessary to ifdef some code paths to have sane output for both KTEST and !KTEST cases.
Would it be easier to pull in kselftest.h into timers external repo (if one still exists). This is based on the observation that newer timer tests don't support !KTEST case e.g: posix_timers and freq-step.
Please review and let me know how you would like me to proceed with the conversion. I am looking for answer to how important is it to continue to support !KTEST case.
Shuah Khan (3):
selftests: timers: move ksft_ stubs from tests into kselftest_stubs.h
selftests: timers: posix_timers: fix to work without ksft framework
selftests: timers: freq-step: to work without ksft framework
tools/testing/selftests/timers/adjtick.c | 9 +-------- .../testing/selftests/timers/alarmtimer-suspend.c | 9 +-------- tools/testing/selftests/timers/change_skew.c | 9 +-------- .../testing/selftests/timers/clocksource-switch.c | 9 +-------- tools/testing/selftests/timers/freq-step.c | 4 ++++ .../testing/selftests/timers/inconsistency-check.c | 9 +-------- tools/testing/selftests/timers/kselftest_stubs.h | 23 ++++++++++++++++++++++ tools/testing/selftests/timers/leap-a-day.c | 9 +-------- tools/testing/selftests/timers/leapcrash.c | 9 +-------- tools/testing/selftests/timers/mqueue-lat.c | 9 +-------- tools/testing/selftests/timers/nanosleep.c | 9 +-------- tools/testing/selftests/timers/nsleep-lat.c | 9 +-------- tools/testing/selftests/timers/posix_timers.c | 4 ++++ tools/testing/selftests/timers/raw_skew.c | 9 +-------- tools/testing/selftests/timers/set-2038.c | 9 +-------- tools/testing/selftests/timers/set-tai.c | 9 +-------- tools/testing/selftests/timers/set-timer-lat.c | 9 +-------- tools/testing/selftests/timers/set-tz.c | 9 +-------- tools/testing/selftests/timers/skew_consistency.c | 9 +-------- tools/testing/selftests/timers/threadtest.c | 9 +-------- tools/testing/selftests/timers/valid-adjtimex.c | 9 +-------- 21 files changed, 49 insertions(+), 144 deletions(-) create mode 100644 tools/testing/selftests/timers/kselftest_stubs.h
Signature · 1 line
2.11.0
PATCH 1/3 selftests: timers: move ksft_ stubs from tests into kselftest_stubs.h
Move ksft_ stubs from individual tests into kselftest_stubs.h and change tests to include it.
This change removes duplicate stubs from individual tests and gets them ready for converting them to Kselftest TAP13 API.
--- tools/testing/selftests/timers/adjtick.c | 9 +-------- .../testing/selftests/timers/alarmtimer-suspend.c | 9 +-------- tools/testing/selftests/timers/change_skew.c | 9 +-------- .../testing/selftests/timers/clocksource-switch.c | 9 +-------- .../testing/selftests/timers/inconsistency-check.c | 9 +-------- tools/testing/selftests/timers/kselftest_stubs.h | 22 ++++++++++++++++++++++ tools/testing/selftests/timers/leap-a-day.c | 9 +-------- tools/testing/selftests/timers/leapcrash.c | 9 +-------- tools/testing/selftests/timers/mqueue-lat.c | 9 +-------- tools/testing/selftests/timers/nanosleep.c | 9 +-------- tools/testing/selftests/timers/nsleep-lat.c | 9 +-------- tools/testing/selftests/timers/raw_skew.c | 9 +-------- tools/testing/selftests/timers/set-2038.c | 9 +-------- tools/testing/selftests/timers/set-tai.c | 9 +-------- tools/testing/selftests/timers/set-timer-lat.c | 9 +-------- tools/testing/selftests/timers/set-tz.c | 9 +-------- tools/testing/selftests/timers/skew_consistency.c | 9 +-------- tools/testing/selftests/timers/threadtest.c | 9 +-------- tools/testing/selftests/timers/valid-adjtimex.c | 9 +-------- 19 files changed, 40 insertions(+), 144 deletions(-) create mode 100644 tools/testing/selftests/timers/kselftest_stubs.h
tools/testing/selftests/timers/adjtick.c +1 -8
@@ -26,14 +26,7 @@#ifdef KTEST #include "../kselftest.h" #else -static inline int ksft_exit_pass (void ) -{ -exit (0 ); -} -static inline int ksft_exit_fail (void ) -{ -exit (1 ); -} +#include "kselftest_stubs.h" #endif #define CLOCK_MONOTONIC_RAW 4
tools/testing/selftests/timers/alarmtimer-suspend.c +1 -8
@@ -31,14 +31,7 @@#ifdef KTEST #include "../kselftest.h" #else -static inline int ksft_exit_pass (void ) -{ -exit (0 ); -} -static inline int ksft_exit_fail (void ) -{ -exit (1 ); -} +#include "kselftest_stubs.h" #endif #define CLOCK_REALTIME 0
tools/testing/selftests/timers/change_skew.c +1 -8
@@ -31,14 +31,7 @@#ifdef KTEST #include "../kselftest.h" #else -static inline int ksft_exit_pass (void ) -{ -exit (0 ); -} -static inline int ksft_exit_fail (void ) -{ -exit (1 ); -} +#include "kselftest_stubs.h" #endif #define NSEC_PER_SEC 1000000000LL
tools/testing/selftests/timers/clocksource-switch.c +1 -8
@@ -37,14 +37,7 @@#ifdef KTEST #include "../kselftest.h" #else -static inline int ksft_exit_pass (void ) -{ -exit (0 ); -} -static inline int ksft_exit_fail (void ) -{ -exit (1 ); -} +#include "kselftest_stubs.h" #endif
tools/testing/selftests/timers/inconsistency-check.c +1 -8
@@ -31,14 +31,7 @@#ifdef KTEST #include "../kselftest.h" #else -static inline int ksft_exit_pass (void ) -{ -exit (0 ); -} -static inline int ksft_exit_fail (void ) -{ -exit (1 ); -} +#include "kselftest_stubs.h" #endif #define CALLS_PER_LOOP 64
tools/testing/selftests/timers/kselftest_stubs.h new file +22 -0
@@ -0,0 +1,22 @@ +/* +* kselftest_stubs.h: kselftest framework stubs +* +* Copyright (c) 2017 Shuah Khan <[email protected]> +* Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* This file is released under the GPLv2. +* +* This is stub file for ksft_* API to continue to build timer tests +* without Kselftest framework. +*/ +#ifndef __KSELFTEST_STUBS_H +#define __KSELFTEST_STUBS_H + +#include <stdlib.h> +#include <unistd.h> +#include <stdarg.h> + +static inline int ksft_exit_pass (void ) {exit (0 ); } +static inline int ksft_exit_fail (void ) {exit (1 ); } + +#endif /* __KSELFTEST__STUBS_H */
tools/testing/selftests/timers/leap-a-day.c +1 -8
@@ -51,14 +51,7 @@#ifdef KTEST #include "../kselftest.h" #else -static inline int ksft_exit_pass (void ) -{ -exit (0 ); -} -static inline int ksft_exit_fail (void ) -{ -exit (1 ); -} +#include "kselftest_stubs.h" #endif #define NSEC_PER_SEC 1000000000ULL
tools/testing/selftests/timers/leapcrash.c +1 -8
@@ -25,14 +25,7 @@#ifdef KTEST #include "../kselftest.h" #else -static inline int ksft_exit_pass (void ) -{ -exit (0 ); -} -static inline int ksft_exit_fail (void ) -{ -exit (1 ); -} +#include "kselftest_stubs.h" #endif
tools/testing/selftests/timers/mqueue-lat.c +1 -8
@@ -32,14 +32,7 @@#ifdef KTEST #include "../kselftest.h" #else -static inline int ksft_exit_pass (void ) -{ -exit (0 ); -} -static inline int ksft_exit_fail (void ) -{ -exit (1 ); -} +#include "kselftest_stubs.h" #endif #define NSEC_PER_SEC 1000000000ULL
tools/testing/selftests/timers/nanosleep.c +1 -8
@@ -30,14 +30,7 @@#ifdef KTEST #include "../kselftest.h" #else -static inline int ksft_exit_pass (void ) -{ -exit (0 ); -} -static inline int ksft_exit_fail (void ) -{ -exit (1 ); -} +#include "kselftest_stubs.h" #endif #define NSEC_PER_SEC 1000000000ULL
tools/testing/selftests/timers/nsleep-lat.c +1 -8
@@ -27,14 +27,7 @@#ifdef KTEST #include "../kselftest.h" #else -static inline int ksft_exit_pass (void ) -{ -exit (0 ); -} -static inline int ksft_exit_fail (void ) -{ -exit (1 ); -} +#include "kselftest_stubs.h" #endif #define NSEC_PER_SEC 1000000000ULL
tools/testing/selftests/timers/raw_skew.c +1 -8
@@ -28,14 +28,7 @@#ifdef KTEST #include "../kselftest.h" #else -static inline int ksft_exit_pass (void ) -{ -exit (0 ); -} -static inline int ksft_exit_fail (void ) -{ -exit (1 ); -} +#include "kselftest_stubs.h" #endif
tools/testing/selftests/timers/set-2038.c +1 -8
@@ -30,14 +30,7 @@#ifdef KTEST #include "../kselftest.h" #else -static inline int ksft_exit_pass (void ) -{ -exit (0 ); -} -static inline int ksft_exit_fail (void ) -{ -exit (1 ); -} +#include "kselftest_stubs.h" #endif #define NSEC_PER_SEC 1000000000LL
tools/testing/selftests/timers/set-tai.c +1 -8
@@ -26,14 +26,7 @@#ifdef KTEST #include "../kselftest.h" #else -static inline int ksft_exit_pass (void ) -{ -exit (0 ); -} -static inline int ksft_exit_fail (void ) -{ -exit (1 ); -} +#include "kselftest_stubs.h" #endif int set_tai (int offset)
tools/testing/selftests/timers/set-timer-lat.c +1 -8
@@ -30,14 +30,7 @@#ifdef KTEST #include "../kselftest.h" #else -static inline int ksft_exit_pass (void ) -{ -exit (0 ); -} -static inline int ksft_exit_fail (void ) -{ -exit (1 ); -} +#include "kselftest_stubs.h" #endif #define CLOCK_REALTIME 0
tools/testing/selftests/timers/set-tz.c +1 -8
@@ -26,14 +26,7 @@#ifdef KTEST #include "../kselftest.h" #else -static inline int ksft_exit_pass (void ) -{ -exit (0 ); -} -static inline int ksft_exit_fail (void ) -{ -exit (1 ); -} +#include "kselftest_stubs.h" #endif int set_tz (int min,int dst)
tools/testing/selftests/timers/skew_consistency.c +1 -8
@@ -38,14 +38,7 @@#ifdef KTEST #include "../kselftest.h" #else -static inline int ksft_exit_pass (void ) -{ -exit (0 ); -} -static inline int ksft_exit_fail (void ) -{ -exit (1 ); -} +#include "kselftest_stubs.h" #endif #define NSEC_PER_SEC 1000000000LL
tools/testing/selftests/timers/threadtest.c +1 -8
@@ -24,14 +24,7 @@#ifdef KTEST #include "../kselftest.h" #else -static inline int ksft_exit_pass (void ) -{ -exit (0 ); -} -static inline int ksft_exit_fail (void ) -{ -exit (1 ); -} +#include "kselftest_stubs.h" #endif
tools/testing/selftests/timers/valid-adjtimex.c +1 -8
@@ -35,14 +35,7 @@#ifdef KTEST #include "../kselftest.h" #else -static inline int ksft_exit_pass (void ) -{ -exit (0 ); -} -static inline int ksft_exit_fail (void ) -{ -exit (1 ); -} +#include "kselftest_stubs.h" #endif #define NSEC_PER_SEC 1000000000LL
Signature · 1 line
2.11.0
PATCH 2/3 selftests: timers: posix_timers: fix to work without ksft framework
In reply to Shuah KhanFix to build and run without ksft framework like the other timers tests.
--- tools/testing/selftests/timers/posix_timers.c | 4 ++++ 1 file changed, 4 insertions(+)
tools/testing/selftests/timers/posix_timers.c +4 -0
@@ -15,7 +15,11 @@#include <time.h> #include <pthread.h> +#ifdef KTEST #include "../kselftest.h" +#else +#include "kselftest_stubs.h" +#endif #define DELAY 2#define USECS_PER_SEC 1000000
Signature · 1 line
2.11.0
PATCH 3/3 selftests: timers: freq-step: to work without ksft framework
In reply to Shuah KhanFix to build and run without ksft framework like the other timers tests.
--- tools/testing/selftests/timers/freq-step.c | 4 ++++ tools/testing/selftests/timers/kselftest_stubs.h | 1 + 2 files changed, 5 insertions(+)
tools/testing/selftests/timers/freq-step.c +4 -0
@@ -23,7 +23,11 @@#include <time.h> #include <unistd.h> +#ifdef KTEST #include "../kselftest.h" +#else +#include "kselftest_stubs.h" +#endif #define SAMPLES 100#define SAMPLE_READINGS 10
tools/testing/selftests/timers/kselftest_stubs.h +1 -0
@@ -18,5 +18,6 @@static inline int ksft_exit_pass (void ) {exit (0 ); }static inline int ksft_exit_fail (void ) {exit (1 ); } +static inline int ksft_exit_skip (const char *msg, ...) {exit (4 ); }#endif /* __KSELFTEST__STUBS_H */
Signature · 1 line
2.11.0
Quoted 16 lines · Shuah Khan
This patch series consists of changes to:
Move
ksft_stubs from individual tests intokselftest_stubs.hand change tests to include it.Fix
posix_timersand freq-step tests to run withoutksft_framework.This is in preparation to convert timers tests to ksft TAP 13 format.
Question for John Stultz:
The conversion work will be easier without the requirement to be able to build and run these tests without
ksft_framework. So far the stubs are simpler. It is might be necessary to ifdef some code paths to have sane output for both KTEST and !KTEST cases.
Quoted 7 lines
Would it be easier to pull in
kselftest.hinto timers external repo (if one still exists). This is based on the observation that newer timer tests don't support !KTEST case e.g:posix_timersand freq-step.Please review and let me know how you would like me to proceed with the conversion. I am looking for answer to how important is it to continue to support !KTEST case.
Yea. I'm thinking at this point I'm fine with dropping the attempt to keep kselftest and my external timekeeping tests in sync.
Though something that might be nice however is having some place that keeps tarball releases of kselftest around? As it would make pulling tests onto a target machine a bit easier. Does that already exist?
thanks
-john
Shuah Khan
maintainerQuoted 21 lines · John Stultz
Quoted 20 lines · Shuah Khan
This patch series consists of changes to:
Move
ksft_stubs from individual tests intokselftest_stubs.hand change tests to include it.Fix
posix_timersand freq-step tests to run withoutksft_framework.This is in preparation to convert timers tests to ksft TAP 13 format.
Question for John Stultz:
The conversion work will be easier without the requirement to be able to build and run these tests without
ksft_framework. So far the stubs are simpler. It is might be necessary to ifdef some code paths to have sane output for both KTEST and !KTEST cases.Would it be easier to pull in
kselftest.hinto timers external repo (if one still exists). This is based on the observation that newer timer tests don't support !KTEST case e.g:posix_timersand freq-step.
Quoted 6 lines
Quoted 3 lines
Please review and let me know how you would like me to proceed with the conversion. I am looking for answer to how important is it to continue to support !KTEST case.
Yea. I'm thinking at this point I'm fine with dropping the attempt to keep kselftest and my external timekeeping tests in sync.
Would you like me to clean !KTEST support or leave it the way it is. It sounds like, I will drop these patches anyway.
Quoted 5 lines
Though something that might be nice however is having some place that keeps tarball releases of kselftest around? As it would make pulling tests onto a target machine a bit easier. Does that already exist?
There is an install script tools/testing/selftests/gen_kselftest_tar.sh for generating tar-ball for compiled tests at the moment. There is none for source package.
thanks,
-- Shuah
Quoted 26 lines · Shuah Khan
Quoted 25 lines · John Stultz
Quoted 23 lines · Shuah Khan
This patch series consists of changes to:
Move
ksft_stubs from individual tests intokselftest_stubs.hand change tests to include it.Fix
posix_timersand freq-step tests to run withoutksft_framework.This is in preparation to convert timers tests to ksft TAP 13 format.
Question for John Stultz:
The conversion work will be easier without the requirement to be able to build and run these tests without
ksft_framework. So far the stubs are simpler. It is might be necessary to ifdef some code paths to have sane output for both KTEST and !KTEST cases.Would it be easier to pull in
kselftest.hinto timers external repo (if one still exists). This is based on the observation that newer timer tests don't support !KTEST case e.g:posix_timersand freq-step.Please review and let me know how you would like me to proceed with the conversion. I am looking for answer to how important is it to continue to support !KTEST case.
Quoted 5 lines
Quoted 2 lines
Yea. I'm thinking at this point I'm fine with dropping the attempt to keep kselftest and my external timekeeping tests in sync.
Would you like me to clean !KTEST support or leave it the way it is. It sounds like, I will drop these patches anyway.
Yea. I think its ok to drop !KTEST.
thanks
-john