Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests:timers: remove local CLOCKID defines

timers tests defines CLOCKIDs locally. Remove all local CLOCKIDs except
CLOCK_HWSPECIFIC and use defines from time.h header file.

CLOCK_HWSPECIFIC and CLOCK_SGI_CYCLE are the same and CLOCK_SGI_CYCLE
is deprecated,

Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Acked-by: John Stultz <jstultz@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

+15 -76
-2
tools/testing/selftests/timers/adjtick.c
··· 26 26 27 27 #include "../kselftest.h" 28 28 29 - #define CLOCK_MONOTONIC_RAW 4 30 - 31 29 #define MILLION 1000000 32 30 33 31 long systick;
-15
tools/testing/selftests/timers/alarmtimer-suspend.c
··· 32 32 #include <errno.h> 33 33 #include "../kselftest.h" 34 34 35 - #define CLOCK_REALTIME 0 36 - #define CLOCK_MONOTONIC 1 37 - #define CLOCK_PROCESS_CPUTIME_ID 2 38 - #define CLOCK_THREAD_CPUTIME_ID 3 39 - #define CLOCK_MONOTONIC_RAW 4 40 - #define CLOCK_REALTIME_COARSE 5 41 - #define CLOCK_MONOTONIC_COARSE 6 42 - #define CLOCK_BOOTTIME 7 43 - #define CLOCK_REALTIME_ALARM 8 44 - #define CLOCK_BOOTTIME_ALARM 9 45 - #define CLOCK_HWSPECIFIC 10 46 - #define CLOCK_TAI 11 47 - #define NR_CLOCKIDS 12 48 - 49 - 50 35 #define UNREASONABLE_LAT (NSEC_PER_SEC * 5) /* hopefully we resume in 5 secs */ 51 36 52 37 #define SUSPEND_SECS 15
+4 -15
tools/testing/selftests/timers/inconsistency-check.c
··· 31 31 #include <include/vdso/time64.h> 32 32 #include "../kselftest.h" 33 33 34 - #define CALLS_PER_LOOP 64 35 - 36 - #define CLOCK_REALTIME 0 37 - #define CLOCK_MONOTONIC 1 38 - #define CLOCK_PROCESS_CPUTIME_ID 2 39 - #define CLOCK_THREAD_CPUTIME_ID 3 40 - #define CLOCK_MONOTONIC_RAW 4 41 - #define CLOCK_REALTIME_COARSE 5 42 - #define CLOCK_MONOTONIC_COARSE 6 43 - #define CLOCK_BOOTTIME 7 44 - #define CLOCK_REALTIME_ALARM 8 45 - #define CLOCK_BOOTTIME_ALARM 9 34 + /* CLOCK_HWSPECIFIC == CLOCK_SGI_CYCLE (Deprecated) */ 46 35 #define CLOCK_HWSPECIFIC 10 47 - #define CLOCK_TAI 11 48 - #define NR_CLOCKIDS 12 36 + 37 + #define CALLS_PER_LOOP 64 49 38 50 39 char *clockstring(int clockid) 51 40 { ··· 141 152 { 142 153 int clockid, opt; 143 154 int userclock = CLOCK_REALTIME; 144 - int maxclocks = NR_CLOCKIDS; 155 + int maxclocks = CLOCK_TAI + 1; 145 156 int runtime = 10; 146 157 struct timespec ts; 147 158
+4 -14
tools/testing/selftests/timers/nanosleep.c
··· 30 30 #include <include/vdso/time64.h> 31 31 #include "../kselftest.h" 32 32 33 - #define CLOCK_REALTIME 0 34 - #define CLOCK_MONOTONIC 1 35 - #define CLOCK_PROCESS_CPUTIME_ID 2 36 - #define CLOCK_THREAD_CPUTIME_ID 3 37 - #define CLOCK_MONOTONIC_RAW 4 38 - #define CLOCK_REALTIME_COARSE 5 39 - #define CLOCK_MONOTONIC_COARSE 6 40 - #define CLOCK_BOOTTIME 7 41 - #define CLOCK_REALTIME_ALARM 8 42 - #define CLOCK_BOOTTIME_ALARM 9 33 + /* CLOCK_HWSPECIFIC == CLOCK_SGI_CYCLE (Deprecated) */ 43 34 #define CLOCK_HWSPECIFIC 10 44 - #define CLOCK_TAI 11 45 - #define NR_CLOCKIDS 12 46 35 47 36 #define UNSUPPORTED 0xf00f 48 37 ··· 120 131 { 121 132 long long length; 122 133 int clockid, ret; 134 + int max_clocks = CLOCK_TAI + 1; 123 135 124 136 ksft_print_header(); 125 - ksft_set_plan(NR_CLOCKIDS); 137 + ksft_set_plan(max_clocks); 126 138 127 - for (clockid = CLOCK_REALTIME; clockid < NR_CLOCKIDS; clockid++) { 139 + for (clockid = CLOCK_REALTIME; clockid < max_clocks; clockid++) { 128 140 129 141 /* Skip cputime clockids since nanosleep won't increment cputime */ 130 142 if (clockid == CLOCK_PROCESS_CPUTIME_ID ||
+4 -15
tools/testing/selftests/timers/nsleep-lat.c
··· 29 29 30 30 #define UNRESONABLE_LATENCY 40000000 /* 40ms in nanosecs */ 31 31 32 - 33 - #define CLOCK_REALTIME 0 34 - #define CLOCK_MONOTONIC 1 35 - #define CLOCK_PROCESS_CPUTIME_ID 2 36 - #define CLOCK_THREAD_CPUTIME_ID 3 37 - #define CLOCK_MONOTONIC_RAW 4 38 - #define CLOCK_REALTIME_COARSE 5 39 - #define CLOCK_MONOTONIC_COARSE 6 40 - #define CLOCK_BOOTTIME 7 41 - #define CLOCK_REALTIME_ALARM 8 42 - #define CLOCK_BOOTTIME_ALARM 9 32 + /* CLOCK_HWSPECIFIC == CLOCK_SGI_CYCLE (Deprecated) */ 43 33 #define CLOCK_HWSPECIFIC 10 44 - #define CLOCK_TAI 11 45 - #define NR_CLOCKIDS 12 46 34 47 35 #define UNSUPPORTED 0xf00f 48 36 ··· 132 144 { 133 145 long long length; 134 146 int clockid, ret; 147 + int max_clocks = CLOCK_TAI + 1; 135 148 136 149 ksft_print_header(); 137 - ksft_set_plan(NR_CLOCKIDS - CLOCK_REALTIME - SKIPPED_CLOCK_COUNT); 150 + ksft_set_plan(max_clocks - CLOCK_REALTIME - SKIPPED_CLOCK_COUNT); 138 151 139 - for (clockid = CLOCK_REALTIME; clockid < NR_CLOCKIDS; clockid++) { 152 + for (clockid = CLOCK_REALTIME; clockid < max_clocks; clockid++) { 140 153 141 154 /* Skip cputime clockids since nanosleep won't increment cputime */ 142 155 if (clockid == CLOCK_PROCESS_CPUTIME_ID ||
-2
tools/testing/selftests/timers/raw_skew.c
··· 28 28 #include <include/vdso/time64.h> 29 29 #include "../kselftest.h" 30 30 31 - #define CLOCK_MONOTONIC_RAW 4 32 - 33 31 #define shift_right(x, s) ({ \ 34 32 __typeof__(x) __x = (x); \ 35 33 __typeof__(s) __s = (s); \
+3 -13
tools/testing/selftests/timers/set-timer-lat.c
··· 31 31 #include <include/vdso/time64.h> 32 32 #include "../kselftest.h" 33 33 34 - #define CLOCK_REALTIME 0 35 - #define CLOCK_MONOTONIC 1 36 - #define CLOCK_PROCESS_CPUTIME_ID 2 37 - #define CLOCK_THREAD_CPUTIME_ID 3 38 - #define CLOCK_MONOTONIC_RAW 4 39 - #define CLOCK_REALTIME_COARSE 5 40 - #define CLOCK_MONOTONIC_COARSE 6 41 - #define CLOCK_BOOTTIME 7 42 - #define CLOCK_REALTIME_ALARM 8 43 - #define CLOCK_BOOTTIME_ALARM 9 34 + /* CLOCK_HWSPECIFIC == CLOCK_SGI_CYCLE (Deprecated) */ 44 35 #define CLOCK_HWSPECIFIC 10 45 - #define CLOCK_TAI 11 46 - #define NR_CLOCKIDS 12 47 36 48 37 #define UNRESONABLE_LATENCY 40000000 /* 40ms in nanosecs */ 49 38 ··· 242 253 struct sigaction act; 243 254 int signum = SIGRTMAX; 244 255 int ret = 0; 256 + int max_clocks = CLOCK_TAI + 1; 245 257 246 258 /* Set up signal handler: */ 247 259 sigfillset(&act.sa_mask); ··· 251 261 sigaction(signum, &act, NULL); 252 262 253 263 printf("Setting timers for every %i seconds\n", TIMER_SECS); 254 - for (clock_id = 0; clock_id < NR_CLOCKIDS; clock_id++) { 264 + for (clock_id = 0; clock_id < max_clocks; clock_id++) { 255 265 256 266 if ((clock_id == CLOCK_PROCESS_CPUTIME_ID) || 257 267 (clock_id == CLOCK_THREAD_CPUTIME_ID) ||