This commit is contained in:
Alejandro Murillo 2015-12-11 17:45:50 -08:00
commit 0a269e99fc
10 changed files with 105 additions and 58 deletions

View File

@ -42,6 +42,7 @@ import com.sun.jdi.request.*;
class SuspendThreadTarg { class SuspendThreadTarg {
public static long count; public static long count;
public static boolean active = true;
public static void bkpt() { public static void bkpt() {
count++; count++;
@ -53,7 +54,7 @@ class SuspendThreadTarg {
// We need this to be running so the bkpt // We need this to be running so the bkpt
// can be hit immediately when it is enabled // can be hit immediately when it is enabled
// in the back-end. // in the back-end.
while(count >= 0) { while(active) {
bkpt(); bkpt();
} }
System.out.println("Goodbye from SuspendThreadTarg, count = " + count); System.out.println("Goodbye from SuspendThreadTarg, count = " + count);
@ -82,9 +83,9 @@ public class SuspendThreadTest extends TestScaffold {
// to guard against spurious wakeups from bkptSignal.wait() // to guard against spurious wakeups from bkptSignal.wait()
boolean signalSent; boolean signalSent;
// signal that a breakpoint has happened // signal that a breakpoint has happened
Object bkptSignal = new Object() {}; final private Object bkptSignal = new Object() {};
BreakpointRequest bkptRequest; BreakpointRequest bkptRequest;
Field debuggeeCountField; Field debuggeeCountField, debuggeeActiveField;
// When we get a bkpt we want to disable the request, // When we get a bkpt we want to disable the request,
// resume the debuggee, and then re-enable the request // resume the debuggee, and then re-enable the request
@ -119,6 +120,7 @@ public class SuspendThreadTest extends TestScaffold {
/********** test core **********/ /********** test core **********/
protected void runTests() throws Exception { protected void runTests() throws Exception {
try {
/* /*
* Get to the top of main() * Get to the top of main()
* to determine targetClass and mainThread * to determine targetClass and mainThread
@ -137,6 +139,7 @@ public class SuspendThreadTest extends TestScaffold {
bkptRequest.enable(); bkptRequest.enable();
debuggeeCountField = targetClass.fieldByName("count"); debuggeeCountField = targetClass.fieldByName("count");
debuggeeActiveField = targetClass.fieldByName("active");
try { try {
addListener (this); addListener (this);
} catch (Exception ex){ } catch (Exception ex){
@ -169,7 +172,6 @@ public class SuspendThreadTest extends TestScaffold {
bkptRequest.disable(); bkptRequest.disable();
removeListener(this); removeListener(this);
/* /*
* deal with results of test * deal with results of test
* if anything has called failure("foo") testFailed will be true * if anything has called failure("foo") testFailed will be true
@ -179,5 +181,10 @@ public class SuspendThreadTest extends TestScaffold {
} else { } else {
throw new Exception("SuspendThreadTest: failed"); throw new Exception("SuspendThreadTest: failed");
} }
} finally {
if (targetClass != null && debuggeeActiveField != null) {
targetClass.setValue(debuggeeActiveField, vm().mirrorOf(false));
}
}
} }
} }

View File

@ -42,7 +42,11 @@ import java.util.Objects;
* multiple times, then the line number won't provide enough context to * multiple times, then the line number won't provide enough context to
* understand the failure. * understand the failure.
* </pre> * </pre>
*
* @deprecated This class is deprecated. Use the one from
* {@code <root>/test/lib/share/classes/jdk/test/lib}
*/ */
@Deprecated
public class Asserts { public class Asserts {
/** /**

View File

@ -27,6 +27,11 @@ import java.io.FileNotFoundException;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
/**
* @deprecated This class is deprecated. Use the one from
* {@code <root>/test/lib/share/classes/jdk/test/lib}
*/
@Deprecated
public final class JDKToolFinder { public final class JDKToolFinder {
private JDKToolFinder() { private JDKToolFinder() {

View File

@ -46,7 +46,10 @@ import java.util.List;
* Process p = pb.start(); * Process p = pb.start();
* } * }
* </pre> * </pre>
* @deprecated This class is deprecated. Use the one from
* {@code <root>/test/lib/share/classes/jdk/test/lib}
*/ */
@Deprecated
public class JDKToolLauncher { public class JDKToolLauncher {
private final String executable; private final String executable;
private final List<String> vmArgs = new ArrayList<String>(); private final List<String> vmArgs = new ArrayList<String>();

View File

@ -33,7 +33,12 @@ import java.util.regex.Pattern;
/** /**
* Utility class for verifying output and exit value from a {@code Process}. * Utility class for verifying output and exit value from a {@code Process}.
*
* @deprecated This class is deprecated. Use the one from
* {@code <root>/test/lib/share/classes/jdk/test/lib/process}
*
*/ */
@Deprecated
public final class OutputAnalyzer { public final class OutputAnalyzer {
private final OutputBuffer output; private final OutputBuffer output;
private final String stdout; private final String stdout;

View File

@ -28,6 +28,11 @@ import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future; import java.util.concurrent.Future;
/**
* @deprecated This class is deprecated. Use the one from
* {@code <root>/test/lib/share/classes/jdk/test/lib/process}
*/
@Deprecated
class OutputBuffer { class OutputBuffer {
private static class OutputBufferException extends RuntimeException { private static class OutputBufferException extends RuntimeException {
private static final long serialVersionUID = 8528687792643129571L; private static final long serialVersionUID = 8528687792643129571L;

View File

@ -27,6 +27,11 @@ import java.io.RandomAccessFile;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
/**
* @deprecated This class is deprecated. Use the one from
* {@code <root>/test/lib/share/classes/jdk/test/lib}
*/
@Deprecated
public class Platform { public class Platform {
private static final String osName = System.getProperty("os.name"); private static final String osName = System.getProperty("os.name");
private static final String dataModel = System.getProperty("sun.arch.data.model"); private static final String dataModel = System.getProperty("sun.arch.data.model");

View File

@ -27,8 +27,6 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.PrintStream; import java.io.PrintStream;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
@ -42,6 +40,12 @@ import java.util.function.Predicate;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/**
* @deprecated This class is deprecated. Use the one from
* {@code <root>/test/lib/share/classes/jdk/test/lib/process}
*/
@Deprecated
public final class ProcessTools { public final class ProcessTools {
private static final class LineForwarder extends StreamPumper.LinePump { private static final class LineForwarder extends StreamPumper.LinePump {
private final PrintStream ps; private final PrintStream ps;

View File

@ -34,6 +34,11 @@ import java.util.concurrent.Future;
import java.util.concurrent.FutureTask; import java.util.concurrent.FutureTask;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
/**
* @deprecated This class is deprecated. Use the one from
* {@code <root>/test/lib/share/classes/jdk/test/lib/process}
*/
@Deprecated
public final class StreamPumper implements Runnable { public final class StreamPumper implements Runnable {
private static final int BUF_SIZE = 256; private static final int BUF_SIZE = 256;

View File

@ -41,7 +41,11 @@ import java.util.function.Function;
/** /**
* Common library for various test helper functions. * Common library for various test helper functions.
*
* @deprecated This class is deprecated. Use the one from
* {@code <root>/test/lib/share/classes/jdk/test/lib}
*/ */
@Deprecated
public final class Utils { public final class Utils {
/** /**