fixeria has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/43103?usp=email )

Change subject: tests: speed up InterthreadTest by shrinking the fuzz sleep
......................................................................

tests: speed up InterthreadTest by shrinking the fuzz sleep

qWriter()/mapWriter() each had a 50% chance per iteration (20
iterations) of sleep(1), making the test take up to ~13s just to
exercise thread interleaving. The delay only needs to be long enough
to encourage preemption, not a full second.

Change-Id: Id6bc453f9217ae392dcd3288dfa6784c533f8eb6
---
M tests/CommonLibs/InterthreadTest.cpp
1 file changed, 3 insertions(+), 2 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved




diff --git a/tests/CommonLibs/InterthreadTest.cpp 
b/tests/CommonLibs/InterthreadTest.cpp
index a00980f..523a5bd 100644
--- a/tests/CommonLibs/InterthreadTest.cpp
+++ b/tests/CommonLibs/InterthreadTest.cpp
@@ -30,6 +30,7 @@
 #include "Interthread.h"
 #include <iostream>
 #include <mutex>
+#include <unistd.h>

 std::mutex dbg_cout;

@@ -52,7 +53,7 @@
                CERR("queue write " << *p);
                gQ.write(p);
                q_last_write_val = i;
-               if (random()%2) sleep(1);
+               if (random()%2) usleep(1000);
        }
        p = new int;
        *p = -1;
@@ -88,7 +89,7 @@
                CERR("map write " << *p);
                gMap.write(i,p);
                m_last_write_val = i;
-               if (random()%2) sleep(1);
+               if (random()%2) usleep(1000);
        }
        return NULL;
 }

--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43103?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: Id6bc453f9217ae392dcd3288dfa6784c533f8eb6
Gerrit-Change-Number: 43103
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to