[ovs-dev,08/21] test-atomic: Bump test duration for multi-thread tests
diff mbox

Message ID 1445228952-22445-8-git-send-email-yamamoto@midokura.com
State Awaiting Upstream
Headers show

Commit Message

Takashi Yamamoto Oct. 19, 2015, 4:28 a.m. UTC
This makes tests pass on on my single-cpu NetBSD-7 VM.

How frequently preemption happens depends on the cpu scheduler.

Signed-off-by: YAMAMOTO Takashi <yamamoto@midokura.com>
---
 tests/test-atomic.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Ben Pfaff Nov. 10, 2015, 3:59 a.m. UTC | #1
On Mon, Oct 19, 2015 at 01:28:59PM +0900, YAMAMOTO Takashi wrote:
> This makes tests pass on on my single-cpu NetBSD-7 VM.
> 
> How frequently preemption happens depends on the cpu scheduler.
> 
> Signed-off-by: YAMAMOTO Takashi <yamamoto@midokura.com>

Acked-by: Ben Pfaff <blp@ovn.org>

Patch
diff mbox

diff --git a/tests/test-atomic.c b/tests/test-atomic.c
index 2af6a26..efc5053 100644
--- a/tests/test-atomic.c
+++ b/tests/test-atomic.c
@@ -185,13 +185,14 @@  static ATOMIC(struct atomic_aux *) paux = ATOMIC_VAR_INIT(NULL);
 static struct atomic_aux *auxes = NULL;
 
 #define ATOMIC_ITEM_COUNT 1000000
+#define	DURATION 5000
 
 static void *
 atomic_consumer(void * arg1 OVS_UNUSED)
 {
     struct atomic_aux *old_aux = NULL;
     uint64_t count;
-    long long int stop_time = time_msec() + 1000;
+    long long int stop_time = time_msec() + DURATION;
 
     do {
         struct atomic_aux *aux;
@@ -263,7 +264,7 @@  atomic_reader(void *aux_)
     uint64_t count;
     uint64_t data;
     long long int now = time_msec();
-    long long int stop_time = now + 1000;
+    long long int stop_time = now + DURATION;
 
     do {
         /* Non-synchronized add. */
@@ -301,7 +302,7 @@  atomic_writer(void *aux_)
     uint64_t data;
     size_t i;
     long long int now = time_msec();
-    long long int stop_time = now + 1000;
+    long long int stop_time = now + DURATION;
 
     for (i = 0; i < ATOMIC_ITEM_COUNT; i++) {
         /* Wait for the reader to be done with the data. */