8269770: nsk tests should start IOPipe channel before launch debuggee - Debugee.prepareDebugee

Reviewed-by: sspitsyn, kevinw
This commit is contained in:
Alex Menkov 2021-08-31 22:43:12 +00:00
parent 9c392d008a
commit 18a731a3e4
3 changed files with 12 additions and 27 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -109,24 +109,8 @@ public class accipp001 extends Log {
logHandler = new Log(out, argsHandler);
Binder binder = new Binder(argsHandler, logHandler);
if (argsHandler.verbose()) {
debugee = binder.bindToDebugee(debugeeName + " -vbs");
} else {
debugee = binder.bindToDebugee(debugeeName);
}
IOPipe pipe = new IOPipe(debugee);
debugee.redirectStderr(out);
debugee.resume();
String line = pipe.readln();
if (!line.equals("ready")) {
logHandler.complain("# Cannot recognize debugee's signal: " + line);
return 2;
};
debugee = Debugee.prepareDebugee(argsHandler, logHandler,
debugeeName + (argsHandler.verbose() ? " -vbs" : ""));
// ReferenceType classes[] = debugee.classes();
// for (int i=0; i<classes.length; i++) {
@ -165,10 +149,8 @@ public class accipp001 extends Log {
return 2;
};
pipe.println("quit");
debugee.waitFor();
int status = debugee.getStatus();
debugee.sendSignal("quit");
int status = debugee.endDebugee();
if (status != 95) {
logHandler.complain("Debugee's exit status=" + status);
return 2;

View File

@ -110,12 +110,16 @@ abstract public class DebugeeProcess extends FinalizableObject {
// --------------------------------------------------- //
/** Created and return new IOPipe channel to the debugee VM. */
/** Create and return new IOPipe channel to the debuggee VM.
* The channel should be created before debuggee starts execution,
* i.e. the method assumes debuggee is started, but suspended before
* its main class is loaded.
*/
public IOPipe createIOPipe() {
if (pipe != null) {
throw new TestBug("IOPipe channel is already created");
}
pipe = new IOPipe(this);
pipe = IOPipe.startDebuggerPipe(binder);
return pipe;
}

View File

@ -84,7 +84,7 @@ public class IOPipe extends SocketIOPipe {
/**
* Creates and starts listening <code>IOPipe</code> at debugger side.
*/
public static IOPipe startDebuggerPipe(Binder binder) {
public static IOPipe startDebuggerPipe(DebugeeBinder binder) {
IOPipe ioPipe = new IOPipe(binder.getLog(),
binder.getArgumentHandler().getDebugeeHost(),
binder.getArgumentHandler().getPipePortNumber(),
@ -95,7 +95,6 @@ public class IOPipe extends SocketIOPipe {
return ioPipe;
}
protected void connect() {
super.connect();
}