jrtom/jung

[jung-algorithm]: Flaky results from minimum spanning tree implementation.

Closed this issue · 0 comments

In TestMinimumSpanningTree", testDAGproduces flaky results that failed the Nondex test. Specifically, assertEquals(graph.edges(), mst.edges());` is indeterministic and and fails occasionally. A possible fix would be
to change data structures to deterministic ones in the mst implementation.

Here is one of the bug report generated by the Nondex test: (all failures come from the same line of code)

Results :

Failed tests:   testDAG(edu.uci.ics.jung.algorithms.shortestpath.TestMinimumSpanningTree): expected:<[0, 1]> but was:<[]>

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0

INFO: Surefire failed when running tests for yK9tofntn8W0FBUjSzlWEkeeZ+qWFkXW+I8mhwbvb7M=
INFO: Adding excluded groups to newly created one
INFO: Creating new argline for Surefire
CONFIG: nondexFilter=.*
nondexMode=FULL
nondexSeed=1016066
nondexStart=0
nondexEnd=9223372036854775807
nondexPrintstack=false
nondexDir=/home/shiyul3/myFix/jung/jung-algorithms/.nondex
nondexJarDir=/home/shiyul3/myFix/jung/jung-algorithms/.nondex
nondexExecid=GTe7xXta62Ld4WZGJfXJ4MDtyuHMfuT9dQlm4B6w49Q=
nondexLogging=CONFIG
test=
[INFO] Surefire report directory: /home/shiyul3/myFix/jung/jung-algorithms/.nondex/GTe7xXta62Ld4WZGJfXJ4MDtyuHMfuT9dQlm4B6w49Q=

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Concurrency config is parallel='none', perCoreThreadCount=true, threadCount=2, useUnlimitedThreads=false
Running edu.uci.ics.jung.algorithms.shortestpath.TestMinimumSpanningTree
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.103 sec <<< FAILURE!
testDAG(edu.uci.ics.jung.algorithms.shortestpath.TestMinimumSpanningTree)  Time elapsed: 0.002 sec  <<< FAILURE!
junit.framework.AssertionFailedError: expected:<[0, 1]> but was:<[0]>
        at junit.framework.Assert.fail(Assert.java:57)
        at junit.framework.Assert.failNotEquals(Assert.java:329)
        at junit.framework.Assert.assertEquals(Assert.java:78)
        at junit.framework.Assert.assertEquals(Assert.java:86)
        at junit.framework.TestCase.assertEquals(TestCase.java:253)
        at edu.uci.ics.jung.algorithms.shortestpath.TestMinimumSpanningTree.testDAG(TestMinimumSpanningTree.java:32)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at junit.framework.TestCase.runTest(TestCase.java:176)
        at junit.framework.TestCase.runBare(TestCase.java:141)
        at junit.framework.TestResult$1.protect(TestResult.java:122)
        at junit.framework.TestResult.runProtected(TestResult.java:142)
        at junit.framework.TestResult.run(TestResult.java:125)
        at junit.framework.TestCase.run(TestCase.java:129)
        at junit.framework.TestSuite.runTest(TestSuite.java:252)
        at junit.framework.TestSuite.run(TestSuite.java:247)
        at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:86)
        at org.junit.runners.Suite.runChild(Suite.java:128)
        at org.junit.runners.Suite.runChild(Suite.java:27)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
        at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:62)
        at org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:139)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
        at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
        at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)