On വ്യാഴം 06 മെയ് 2010 12:28 വൈകു, Subrata Modak wrote:
Subject: LTPE clock_gettime03 fails

Issue Description below:
=======================================
# ./runltp -s clock_gettime03
<<<test_output>>>
clock_gettime03    1  TPASS  :  got expected failure: TEST_ERRNO=EFAULT(14):
Bad address
clock_gettime03    2  TPASS  :  got expected failure: TEST_ERRNO=EFAULT(14):
Bad address
clock_gettime03    3  TFAIL  :  failed to produce expected error [expected
errno = 22 (Invalid argument), TEST_RETURN = 0]: TEST_ERRNO=???(0): Success
clock_gettime03    4  TFAIL  :  failed to produce expected error [expected
errno = 22 (Invalid argument), TEST_RETURN = 0]: TEST_ERRNO=???(0): Success
clock_gettime03    5  TPASS  :  got expected failure: TEST_ERRNO=EFAULT(14):
Bad address
clock_gettime03    6  TPASS  :  got expected failure: TEST_ERRNO=EFAULT(14):
Bad address
<<<execution_status>>>
initiation_status="ok"
duration=0 termination_type=exited termination_id=1 corefile=no
cutime=0 cstime=1
<<<test_end>>>

SUZUKI K. POULOSE gave the following patch already. Not sure if it is
discussed in the mailing list:
--- include/common_timers.h.orig        2010-04-30 12:39:08.000000000 +0000
+++ include/common_timers.h     2010-04-30 12:39:46.000000000 +0000
@@ -35,7 +35,8 @@ clock_t clock_list[] = {
         CLOCK_THREAD_CPUTIME_ID,
         CLOCK_MONOTONIC_RAW,
  };
-#define MAX_CLOCKS (sizeof(clock_list) / sizeof(*clock_list))
+// #define MAX_CLOCKS (sizeof(clock_list) / sizeof(*clock_list))
+#define MAX_CLOCKS 16

  const char *get_clock_str(const int clock_id)
  {


The above patch fixes the problem. For more info, see linux/time.h for the
MAX_CLOCKS value.

The above patch indeed fixes the two issues, but it causes a regression for timer_create02 testcase. The complete patch is attached with this.



Regards--
Subrata


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. (Used as CLOCKS_DEFINED below)

Signed-off-by: Suzuki K P <[email protected]>

Index: ltp/testcases/kernel/timers/include/common_timers.h
===================================================================
--- ltp.orig/testcases/kernel/timers/include/common_timers.h    2009-12-06 
20:53:44.000000000 +0000
+++ ltp/testcases/kernel/timers/include/common_timers.h 2010-05-05 
09:17:58.000000000 +0000
@@ -35,7 +35,10 @@
        CLOCK_THREAD_CPUTIME_ID,
        CLOCK_MONOTONIC_RAW,
 };
-#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
 
 const char *get_clock_str(const int clock_id)
 {
Index: ltp/testcases/kernel/timers/timer_create/timer_create02.c
===================================================================
--- ltp.orig/testcases/kernel/timers/timer_create/timer_create02.c      
2010-05-05 09:18:21.000000000 +0000
+++ ltp/testcases/kernel/timers/timer_create/timer_create02.c   2010-05-05 
09:18:38.000000000 +0000
@@ -113,7 +113,7 @@
 
                        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")) {
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to