[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 07/19] linux-test: fix set/getitimer returned timer
From: |
Pranith Kumar |
Subject: |
[Qemu-devel] [PATCH 07/19] linux-test: fix set/getitimer returned timer check |
Date: |
Thu, 1 Dec 2016 00:14:21 -0500 |
From: Marc-André Lureau <address@hidden>
The previous value of the timer indicates the time to the next timer
expiration, which is likely not the same as when the timer was set.
Signed-off-by: Marc-André Lureau <address@hidden>
Signed-off-by: Pranith Kumar <address@hidden>
---
tests/tcg/linux-test.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/tests/tcg/linux-test.c b/tests/tcg/linux-test.c
index 65fca30..24fce2b 100644
--- a/tests/tcg/linux-test.c
+++ b/tests/tcg/linux-test.c
@@ -482,9 +482,12 @@ static void test_signal(void)
it.it_value.tv_usec = 10 * 1000;
chk_error(setitimer(ITIMER_REAL, &it, NULL));
chk_error(getitimer(ITIMER_REAL, &oit));
- if (oit.it_value.tv_sec != it.it_value.tv_sec ||
- oit.it_value.tv_usec != it.it_value.tv_usec)
+ if (oit.it_value.tv_sec != it.it_interval.tv_sec ||
+ oit.it_value.tv_usec > it.it_interval.tv_usec ||
+ oit.it_interval.tv_sec != it.it_interval.tv_sec ||
+ oit.it_interval.tv_usec != it.it_interval.tv_usec) {
error("itimer");
+ }
while (alarm_count < 5) {
usleep(10 * 1000);
@@ -497,8 +500,11 @@ static void test_signal(void)
memset(&oit, 0xff, sizeof(oit));
chk_error(setitimer(ITIMER_REAL, &it, &oit));
if (oit.it_value.tv_sec != 0 ||
- oit.it_value.tv_usec != 10 * 1000)
+ oit.it_value.tv_usec > 10 * 1000 ||
+ oit.it_interval.tv_sec != 0 ||
+ oit.it_interval.tv_usec != 10 * 1000) {
error("setitimer");
+ }
/* SIGSEGV test */
act.sa_sigaction = sig_segv;
--
2.10.2
- [Qemu-devel] [PATCH 02/19] linux-user: fix tcg/mmap test, (continued)
- [Qemu-devel] [PATCH 02/19] linux-user: fix tcg/mmap test, Pranith Kumar, 2016/12/01
- [Qemu-devel] [PATCH 01/19] linux-user: fix settime old value location, Pranith Kumar, 2016/12/01
- [Qemu-devel] [PATCH 04/19] tests/tcg: comment unused code, Pranith Kumar, 2016/12/01
- [Qemu-devel] [PATCH 03/19] check-help: add some hint to run a single test, Pranith Kumar, 2016/12/01
- [Qemu-devel] [PATCH 07/19] linux-test: fix set/getitimer returned timer check,
Pranith Kumar <=
- [Qemu-devel] [PATCH 06/19] linux-test: fix build, Pranith Kumar, 2016/12/01
- [Qemu-devel] [PATCH 08/19] Fix test-i386-fprem compilation, Pranith Kumar, 2016/12/01
- [Qemu-devel] [PATCH 09/19] test-i386: modernize vector code v4sf, Pranith Kumar, 2016/12/01
- [Qemu-devel] [PATCH 10/19] tests/tcg: Move arm tests to arch specific folder, Pranith Kumar, 2016/12/01
- [Qemu-devel] [PATCH 12/19] tests/tcg: Add tests-tcg hook in Makefile, Pranith Kumar, 2016/12/01
- [Qemu-devel] [PATCH 14/19] tests/tcg: Move i386 tests to arch specific folder, Pranith Kumar, 2016/12/01
- [Qemu-devel] [PATCH 11/19] tests/tcg: Move mips test to arch specific folder, Pranith Kumar, 2016/12/01
- [Qemu-devel] [PATCH 13/19] tests/tcg/i386: Fix hello-i386 test, Pranith Kumar, 2016/12/01
- [Qemu-devel] [PATCH 16/19] tests/tcg: Fix compilation of linux-test.c, Pranith Kumar, 2016/12/01