mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-03 18:13:01 +00:00
memcheck/tests/linux/timerfd-syscall: send output to stderr instead of stdout.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11366
This commit is contained in:
parent
ecb0c51747
commit
e7b5c2eb6e
@ -153,7 +153,7 @@ long waittmr(int tfd, int timeo)
|
||||
}
|
||||
if ((pfd.revents & POLLIN) == 0)
|
||||
{
|
||||
fprintf(stdout, "no ticks happened\n");
|
||||
fprintf(stderr, "no ticks happened\n");
|
||||
return -1;
|
||||
}
|
||||
if (read(tfd, &ticks, sizeof(ticks)) != sizeof(ticks))
|
||||
@ -182,11 +182,11 @@ int main(int ac, char **av)
|
||||
|
||||
for (i = 0; i < sizeof(clks) / sizeof(clks[0]); i++)
|
||||
{
|
||||
fprintf(stdout, "\n\n---------------------------------------\n");
|
||||
fprintf(stdout, "| testing %s\n", clks[i].name);
|
||||
fprintf(stdout, "---------------------------------------\n\n");
|
||||
fprintf(stderr, "\n\n---------------------------------------\n");
|
||||
fprintf(stderr, "| testing %s\n", clks[i].name);
|
||||
fprintf(stderr, "---------------------------------------\n\n");
|
||||
|
||||
fprintf(stdout, "relative timer test (at 500 ms) ...\n");
|
||||
fprintf(stderr, "relative timer test (at 500 ms) ...\n");
|
||||
set_timespec(&tmr.it_value, 500 * 1000);
|
||||
set_timespec(&tmr.it_interval, 0);
|
||||
tnow = getustime(clks[i].id);
|
||||
@ -202,17 +202,17 @@ int main(int ac, char **av)
|
||||
return 1;
|
||||
}
|
||||
|
||||
fprintf(stdout, "wating timer ...\n");
|
||||
fprintf(stderr, "wating timer ...\n");
|
||||
ticks = waittmr(tfd, -1);
|
||||
ttmr = getustime(clks[i].id);
|
||||
if (ticks <= 0)
|
||||
fprintf(stdout, "whooops! no timer showed up!\n");
|
||||
fprintf(stderr, "whooops! no timer showed up!\n");
|
||||
else
|
||||
fprintf(stdout, "got timer ticks (%ld) after %.1f s\n",
|
||||
fprintf(stderr, "got timer ticks (%ld) after %.1f s\n",
|
||||
ticks, (ttmr - tnow) * 1e-6);
|
||||
|
||||
|
||||
fprintf(stdout, "absolute timer test (at 500 ms) ...\n");
|
||||
fprintf(stderr, "absolute timer test (at 500 ms) ...\n");
|
||||
tnow = getustime(clks[i].id);
|
||||
set_timespec(&tmr.it_value, tnow + 500 * 1000);
|
||||
set_timespec(&tmr.it_interval, 0);
|
||||
@ -222,16 +222,16 @@ int main(int ac, char **av)
|
||||
return 1;
|
||||
}
|
||||
|
||||
fprintf(stdout, "wating timer ...\n");
|
||||
fprintf(stderr, "wating timer ...\n");
|
||||
ticks = waittmr(tfd, -1);
|
||||
ttmr = getustime(clks[i].id);
|
||||
if (ticks <= 0)
|
||||
fprintf(stdout, "whooops! no timer showed up!\n");
|
||||
fprintf(stderr, "whooops! no timer showed up!\n");
|
||||
else
|
||||
fprintf(stdout, "got timer ticks (%ld) after %.1f s\n",
|
||||
fprintf(stderr, "got timer ticks (%ld) after %.1f s\n",
|
||||
ticks, (ttmr - tnow) * 1e-6);
|
||||
|
||||
fprintf(stdout, "sequential timer test (100 ms clock) ...\n");
|
||||
fprintf(stderr, "sequential timer test (100 ms clock) ...\n");
|
||||
tnow = getustime(clks[i].id);
|
||||
set_timespec(&tmr.it_value, tnow + 100 * 1000);
|
||||
set_timespec(&tmr.it_interval, 100 * 1000);
|
||||
@ -241,31 +241,31 @@ int main(int ac, char **av)
|
||||
return 1;
|
||||
}
|
||||
|
||||
fprintf(stdout, "sleeping one second ...\n");
|
||||
fprintf(stderr, "sleeping one second ...\n");
|
||||
sleep(1);
|
||||
if (timerfd_gettime(tfd, &tmr))
|
||||
{
|
||||
perror("timerfd_gettime");
|
||||
return 1;
|
||||
}
|
||||
fprintf(stdout, "timerfd_gettime returned:\n"
|
||||
fprintf(stderr, "timerfd_gettime returned:\n"
|
||||
"\tit_value = %.1f it_interval = %.1f\n",
|
||||
tmr.it_value.tv_sec + 1e-9 * tmr.it_value.tv_nsec,
|
||||
tmr.it_interval.tv_sec + 1e-9 * tmr.it_interval.tv_nsec);
|
||||
fprintf(stdout, "sleeping 1 second ...\n");
|
||||
fprintf(stderr, "sleeping 1 second ...\n");
|
||||
sleep(1);
|
||||
|
||||
fprintf(stdout, "wating timer ...\n");
|
||||
fprintf(stderr, "wating timer ...\n");
|
||||
ticks = waittmr(tfd, -1);
|
||||
ttmr = getustime(clks[i].id);
|
||||
if (ticks <= 0)
|
||||
fprintf(stdout, "whooops! no timer showed up!\n");
|
||||
fprintf(stderr, "whooops! no timer showed up!\n");
|
||||
else
|
||||
fprintf(stdout, "got timer ticks (%ld) after %.1f s\n",
|
||||
fprintf(stderr, "got timer ticks (%ld) after %.1f s\n",
|
||||
ticks, (ttmr - tnow) * 1e-6);
|
||||
|
||||
|
||||
fprintf(stdout, "O_NONBLOCK test ...\n");
|
||||
fprintf(stderr, "O_NONBLOCK test ...\n");
|
||||
tnow = getustime(clks[i].id);
|
||||
set_timespec(&tmr.it_value, 100 * 1000);
|
||||
set_timespec(&tmr.it_interval, 0);
|
||||
@ -275,27 +275,27 @@ int main(int ac, char **av)
|
||||
return 1;
|
||||
}
|
||||
#if 0
|
||||
fprintf(stdout, "timerfd = %d\n", tfd);
|
||||
fprintf(stderr, "timerfd = %d\n", tfd);
|
||||
#endif
|
||||
|
||||
fprintf(stdout, "wating timer (flush the single tick) ...\n");
|
||||
fprintf(stderr, "wating timer (flush the single tick) ...\n");
|
||||
ticks = waittmr(tfd, -1);
|
||||
ttmr = getustime(clks[i].id);
|
||||
if (ticks <= 0)
|
||||
fprintf(stdout, "whooops! no timer showed up!\n");
|
||||
fprintf(stderr, "whooops! no timer showed up!\n");
|
||||
else
|
||||
fprintf(stdout, "got timer ticks (%ld) after %.1f s\n",
|
||||
fprintf(stderr, "got timer ticks (%ld) after %.1f s\n",
|
||||
ticks, (ttmr - tnow) * 1e-6);
|
||||
|
||||
fcntl(tfd, F_SETFL, fcntl(tfd, F_GETFL, 0) | O_NONBLOCK);
|
||||
|
||||
if (read(tfd, &uticks, sizeof(uticks)) > 0)
|
||||
fprintf(stdout, "whooops! timer ticks not zero when should have been\n");
|
||||
fprintf(stderr, "whooops! timer ticks not zero when should have been\n");
|
||||
else if (errno != EAGAIN)
|
||||
fprintf(stdout, "whooops! bad errno value (%d = '%s')!\n",
|
||||
fprintf(stderr, "whooops! bad errno value (%d = '%s')!\n",
|
||||
errno, strerror(errno));
|
||||
else
|
||||
fprintf(stdout, "success\n");
|
||||
fprintf(stderr, "success\n");
|
||||
|
||||
fcntl(tfd, F_SETFL, fcntl(tfd, F_GETFL, 0) & ~O_NONBLOCK);
|
||||
|
||||
|
||||
@ -1,5 +1,51 @@
|
||||
|
||||
|
||||
|
||||
---------------------------------------
|
||||
| testing CLOCK MONOTONIC
|
||||
---------------------------------------
|
||||
|
||||
relative timer test (at 500 ms) ...
|
||||
wating timer ...
|
||||
got timer ticks (1) after 0.5 s
|
||||
absolute timer test (at 500 ms) ...
|
||||
wating timer ...
|
||||
got timer ticks (1) after 0.5 s
|
||||
sequential timer test (100 ms clock) ...
|
||||
sleeping one second ...
|
||||
timerfd_gettime returned:
|
||||
it_value = 0.1 it_interval = 0.1
|
||||
sleeping 1 second ...
|
||||
wating timer ...
|
||||
got timer ticks (20) after 2.0 s
|
||||
O_NONBLOCK test ...
|
||||
wating timer (flush the single tick) ...
|
||||
got timer ticks (1) after 0.1 s
|
||||
success
|
||||
|
||||
|
||||
---------------------------------------
|
||||
| testing CLOCK REALTIME
|
||||
---------------------------------------
|
||||
|
||||
relative timer test (at 500 ms) ...
|
||||
wating timer ...
|
||||
got timer ticks (1) after 0.5 s
|
||||
absolute timer test (at 500 ms) ...
|
||||
wating timer ...
|
||||
got timer ticks (1) after 0.5 s
|
||||
sequential timer test (100 ms clock) ...
|
||||
sleeping one second ...
|
||||
timerfd_gettime returned:
|
||||
it_value = 0.1 it_interval = 0.1
|
||||
sleeping 1 second ...
|
||||
wating timer ...
|
||||
got timer ticks (20) after 2.0 s
|
||||
O_NONBLOCK test ...
|
||||
wating timer (flush the single tick) ...
|
||||
got timer ticks (1) after 0.1 s
|
||||
success
|
||||
|
||||
HEAP SUMMARY:
|
||||
in use at exit: 0 bytes in 0 blocks
|
||||
total heap usage: 0 allocs, 0 frees, 0 bytes allocated
|
||||
|
||||
@ -1,46 +0,0 @@
|
||||
|
||||
|
||||
---------------------------------------
|
||||
| testing CLOCK MONOTONIC
|
||||
---------------------------------------
|
||||
|
||||
relative timer test (at 500 ms) ...
|
||||
wating timer ...
|
||||
got timer ticks (1) after 0.5 s
|
||||
absolute timer test (at 500 ms) ...
|
||||
wating timer ...
|
||||
got timer ticks (1) after 0.5 s
|
||||
sequential timer test (100 ms clock) ...
|
||||
sleeping one second ...
|
||||
timerfd_gettime returned:
|
||||
it_value = 0.1 it_interval = 0.1
|
||||
sleeping 1 second ...
|
||||
wating timer ...
|
||||
got timer ticks (20) after 2.0 s
|
||||
O_NONBLOCK test ...
|
||||
wating timer (flush the single tick) ...
|
||||
got timer ticks (1) after 0.1 s
|
||||
success
|
||||
|
||||
|
||||
---------------------------------------
|
||||
| testing CLOCK REALTIME
|
||||
---------------------------------------
|
||||
|
||||
relative timer test (at 500 ms) ...
|
||||
wating timer ...
|
||||
got timer ticks (1) after 0.5 s
|
||||
absolute timer test (at 500 ms) ...
|
||||
wating timer ...
|
||||
got timer ticks (1) after 0.5 s
|
||||
sequential timer test (100 ms clock) ...
|
||||
sleeping one second ...
|
||||
timerfd_gettime returned:
|
||||
it_value = 0.1 it_interval = 0.1
|
||||
sleeping 1 second ...
|
||||
wating timer ...
|
||||
got timer ticks (20) after 2.0 s
|
||||
O_NONBLOCK test ...
|
||||
wating timer (flush the single tick) ...
|
||||
got timer ticks (1) after 0.1 s
|
||||
success
|
||||
Loading…
x
Reference in New Issue
Block a user