From: Subrata <ris...@li...> - 2010-05-07 08:53:43
|
The branch, master, has been updated via c98956ba8f40b4c9004ff5767db2b2d87ab46e41 (commit) from f0be8b0c4489defeb6eaf6715576524a48b8998a (commit) - Log ----------------------------------------------------------------- commit c98956ba8f40b4c9004ff5767db2b2d87ab46e41 Author: Subrata Modak <sub...@su...> Date: Fri May 7 14:21:00 2010 +0530 The MAX_CLOCKS supported by the kernel is 16. But the kernel may not have all the clock sources defined in the range 0-15. Hence, to test whether kernel returns error for an INVALID clock source id, we should use the upper limit MAX_CLOCKS (16 at the moment). But to verify the the defined clocks work fine, we should loop through the "list" of clock sources defined for sure. MAX_CLOCKS marsk the end of the clock sources in the array. Signed-off-by: Suzuki K P <su...@in...>, Acked-by: Garrett Cooper <yan...@gm...>, ----------------------------------------------------------------------- Summary of changes: testcases/kernel/timers/include/common_timers.h | 5 ++++- .../kernel/timers/timer_create/timer_create02.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/testcases/kernel/timers/include/common_timers.h b/testcases/kernel/timers/include/common_timers.h index 6af4d70..d9b7cb9 100644 --- a/testcases/kernel/timers/include/common_timers.h +++ b/testcases/kernel/timers/include/common_timers.h @@ -29,7 +29,10 @@ clock_t clock_list[] = { CLOCK_MONOTONIC_COARSE, #endif }; -#define MAX_CLOCKS (sizeof(clock_list) / sizeof(*clock_list)) +/* CLOCKS_DEFINED is the number of clock sources defined for sure */ +#define CLOCKS_DEFINED (sizeof(clock_list) / sizeof(*clock_list)) +/* MAX_CLOCKS is the maximum number of clock sources supported by kernel */ +#define MAX_CLOCKS 16 #define CLOCK_TO_STR(def_name) \ case def_name: \ diff --git a/testcases/kernel/timers/timer_create/timer_create02.c b/testcases/kernel/timers/timer_create/timer_create02.c index 6aba4ea..cef7cbe 100755 --- a/testcases/kernel/timers/timer_create/timer_create02.c +++ b/testcases/kernel/timers/timer_create/timer_create02.c @@ -113,7 +113,7 @@ main(int ac, char **av) setup_test(i); - for (j = 0; j < MAX_CLOCKS; ++j) { + for (j = 0; j < CLOCKS_DEFINED; ++j) { if (strstr(get_clock_str(clock_list[j]), "CPUTIME_ID")) { hooks/post-receive -- ltp |