qemu-arm.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Osipenko <digetx@gmail.com>
To: QEMU Developers <qemu-devel@nongnu.org>, qemu-arm@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Peter Crosthwaite <crosthwaitepeter@gmail.com>
Subject: [Qemu-devel] [PATCH v17 04/14] tests: ptimer: Add tests for "continuous trigger" policy
Date: Sun,  2 Oct 2016 18:53:36 +0300	[thread overview]
Message-ID: <7a908ab38b902d521eb959941f9efe2df8ce4297.1475421224.git.digetx@gmail.com> (raw)
In-Reply-To: <cover.1475421224.git.digetx@gmail.com>
In-Reply-To: <cover.1475421224.git.digetx@gmail.com>

PTIMER_POLICY_CONTINUOUS_TRIGGER makes periodic ptimer to re-trigger every
period in case of load = delta = 0.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 tests/ptimer-test.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/tests/ptimer-test.c b/tests/ptimer-test.c
index b95958f..dd4b1a1 100644
--- a/tests/ptimer-test.c
+++ b/tests/ptimer-test.c
@@ -503,6 +503,7 @@ static void check_periodic_with_load_0(gconstpointer arg)
     const uint8_t *policy = arg;
     QEMUBH *bh = qemu_bh_new(ptimer_trigger, NULL);
     ptimer_state *ptimer = ptimer_init(bh, *policy);
+    bool continuous_trigger = (*policy & PTIMER_POLICY_CONTINUOUS_TRIGGER);
 
     triggered = false;
 
@@ -517,7 +518,12 @@ static void check_periodic_with_load_0(gconstpointer arg)
     qemu_clock_step(2000000 + 100000);
 
     g_assert_cmpuint(ptimer_get_count(ptimer), ==, 0);
-    g_assert_false(triggered);
+
+    if (continuous_trigger) {
+        g_assert_true(triggered);
+    } else {
+        g_assert_false(triggered);
+    }
 
     triggered = false;
 
@@ -534,7 +540,12 @@ static void check_periodic_with_load_0(gconstpointer arg)
     qemu_clock_step(2000000 + 100000);
 
     g_assert_cmpuint(ptimer_get_count(ptimer), ==, 0);
-    g_assert_false(triggered);
+
+    if (continuous_trigger) {
+        g_assert_true(triggered);
+    } else {
+        g_assert_false(triggered);
+    }
 
     ptimer_stop(ptimer);
 }
@@ -576,6 +587,10 @@ static void add_ptimer_tests(uint8_t policy)
         g_strlcat(policy_name, "wrap_after_one_period,", 256);
     }
 
+    if (policy & PTIMER_POLICY_CONTINUOUS_TRIGGER) {
+        g_strlcat(policy_name, "continuous_trigger,", 256);
+    }
+
     g_test_add_data_func(
         g_strdup_printf("/ptimer/set_count policy=%s", policy_name),
         ppolicy, check_set_count);
@@ -623,7 +638,7 @@ static void add_ptimer_tests(uint8_t policy)
 
 static void add_all_ptimer_policies_comb_tests(void)
 {
-    int last_policy = PTIMER_POLICY_WRAP_AFTER_ONE_PERIOD;
+    int last_policy = PTIMER_POLICY_CONTINUOUS_TRIGGER;
     int policy = PTIMER_POLICY_DEFAULT;
 
     for (; policy < (last_policy << 1); policy++) {
-- 
2.9.3


  parent reply	other threads:[~2016-10-02 16:08 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-02 15:53 [Qemu-arm] [PATCH v17 00/14] PTimer fixes/features and ARM MPTimer conversion Dmitry Osipenko
2016-10-02 15:53 ` [Qemu-arm] [PATCH v17 01/14] hw/ptimer: Add "wraparound after one period" policy Dmitry Osipenko
2016-10-02 15:53 ` [Qemu-devel] [PATCH v17 02/14] tests: ptimer: Add tests for " Dmitry Osipenko
2016-10-02 15:53 ` [Qemu-devel] [PATCH v17 03/14] hw/ptimer: Add "continuous trigger" policy Dmitry Osipenko
2016-10-02 15:53 ` Dmitry Osipenko [this message]
2016-10-02 15:53 ` [Qemu-devel] [PATCH v17 05/14] hw/ptimer: Add "no immediate " Dmitry Osipenko
2016-10-02 15:53 ` [Qemu-devel] [PATCH v17 06/14] tests: ptimer: Add tests for " Dmitry Osipenko
2016-10-02 15:53 ` [Qemu-arm] [PATCH v17 07/14] hw/ptimer: Add "no immediate reload" policy Dmitry Osipenko
2016-10-02 15:53 ` [Qemu-devel] [PATCH v17 08/14] tests: ptimer: Add tests for " Dmitry Osipenko
2016-10-02 15:53 ` [Qemu-devel] [PATCH v17 09/14] hw/ptimer: Add "no counter round down" policy Dmitry Osipenko
2016-10-02 15:53 ` [Qemu-devel] [PATCH v17 10/14] tests: ptimer: Add tests for " Dmitry Osipenko
2016-10-02 15:53 ` [Qemu-devel] [PATCH v17 11/14] tests: ptimer: Change the copyright comment Dmitry Osipenko
2016-10-02 15:53 ` [Qemu-devel] [PATCH v17 12/14] tests: ptimer: Replace 10000 with 1 Dmitry Osipenko
2016-10-02 15:53 ` [Qemu-devel] [PATCH v17 13/14] arm_mptimer: Convert to use ptimer Dmitry Osipenko
2016-10-02 15:53 ` [Qemu-arm] [PATCH v17 14/14] tests: Add tests for the ARM MPTimer Dmitry Osipenko
2016-10-24 12:23 ` [Qemu-arm] [PATCH v17 00/14] PTimer fixes/features and ARM MPTimer conversion Peter Maydell
2016-10-24 18:19   ` Dmitry Osipenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7a908ab38b902d521eb959941f9efe2df8ce4297.1475421224.git.digetx@gmail.com \
    --to=digetx@gmail.com \
    --cc=crosthwaitepeter@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).