[jitsi-dev] [libjitsi] Use fixed Random seed values and condition predicate checking for test consistency. (#77)


#1

Use independent Random instances with fixed seed values for consistency.
Also use the wait form described in JCIP 14.2.2.

Tried a couple of seed values that would still exercise the tests but complete in under a minute on my machine. The modification to the synchronizer, e.g. using wait in a loop with condition predicate being checked as described by Goetz et al in JCIP 14.2.2, might have fixed a bug.

Test consistently passes and in a reasonable amount of time.
You can view, comment on, or merge this pull request online at:

  https://github.com/jitsi/libjitsi/pull/77

-- Commit Summary --

  * Use fixed Random seed values and condition predicate checking for test consistency.

-- File Changes --

    M test/org/jitsi/sctp4j/SctpTransferTest.java (23)
    M test/org/jitsi/sctp4j/TestLink.java (10)

-- Patch Links --

https://github.com/jitsi/libjitsi/pull/77.patch
https://github.com/jitsi/libjitsi/pull/77.diff

···

---
Reply to this email directly or view it on GitHub:
https://github.com/jitsi/libjitsi/pull/77


#2

Can we try the changes in [500c6e9](https://github.com/bickelj/libjitsi/commit/500c6e94c1dbee44ee0784eeb36597d678d5aed5)? The timeout on my machine needed to be increased to above 5 seconds for test passage.

Also let me know what you think about adding a message to the user indicating that the IOExceptions are expected during the test run. The first time I ran these tests I was not sure if those were expected or not.

···

---
Reply to this email directly or view it on GitHub:
https://github.com/jitsi/libjitsi/pull/77#issuecomment-177273304


#3

@@ -43,7 +47,7 @@ public TestLink(SctpSocket a, SctpSocket b,
     public void onConnOut(SctpSocket s, byte[] packet)
         throws IOException
     {
- double r = Math.random();
+ double r = getRandomDouble();

Call rand.nextDouble() directly here.

···

---
Reply to this email directly or view it on GitHub:
https://github.com/jitsi/libjitsi/pull/77/files#r54354479


#4

Can you please squash your commits and fix the [formatting](https://jitsi.org/Documentation/CodeConvention)? When done and unless @paweldomas has further objections I'm ready to merge this.

···

---
Reply to this email directly or view it on GitHub:
https://github.com/jitsi/libjitsi/pull/77#issuecomment-189923828


#5

Did I just ruin this request's comment history? In future should I use a new branch instead of force pushing the existing branch?

···

---
Reply to this email directly or view it on GitHub:
https://github.com/jitsi/libjitsi/pull/77#issuecomment-191019118


#6

Seems like it, even though my lone getDouble() is still there :frowning:
http://forum.imagej.net/t/force-push-a-branch-without-losing-review-comments/1009/2

···

---
Reply to this email directly or view it on GitHub:
https://github.com/jitsi/libjitsi/pull/77#issuecomment-191075996


#7

I force pushed the original branch (to see what would happen) and now the original comments are back. Magical.

Created https://github.com/jitsi/libjitsi/pull/96 as the successor to this PR.

···

---
Reply to this email directly or view it on GitHub:
https://github.com/jitsi/libjitsi/pull/77#issuecomment-191547702


#8

Closed #77.

···

---
Reply to this email directly or view it on GitHub:
https://github.com/jitsi/libjitsi/pull/77#event-575637122