From: Subrata <sub...@us...> - 2008-02-26 11:14:57
|
Update of /cvsroot/ltp/ltp/testcases/kernel/timers/clock_gettime In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv729/ltp/testcases/kernel/timers/clock_gettime Modified Files: clock_gettime03.c Log Message: CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID are also supported besides CLOCK_REALTIME and CLOCK_MONOTONIC. That's the cause of the failure of clock_gettime03, timer_create02 and timer_create04. Another cause is that struct sigevent evp is assigned with invalid values when option is 1. That's the cause of the failure of timer_create02 and timer_create03. CLOCK_REALTIME_HR and CLOCK_MONOTONIC_HR have been removed in the later kernel versions, hence the failures in the test. I am still trying to find out if any kernel versions used to support these. CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID are supported from 2.6.12 kernel version onwards and the test case needs to be modified for this change. Also in timer_create02.c, setup_test() case1 needs to be modified so as to make evp NULL instead of its members. Since the testcase behaves differently for different kernel versions, a version check needs to be added for making it pass across versions. I'm removing the HR clocks from the tests along with other changes, by, Anoop V. Chakkalakkal <ano...@in...> Index: clock_gettime03.c =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/kernel/timers/clock_gettime/clock_gettime03.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** clock_gettime03.c 22 Aug 2006 05:57:53 -0000 1.5 --- clock_gettime03.c 26 Feb 2008 11:14:44 -0000 1.6 *************** *** 89,100 **** int exp_errno; /* expected error number*/ char *exp_errval; /* Expected errorvalue string*/ ! } testcase[] = { ! {"Bad address", EFAULT, "EFAULT"}, /* Bad timespec * */ ! {"Bad address", EFAULT, "EFAULT"}, /* Bad timespec * */ ! {"Invalid parameter", EINVAL, "EINVAL"}, /* PROCESS_CPUTIME_ID*/ ! {"Invalid parameter", EINVAL, "EINVAL"}, /* THREAD_CPUTIME_ID */ ! {"Invalid parameter", EINVAL, "EINVAL"}, /* REALTIME_HR */ ! {"Invalid parameter", EINVAL, "EINVAL"}, /* MONOTONIC_HR */ ! {"Invalid parameter", EINVAL, "EINVAL"}, /* MAX_CLOCKS */ {"Invalid parameter", EINVAL, "EINVAL"} /* MAX_CLOCKS + 1 */ }; --- 89,96 ---- int exp_errno; /* expected error number*/ char *exp_errval; /* Expected errorvalue string*/ ! } testcase[6] = { ! {"Bad address", EFAULT, "EFAULT"}, /* Bad timespec */ ! {"Bad address", EFAULT, "EFAULT"}, /* Bad timespec */ ! {"Invalid parameter", EINVAL, "EINVAL"}, /* MAX_CLOCKS */ {"Invalid parameter", EINVAL, "EINVAL"} /* MAX_CLOCKS + 1 */ }; *************** *** 106,118 **** char *msg; /* message returned from parse_opts */ struct timespec spec, *temp; ! clockid_t clocks[8] = { ! CLOCK_REALTIME, CLOCK_REALTIME, ! CLOCK_PROCESS_CPUTIME_ID, ! CLOCK_THREAD_CPUTIME_ID, ! CLOCK_REALTIME_HR, ! CLOCK_MONOTONIC_HR, MAX_CLOCKS, ! MAX_CLOCKS + 1 }; --- 102,113 ---- char *msg; /* message returned from parse_opts */ struct timespec spec, *temp; ! ! clockid_t clocks[] = { CLOCK_REALTIME, ! CLOCK_MONOTONIC, MAX_CLOCKS, ! MAX_CLOCKS + 1, ! CLOCK_PROCESS_CPUTIME_ID, ! CLOCK_THREAD_CPUTIME_ID }; *************** *** 125,128 **** --- 120,144 ---- TST_TOTAL = sizeof(testcase) / sizeof(testcase[0]); + /* PROCESS_CPUTIME_ID & THREAD_CPUTIME_ID are not supported on + * kernel versions lower than 2.6.12 + */ + if((tst_kvercmp(2, 6, 12)) < 0) { + testcase[4].err_desc = "Invalid parameter"; /* PROCESS_CPUTIME_ID */ + testcase[4].exp_errno = EINVAL; + testcase[4].exp_errval = "EINVAL"; + testcase[5].err_desc = "Invalid parameter"; /* THREAD_CPUTIME_ID */ + testcase[5].exp_errno = EINVAL; + testcase[5].exp_errval = "EINVAL"; + } + else { + testcase[4].err_desc = "Bad address"; /* Bad timespec pointer */ + testcase[4].exp_errno = EFAULT; + testcase[4].exp_errval = "EFAULT"; + testcase[5].err_desc = "Bad address"; /* Bad timespec pointer */ + testcase[5].exp_errno = EFAULT; + testcase[5].exp_errval = "EFAULT"; + } + + /* perform global setup for test */ setup(); *************** *** 135,144 **** for (i = 0; i < TST_TOTAL; i++) { if (i == 0) { temp = (struct timespec *) -1; } else if (i == 1) { temp = (struct timespec *) NULL; ! } else { ! temp = &spec; } --- 151,162 ---- for (i = 0; i < TST_TOTAL; i++) { + temp = &spec; + if (i == 0) { temp = (struct timespec *) -1; } else if (i == 1) { temp = (struct timespec *) NULL; ! } else if ((i >= 4) && (tst_kvercmp(2, 6, 12) >= 0)) { ! temp = (struct timespec *) NULL; } |