Hi,
(I've already posted this message on Open POSIX test suite mailing list, but
didn't receive any reply. The list seems dead since last year)
conformance/interfaces/timer_getoverrun/2-2 has failed on tests with some
distros running on ppc64 machines:
gekko-lp1:~/ltp-full-20080731/testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun # ./2-2
FAIL: 38 overruns sent; expected 75
As far as I could realize, it happens due to these machines are running kernel
with timer frequency configured to 100 Hz, which represents a clock precision
smaller than the defined INTERVALNSEC.
This patch sets the interval equals to the clock precision (retrieved via
function clock_getres()), in order to avoid to use a interval smaller than the
resolution of the clock. However, with these changes, this testcase becomes
very similar to the test 2-3. Is this a valid modification? If not, any thought
what should be done in this case?
Thanks in advance,
--
Edjunior
This patch sets the interval equals to the clock precision
(retrieved via function clock_getres()), in order to avoid
to use a interval smaller than the resolution of the clock.
Signed-off-by: Edjunior Barbosa Machado <[EMAIL PROTECTED]>
---
--- ltp-full-20080731/testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun/2-2-orig.c 2008-08-26 22:32:57.000000000 +0000
+++ ltp-full-20080731/testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun/2-2.c 2008-08-26 22:36:32.000000000 +0000
@@ -9,6 +9,8 @@
* have happened due to signals being sent from a timer. Test with
* timer seconds in nanoseconds.
*
+ * INTERVALNSEC = clock resolution
+ *
* Steps (testing with just one overrun):
* - Block signal SIGCONT (SIGCONT used so test will not terminate)
* - Set up a timer to send SIGCONT on expiration with an interval
@@ -26,7 +28,6 @@
#include "posixtest.h"
#define VALUENSEC 2000000
-#define INTERVALNSEC 5000000
#define EXPECTEDOVERRUNS 75
@@ -36,7 +37,7 @@ int main()
struct sigevent ev;
timer_t tid;
struct itimerspec its;
- struct timespec ts;
+ struct timespec ts, tsres;
int overruns;
if (sigemptyset(&set) != 0) {
@@ -65,8 +66,18 @@ int main()
return PTS_UNRESOLVED;
}
+ if (clock_getres(CLOCK_REALTIME, &tsres) != 0) {
+ perror("clock_gettime() did not return success\n");
+ return PTS_UNRESOLVED;
+ }
+
+ if (tsres.tv_sec != 0) {
+ printf("Clock resolution in seconds, not nsecs. Exiting.\n");
+ return PTS_UNRESOLVED;
+ }
+
its.it_interval.tv_sec = 0;
- its.it_interval.tv_nsec = INTERVALNSEC;
+ its.it_interval.tv_nsec = tsres.tv_nsec;
its.it_value.tv_sec = 0;
its.it_value.tv_nsec = VALUENSEC;
@@ -75,7 +86,7 @@ int main()
return PTS_UNRESOLVED;
}
- ts.tv_nsec = VALUENSEC + ((EXPECTEDOVERRUNS)*INTERVALNSEC);
+ ts.tv_nsec = VALUENSEC + ((EXPECTEDOVERRUNS) * its.it_interval.tv_nsec);
ts.tv_sec = 0;
if (nanosleep(&ts, NULL) != 0) {
perror("nanosleep() did not return success\n");
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list