Harmony
  1. Harmony
  2. HARMONY-1955

[classlib][luni] org.apache.harmony.luni.tests.java.lang.ThreadGroupTest fails

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Classlib
    • Labels:
      None
    • Estimated Complexity:
      Novice

      Description

      Elena Semukhina wrote at HARMONY-1625:

      2) <testcase classname="org.apache.harmony.luni.tests.java.lang.ThreadGroupTest" name="test_suspend" time="3.86">
      <error message="The thread group Test group is not empty" type="java.lang.IllegalThreadStateException">java.lang.IllegalThreadStateException: The thread group Test group is not empty [...]

      test_suspend fails because it tries to destroy a non-empty group containing suspended threads. I suggest to change the test so that it stops the threads and then destroys the group.

      3) <testcase classname="org.apache.harmony.luni.tests.java.lang.ThreadGroupTest" name="test_list" time="0.213">
      <failure message="Either 'list' is wrong or other tests are leaving side-effects. [...]

      test_list fails because it verifies the length of the output string. The output on drlvm is quite correct but longer than expected. I suggest to change the test so that it checks the output in more smart way.

      See also http://wiki.apache.org/harmony/Unit_Tests_Pass_on_DRLVM

      1. H-1625_ThreadGroupTest.patch
        4 kB
        Elena Semukhina
      2. ThreadGroupTest-1.patch
        0.7 kB
        Andrey Chernyshev

        Activity

        Hide
        Alexei Fedotov added a comment -
        Show
        Alexei Fedotov added a comment - Here is Elena's patch for this issue: http://issues.apache.org/jira/secure/attachment/12343163/H-1625_ThreadGroupTest.patch (ASF granted)
        Hide
        Elena Semukhina added a comment -

        After this patch is applied, ThreadGroupTest.test_suspend() will fail due to HARMONY-1648 (Thread.stop() does not stop suspended waiting threads).

        Show
        Elena Semukhina added a comment - After this patch is applied, ThreadGroupTest.test_suspend() will fail due to HARMONY-1648 (Thread.stop() does not stop suspended waiting threads).
        Hide
        Elena Semukhina added a comment -

        Two more notes.

        1) This issue reports on ThreadGroupTest failures on DRLVM, not IBM VM.
        2) ThreadGroupTest crashes on drlvm on Windows now due to HARMONY-1675 so to reproduce the issue and then verify the patch you should comment out the
        test_uncaughtExceptionLjava_lang_ThreadLjava_lang_Throwable() test.

        Show
        Elena Semukhina added a comment - Two more notes. 1) This issue reports on ThreadGroupTest failures on DRLVM, not IBM VM. 2) ThreadGroupTest crashes on drlvm on Windows now due to HARMONY-1675 so to reproduce the issue and then verify the patch you should comment out the test_uncaughtExceptionLjava_lang_ThreadLjava_lang_Throwable() test.
        Hide
        Alexei Fedotov added a comment -

        Without a patch I see a different behavior for ThreadGroupTest on r472083:

        ...........F........
        Time: 12.504
        There was 1 failure:
        1) test_list(org.apache.harmony.luni.tests.java.lang.ThreadGroupTest)junit.frame
        work.AssertionFailedError: Either 'list' is wrong or other tests are leaving side-effects.
        Result from list:662
        -----------------site/proj/drl/mrt/users/af/ws/1
        java.lang.ThreadGroup[name=main,maxpri=10]
        Thread[Thread-shutdown,5,main]
        Thread[main,5,main]
        java.lang.ThreadGroup[name=activeCount,maxpri=10]
        java.lang.ThreadGroup[name=Test group,maxpri=10]

        -----------------

        at org.apache.harmony.luni.tests.java.lang.ThreadGroupTest.test_list(ThreadGroupTest.java:484)
        at java.lang.reflect.VMReflection.invokeMethod(Native Method)

        FAILURES!!!
        Tests run: 19, Failures: 1, Errors: 0

        Show
        Alexei Fedotov added a comment - Without a patch I see a different behavior for ThreadGroupTest on r472083: ...........F........ Time: 12.504 There was 1 failure: 1) test_list(org.apache.harmony.luni.tests.java.lang.ThreadGroupTest)junit.frame work.AssertionFailedError: Either 'list' is wrong or other tests are leaving side-effects. Result from list:662 -----------------site/proj/drl/mrt/users/af/ws/1 java.lang.ThreadGroup [name=main,maxpri=10] Thread [Thread-shutdown,5,main] Thread [main,5,main] java.lang.ThreadGroup [name=activeCount,maxpri=10] java.lang.ThreadGroup [name=Test group,maxpri=10] ----------------- at org.apache.harmony.luni.tests.java.lang.ThreadGroupTest.test_list(ThreadGroupTest.java:484) at java.lang.reflect.VMReflection.invokeMethod(Native Method) FAILURES!!! Tests run: 19, Failures: 1, Errors: 0
        Hide
        Andrey Chernyshev added a comment -

        This must be fixing the test_list failure - destroys "activeCount" thread group.

        Show
        Andrey Chernyshev added a comment - This must be fixing the test_list failure - destroys "activeCount" thread group.
        Hide
        Andrey Chernyshev added a comment -

        Apparently the test_list failure is caused by the output of the ThreadGroup.list() method which exceeds the limit given by the test. The reason seem to be that ThreadGroup named "activeCount" remains from the previous test_acctiveCount() run. I have attached a trivial patch TestGroupTest-1.patch that adds destroying for the "activeCount" group.

        Show
        Andrey Chernyshev added a comment - Apparently the test_list failure is caused by the output of the ThreadGroup.list() method which exceeds the limit given by the test. The reason seem to be that ThreadGroup named "activeCount" remains from the previous test_acctiveCount() run. I have attached a trivial patch TestGroupTest-1.patch that adds destroying for the "activeCount" group.
        Hide
        Elena Semukhina added a comment -

        I tried the attached patch.
        test_list failed with the output exceeded the limit again because the "main" ThreadGroup contains the threads which the test does not expect to exis there (e.g. Thread[Thread-shutdown,5,main] ).

        I'd suggest that the test_list verifies the expected info in the output rather than its length.
        I attached the H-1625_ThreadGroupTest.patch.
        The patch also adds a clean up to test_acctiveCount() and test_suspend().

        Show
        Elena Semukhina added a comment - I tried the attached patch. test_list failed with the output exceeded the limit again because the "main" ThreadGroup contains the threads which the test does not expect to exis there (e.g. Thread [Thread-shutdown,5,main] ). I'd suggest that the test_list verifies the expected info in the output rather than its length. I attached the H-1625_ThreadGroupTest.patch. The patch also adds a clean up to test_acctiveCount() and test_suspend().
        Hide
        Alexey Varlamov added a comment -

        Applied the H-1625_ThreadGroupTest.patch at r474673.
        Thanks to all!

        Show
        Alexey Varlamov added a comment - Applied the H-1625_ThreadGroupTest.patch at r474673. Thanks to all!

          People

          • Assignee:
            Alexey Varlamov
            Reporter:
            Alexei Fedotov
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development