[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 19/32] tests: ptimer: Replace 10000 with 1
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PULL 19/32] tests: ptimer: Replace 10000 with 1 |
Date: |
Mon, 24 Oct 2016 18:25:15 +0100 |
From: Dmitry Osipenko <address@hidden>
The 10000 is an arbitrarily chosen value used for advancing the QEMU
time, so that ptimer's now != last. Change it to 1 to make code a bit
more readable.
Signed-off-by: Dmitry Osipenko <address@hidden>
Message-id: address@hidden
Reviewed-by: Peter Maydell <address@hidden>
Signed-off-by: Peter Maydell <address@hidden>
---
tests/ptimer-test.c | 56 ++++++++++++++++++++++++++---------------------------
1 file changed, 28 insertions(+), 28 deletions(-)
diff --git a/tests/ptimer-test.c b/tests/ptimer-test.c
index 47fccd3..b36a476 100644
--- a/tests/ptimer-test.c
+++ b/tests/ptimer-test.c
@@ -107,7 +107,7 @@ static void check_oneshot(gconstpointer arg)
ptimer_set_count(ptimer, 10);
ptimer_run(ptimer, 1);
- qemu_clock_step(2000000 * 2 + 100000);
+ qemu_clock_step(2000000 * 2 + 1);
g_assert_cmpuint(ptimer_get_count(ptimer), ==, no_round_down ? 8 : 7);
g_assert_false(triggered);
@@ -124,7 +124,7 @@ static void check_oneshot(gconstpointer arg)
ptimer_run(ptimer, 1);
- qemu_clock_step(2000000 * 7 + 100000);
+ qemu_clock_step(2000000 * 7 + 1);
g_assert_cmpuint(ptimer_get_count(ptimer), ==, no_round_down ? 1 : 0);
@@ -155,28 +155,28 @@ static void check_oneshot(gconstpointer arg)
ptimer_set_count(ptimer, 10);
- qemu_clock_step(20000000 + 100000);
+ qemu_clock_step(20000000 + 1);
g_assert_cmpuint(ptimer_get_count(ptimer), ==, 10);
g_assert_false(triggered);
ptimer_set_limit(ptimer, 9, 1);
- qemu_clock_step(20000000 + 100000);
+ qemu_clock_step(20000000 + 1);
g_assert_cmpuint(ptimer_get_count(ptimer), ==, 9);
g_assert_false(triggered);
ptimer_run(ptimer, 1);
- qemu_clock_step(2000000 + 100000);
+ qemu_clock_step(2000000 + 1);
g_assert_cmpuint(ptimer_get_count(ptimer), ==, no_round_down ? 8 : 7);
g_assert_false(triggered);
ptimer_set_count(ptimer, 20);
- qemu_clock_step(2000000 * 19 + 100000);
+ qemu_clock_step(2000000 * 19 + 1);
g_assert_cmpuint(ptimer_get_count(ptimer), ==, no_round_down ? 1 : 0);
g_assert_false(triggered);
@@ -190,7 +190,7 @@ static void check_oneshot(gconstpointer arg)
triggered = false;
- qemu_clock_step(2000000 * 12 + 100000);
+ qemu_clock_step(2000000 * 12 + 1);
g_assert_cmpuint(ptimer_get_count(ptimer), ==, 0);
g_assert_false(triggered);
@@ -215,17 +215,17 @@ static void check_periodic(gconstpointer arg)
g_assert_cmpuint(ptimer_get_count(ptimer), ==, 10);
g_assert_false(triggered);
- qemu_clock_step(100000);
+ qemu_clock_step(1);
g_assert_cmpuint(ptimer_get_count(ptimer), ==, no_round_down ? 10 : 9);
g_assert_false(triggered);
- qemu_clock_step(2000000 * 10 - 100000);
+ qemu_clock_step(2000000 * 10 - 1);
g_assert_cmpuint(ptimer_get_count(ptimer), ==, wrap_policy ? 0 : 10);
g_assert_true(triggered);
- qemu_clock_step(100000);
+ qemu_clock_step(1);
g_assert_cmpuint(ptimer_get_count(ptimer), ==,
wrap_policy ? 0 : (no_round_down ? 10 : 9));
@@ -244,12 +244,12 @@ static void check_periodic(gconstpointer arg)
g_assert_cmpuint(ptimer_get_count(ptimer), ==, 20);
g_assert_false(triggered);
- qemu_clock_step(100000);
+ qemu_clock_step(1);
g_assert_cmpuint(ptimer_get_count(ptimer), ==, no_round_down ? 20 : 19);
g_assert_false(triggered);
- qemu_clock_step(2000000 * 11 + 100000);
+ qemu_clock_step(2000000 * 11 + 1);
g_assert_cmpuint(ptimer_get_count(ptimer), ==, no_round_down ? 9 : 8);
g_assert_false(triggered);
@@ -267,7 +267,7 @@ static void check_periodic(gconstpointer arg)
g_assert_cmpuint(ptimer_get_count(ptimer), ==, 3);
g_assert_false(triggered);
- qemu_clock_step(100000);
+ qemu_clock_step(1);
g_assert_cmpuint(ptimer_get_count(ptimer), ==, no_round_down ? 3 : 2);
g_assert_false(triggered);
@@ -290,7 +290,7 @@ static void check_periodic(gconstpointer arg)
ptimer_set_count(ptimer, 3);
ptimer_run(ptimer, 0);
- qemu_clock_step(2000000 * 3 + 100000);
+ qemu_clock_step(2000000 * 3 + 1);
g_assert_cmpuint(ptimer_get_count(ptimer), ==,
wrap_policy ? 0 : (no_round_down ? 10 : 9));
@@ -316,7 +316,7 @@ static void check_periodic(gconstpointer arg)
triggered = false;
- qemu_clock_step(100000);
+ qemu_clock_step(1);
if (no_immediate_reload) {
g_assert_cmpuint(ptimer_get_count(ptimer), ==, 0);
@@ -355,7 +355,7 @@ static void check_periodic(gconstpointer arg)
ptimer_run(ptimer, 0);
ptimer_set_period(ptimer, 0);
- qemu_clock_step(2000000 + 100000);
+ qemu_clock_step(2000000 + 1);
g_assert_cmpuint(ptimer_get_count(ptimer), ==,
(no_round_down ? 8 : 7) + (wrap_policy ? 1 : 0));
@@ -376,7 +376,7 @@ static void check_on_the_fly_mode_change(gconstpointer arg)
ptimer_set_limit(ptimer, 10, 1);
ptimer_run(ptimer, 1);
- qemu_clock_step(2000000 * 9 + 100000);
+ qemu_clock_step(2000000 * 9 + 1);
g_assert_cmpuint(ptimer_get_count(ptimer), ==, no_round_down ? 1 : 0);
g_assert_false(triggered);
@@ -421,7 +421,7 @@ static void check_on_the_fly_period_change(gconstpointer
arg)
ptimer_set_limit(ptimer, 8, 1);
ptimer_run(ptimer, 1);
- qemu_clock_step(2000000 * 4 + 100000);
+ qemu_clock_step(2000000 * 4 + 1);
g_assert_cmpuint(ptimer_get_count(ptimer), ==, no_round_down ? 4 : 3);
g_assert_false(triggered);
@@ -429,7 +429,7 @@ static void check_on_the_fly_period_change(gconstpointer
arg)
ptimer_set_period(ptimer, 4000000);
g_assert_cmpuint(ptimer_get_count(ptimer), ==, no_round_down ? 4 : 3);
- qemu_clock_step(4000000 * 2 + 100000);
+ qemu_clock_step(4000000 * 2 + 1);
g_assert_cmpuint(ptimer_get_count(ptimer), ==, no_round_down ? 2 : 0);
g_assert_false(triggered);
@@ -453,7 +453,7 @@ static void check_on_the_fly_freq_change(gconstpointer arg)
ptimer_set_limit(ptimer, 8, 1);
ptimer_run(ptimer, 1);
- qemu_clock_step(2000000 * 4 + 100000);
+ qemu_clock_step(2000000 * 4 + 1);
g_assert_cmpuint(ptimer_get_count(ptimer), ==, no_round_down ? 4 : 3);
g_assert_false(triggered);
@@ -461,7 +461,7 @@ static void check_on_the_fly_freq_change(gconstpointer arg)
ptimer_set_freq(ptimer, 250);
g_assert_cmpuint(ptimer_get_count(ptimer), ==, no_round_down ? 4 : 3);
- qemu_clock_step(2000000 * 4 + 100000);
+ qemu_clock_step(2000000 * 4 + 1);
g_assert_cmpuint(ptimer_get_count(ptimer), ==, no_round_down ? 2 : 0);
g_assert_false(triggered);
@@ -516,7 +516,7 @@ static void check_run_with_delta_0(gconstpointer arg)
triggered = false;
if (no_immediate_trigger || no_immediate_reload) {
- qemu_clock_step(2000000 + 100000);
+ qemu_clock_step(2000000 + 1);
g_assert_cmpuint(ptimer_get_count(ptimer), ==,
no_immediate_reload ? 0 : (no_round_down ? 98 : 97));
@@ -533,7 +533,7 @@ static void check_run_with_delta_0(gconstpointer arg)
ptimer_run(ptimer, 1);
}
- qemu_clock_step(2000000 + 100000);
+ qemu_clock_step(2000000 + 1);
g_assert_cmpuint(ptimer_get_count(ptimer), ==, no_round_down ? 98 : 97);
g_assert_false(triggered);
@@ -563,7 +563,7 @@ static void check_run_with_delta_0(gconstpointer arg)
triggered = false;
- qemu_clock_step(100000);
+ qemu_clock_step(1);
if (no_immediate_reload) {
qemu_clock_step(2000000);
@@ -616,7 +616,7 @@ static void check_periodic_with_load_0(gconstpointer arg)
triggered = false;
- qemu_clock_step(2000000 + 100000);
+ qemu_clock_step(2000000 + 1);
g_assert_cmpuint(ptimer_get_count(ptimer), ==, 0);
@@ -631,14 +631,14 @@ static void check_periodic_with_load_0(gconstpointer arg)
ptimer_set_count(ptimer, 10);
ptimer_run(ptimer, 0);
- qemu_clock_step(2000000 * 10 + 100000);
+ qemu_clock_step(2000000 * 10 + 1);
g_assert_cmpuint(ptimer_get_count(ptimer), ==, 0);
g_assert_true(triggered);
triggered = false;
- qemu_clock_step(2000000 + 100000);
+ qemu_clock_step(2000000 + 1);
g_assert_cmpuint(ptimer_get_count(ptimer), ==, 0);
@@ -673,7 +673,7 @@ static void check_oneshot_with_load_0(gconstpointer arg)
triggered = false;
- qemu_clock_step(2000000 + 100000);
+ qemu_clock_step(2000000 + 1);
g_assert_cmpuint(ptimer_get_count(ptimer), ==, 0);
--
2.7.4
- [Qemu-devel] [PULL 26/32] timer: stm32f2xx_timer: add check for prescaler value, (continued)
- [Qemu-devel] [PULL 26/32] timer: stm32f2xx_timer: add check for prescaler value, Peter Maydell, 2016/10/24
- [Qemu-devel] [PULL 31/32] target-arm: Implement new HLT trap for semihosting, Peter Maydell, 2016/10/24
- [Qemu-devel] [PULL 18/32] tests: ptimer: Change the copyright comment, Peter Maydell, 2016/10/24
- [Qemu-devel] [PULL 10/32] hw/ptimer: Add "continuous trigger" policy, Peter Maydell, 2016/10/24
- [Qemu-devel] [PULL 21/32] tests: Add tests for the ARM MPTimer, Peter Maydell, 2016/10/24
- [Qemu-devel] [PULL 13/32] tests: ptimer: Add tests for "no immediate trigger" policy, Peter Maydell, 2016/10/24
- [Qemu-devel] [PULL 02/32] exec.c: Remove static allocation of sub_section of sub_page, Peter Maydell, 2016/10/24
- [Qemu-devel] [PULL 28/32] hw/arm: QOM'ify pxa2xx_gpio.c, Peter Maydell, 2016/10/24
- [Qemu-devel] [PULL 08/32] hw/ptimer: Add "wraparound after one period" policy, Peter Maydell, 2016/10/24
- [Qemu-devel] [PULL 05/32] migration/savevm.c: migrate non-default page size, Peter Maydell, 2016/10/24
- [Qemu-devel] [PULL 19/32] tests: ptimer: Replace 10000 with 1,
Peter Maydell <=
- [Qemu-devel] [PULL 17/32] tests: ptimer: Add tests for "no counter round down" policy, Peter Maydell, 2016/10/24
- [Qemu-devel] [PULL 15/32] tests: ptimer: Add tests for "no immediate reload" policy, Peter Maydell, 2016/10/24
- [Qemu-devel] [PULL 32/32] i2c: Add asserts for second smbus i2c_start_transfer(), Peter Maydell, 2016/10/24
- [Qemu-devel] [PULL 09/32] tests: ptimer: Add tests for "wraparound after one period" policy, Peter Maydell, 2016/10/24
- [Qemu-devel] [PULL 04/32] cpu: Support a target CPU having a variable page size, Peter Maydell, 2016/10/24
- [Qemu-devel] [PULL 03/32] translate-all.c: Compute L1 page table properties at runtime, Peter Maydell, 2016/10/24
- Re: [Qemu-devel] [PULL 00/32] target-arm queue, no-reply, 2016/10/24
- Re: [Qemu-devel] [PULL 00/32] target-arm queue, Peter Maydell, 2016/10/25