diff options
author | Tom Tromey <tromey@cygnus.com> | 1999-07-02 15:47:37 +0000 |
---|---|---|
committer | Tom Tromey <tromey@cygnus.com> | 1999-07-02 15:47:37 +0000 |
commit | 126862f37f13b6ac33f6637ab1fa6d2c254e5dca (patch) | |
tree | d6e519523f94a22c7938bc47d7186a2a0e5a4ca3 | |
parent | 857e51b3928c9e492a3960b30c5b9c3aa5af4369 (diff) |
* libjava.lang/Thread_1.out: Updated.
* libjava.lang/Thread_1.java: Don't run exit test.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/libgcj-2_95-branch@27926 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | libjava/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | libjava/testsuite/libjava.lang/Thread_1.java | 185 | ||||
-rw-r--r-- | libjava/testsuite/libjava.lang/Thread_1.out | 10 |
3 files changed, 8 insertions, 192 deletions
diff --git a/libjava/testsuite/ChangeLog b/libjava/testsuite/ChangeLog index f0cd13a3e5e..e04322985ec 100644 --- a/libjava/testsuite/ChangeLog +++ b/libjava/testsuite/ChangeLog @@ -1,3 +1,8 @@ +1999-07-02 Tom Tromey <tromey@cygnus.com> + + * libjava.lang/Thread_1.out: Updated. + * libjava.lang/Thread_1.java: Don't run exit test. + Thu Jul 1 16:22:19 1999 Anthony Green <green@cygnus.com> * libjava.mauve/mauve.exp: Don't stop counting test results diff --git a/libjava/testsuite/libjava.lang/Thread_1.java b/libjava/testsuite/libjava.lang/Thread_1.java index 932afa5dd73..851df630d16 100644 --- a/libjava/testsuite/libjava.lang/Thread_1.java +++ b/libjava/testsuite/libjava.lang/Thread_1.java @@ -1,182 +1,3 @@ -// Various thread tests. - -public class Thread_1 extends Thread -{ - // The group for the workers. - static ThreadGroup subgroup; - - // Which piece of test code to try. - static int test_case; - - // Names of the tests. - static final int JOIN_GOOD = 0; - static final int JOIN_TIMEOUT = 1; - static final int JOIN_INTERRUPTED = 2; - static final int THREAD_EXIT = 3; - - // True if this is normal; false if daemon. - boolean normal; - // The other thread in the test. - Thread_1 other; - // True when the thread has entered run(). - boolean started; - - public void run () - { - try - { - if (normal) - { - System.out.println ("test " + test_case); - // Tell the main thread to start the daemon thread. - synchronized (this) - { - started = true; - notify (); - } - // Now wait for daemon to start. - synchronized (other) - { - while (! other.started) - other.wait (); - } - switch (test_case) - { - case JOIN_GOOD: - other.join (); - System.out.println ("joined"); - break; - case JOIN_TIMEOUT: - other.join (10); - System.out.println (other.isAlive()); - other.join (); - break; - case JOIN_INTERRUPTED: - other.join (); - System.out.println ("joined"); - break; - case THREAD_EXIT: - // Nothing. - break; - - default: - System.out.println ("failure"); - break; - } - } - else - { - // Let the normal thread start first. - synchronized (other) - { - while (! other.started) - other.wait(); - } - // Tell normal thread that we've started. - synchronized (this) - { - started = true; - notify (); - } - switch (test_case) - { - case JOIN_GOOD: - System.out.println ("daemon done"); - break; - case JOIN_TIMEOUT: - sleep (50); - break; - case JOIN_INTERRUPTED: - other.interrupt (); - break; - case THREAD_EXIT: - // Wait for a while. However, don't wait indefinitely - // -- we want this thread to terminate so that the - // process won't hang if there is a bug. - sleep (10000); - System.out.println ("daemon still alive"); - break; - - default: - System.out.println ("failure"); - break; - } - } - } - catch (InterruptedException e) - { - System.out.println ("interrupted"); - } - } - - public void setOther (Thread_1 x) - { - other = x; - } - - Thread_1 (String name, boolean x) - { - super (subgroup, name); - normal = x; - started = false; - setDaemon (! normal); - } - - // Run a single test. - static Thread_1 doit (int what) - { - // FIXME: we used to just use the same threads each time. That - // didn't work -- must debug. - Thread_1 dt = new Thread_1 ("daemon", false); - Thread_1 nt = new Thread_1 ("normal", true); - - dt.setOther(nt); - nt.setOther(dt); - - test_case = what; - try - { - nt.start(); - dt.start(); - - // Don't wait for the threads if we're doing the exit test. - if (what != THREAD_EXIT) - { - nt.join (); - dt.join (); - } - } - catch (InterruptedException e) - { - System.out.println ("caught bad exception"); - } - - return dt; - } - - public static void main (String[] args) - { - subgroup = new ThreadGroup ("sub"); - - doit (JOIN_GOOD); - - System.out.println ("active count = " + subgroup.activeCount ()); - - Thread_1 dt = doit (JOIN_TIMEOUT); - // Make sure that joining a dead thread works. - System.out.println ("still alive: " + dt.isAlive ()); - try - { - dt.join (); - } - catch (InterruptedException e) - { - System.out.println ("exception caught"); - } - - doit (JOIN_INTERRUPTED); - - // This test must come last. - doit (THREAD_EXIT); - } -} + // Note: this test has a race conditoin. So we don't run it any + // more. + // doit (THREAD_EXIT); diff --git a/libjava/testsuite/libjava.lang/Thread_1.out b/libjava/testsuite/libjava.lang/Thread_1.out index 1bd7a0124d9..e69de29bb2d 100644 --- a/libjava/testsuite/libjava.lang/Thread_1.out +++ b/libjava/testsuite/libjava.lang/Thread_1.out @@ -1,10 +0,0 @@ -test 0 -daemon done -joined -active count = 2 -test 1 -true -still alive: false -test 2 -interrupted -test 3 |