Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JDK19 to test matrix #585

Merged
merged 7 commits into from
Oct 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions .github/workflows/continuous.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,6 @@ jobs:
java-version: 8
- name: Store JAVA_8_HOME
run: JAVA_PATH=$(which java) && echo "JAVA_8_HOME=${JAVA_PATH/\/bin\/java/\/}" >> $GITHUB_ENV
- name: Set up Java 9
uses: actions/setup-java@v1
with:
java-version: 9
- name: Store JAVA_9_HOME
run: JAVA_PATH=$(which java) && echo "JAVA_9_HOME=${JAVA_PATH/\/bin\/java/\/}" >> $GITHUB_ENV
- name: Set up Java 16
uses: actions/setup-java@v1
with:
java-version: 16
- name: Store JAVA_16_HOME
run: JAVA_PATH=$(which java) && echo "JAVA_16_HOME=${JAVA_PATH/\/bin\/java/\/}" >> $GITHUB_ENV
- name: Set up Java 17
Expand All @@ -48,6 +38,12 @@ jobs:
java-version: 18
- name: Store JAVA_18_HOME
run: JAVA_PATH=$(which java) && echo "JAVA_18_HOME=${JAVA_PATH/\/bin\/java/\/}" >> $GITHUB_ENV
- name: Set up Java 19
uses: actions/setup-java@v1
with:
java-version: 19
- name: Store JAVA_19_HOME
run: JAVA_PATH=$(which java) && echo "JAVA_19_HOME=${JAVA_PATH/\/bin\/java/\/}" >> $GITHUB_ENV
- name: Set up Java 11
uses: actions/setup-java@v1
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ static Client getClient(ClientContext ctx, Socket sock, Function<Client, Future<
case Command.RECONNECT:
{
String probeId = ((ReconnectCommand) cmd).getProbeId();
log.debug("Attempting to reconnect client for probe {}", probeId);
Client client = Client.findClient(probeId);
log.debug("Found client {}", client);
if (client instanceof RemoteClient) {
((RemoteClient) client).reconnect(ois, oos, sock);
client.sendCommand(new StatusCommand(ReconnectCommand.STATUS_FLAG));
Expand Down Expand Up @@ -237,7 +239,9 @@ public void onCommand(Command cmd) throws IOException {
try {
boolean isConnected = true;
try {
output.reset();
synchronized (output) {
output.reset();
}
} catch (SocketException e) {
isConnected = false;
}
Expand Down Expand Up @@ -285,9 +289,11 @@ private boolean dispatchCommand(Command cmd, boolean isConnected) {
{
((DisconnectCommand) cmd).setProbeId(id.toString());
if (output != null) {
WireIO.write(output, cmd);
output.flush();
output.close();
synchronized (output) {
WireIO.write(output, cmd);
output.flush();
output.close();
}
oosUpdater.compareAndSet(this, output, null);
}
if (input != null) {
Expand Down Expand Up @@ -327,7 +333,9 @@ protected void closeAll() throws IOException {

ObjectOutputStream output = oos;
if (output != null) {
output.close();
synchronized (output) {
output.close();
}
oosUpdater.compareAndSet(this, output, null);
}
ObjectInputStream input = ois;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,11 +438,11 @@ void reconnect(String host, String resumeProbe, CommandListener listener, String
System.exit(1);
}
oos = new ObjectOutputStream(sock.getOutputStream());
log.debug("reconnecting client");
WireIO.write(oos, new ReconnectCommand(resumeProbe));

ois = new ObjectInputStream(sock.getInputStream());

log.debug("reconnecting client {}", resumeProbe);
WireIO.write(oos, new ReconnectCommand(resumeProbe));

log.debug("entering into command loop");
commandLoop(
new CommandListener() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ protected String getMethodName(String name) {

if (debugSupport.isDumpClasses()) {
try {
String handlerPath = debugSupport.getDumpClassDir() + "/" + handlerClassName.replace('/', '_') + ".class";
String handlerPath =
debugSupport.getDumpClassDir() + "/" + handlerClassName.replace('/', '_') + ".class";
log.debug("BTrace INDY handler dumped: {}", handlerPath);
Files.write(Paths.get(handlerPath), data, StandardOpenOption.CREATE);
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ public boolean onStderr(int lineno, String line) {
@Override
public boolean onStdout(int lineno, String line) {
System.out.println("[btrace #" + lineno + "] " + line);
if (lineno > 1000) {
if (lineno > 100) {
return false;
}
if (line.contains(probeId[0])) {
Expand Down
19 changes: 16 additions & 3 deletions btrace-instr/src/test/java/org/openjdk/btrace/RuntimeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,23 @@ public void test(
Process client = attach(pid, testScript, cmdArgs, checkLines, stdout, stderr);

System.out.println("Detached.");
pw.println("done");
pw.flush();

ret.set(client.waitFor());
int retries = 10;
boolean exitted = false;
while (!exitted && retries-- > 0) {
pw.println("done");
pw.flush();
exitted = client.waitFor(1, TimeUnit.SECONDS);
if (!exitted) {
System.out.println("... retrying ...");
}
}

if (!exitted) {
client.destroyForcibly();
}

ret.set(exitted ? client.exitValue() : -1);

outT.join();
errT.join();
Expand Down
23 changes: 13 additions & 10 deletions btrace-instr/src/test/java/resources/TestApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,19 @@ public void run() {
t.setDaemon(true);
t.start();

String resp = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8)).readLine();
System.out.println("Received " + resp + " - " + "done".equals(resp));
if ("done".equals(resp)) {
System.out.flush();
System.out.println(System.currentTimeMillis() + ": Interrupting the worker thread");
t.interrupt();
System.out.println(System.currentTimeMillis() + ": Waiting for the worker thread to finish");
t.join();
System.out.println(System.currentTimeMillis() + ": Worker thread finished");
}
do {
String resp = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8)).readLine();
System.out.println("Received " + resp + " - " + "done".contains(resp));
if ("done".contains(resp)) {
System.out.flush();
System.out.println(System.currentTimeMillis() + ": Interrupting the worker thread");
t.interrupt();
System.out.println(System.currentTimeMillis() + ": Waiting for the worker thread to finish");
t.join();
System.out.println(System.currentTimeMillis() + ": Worker thread finished");
break;
}
} while (true);
}

private static long getPID() {
Expand Down
2 changes: 1 addition & 1 deletion run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ for VERSION in 8 11 17 18 19 20; do
continue
fi
echo "Running tests with TEST_JAVA_HOME=${!home_string}"
TEST_JAVA_HOME=${!home_string} BTRACE_TEST_DEBUG="true" ./gradlew test | tee -a build/reports/test_java_$VERSION.out || true
TEST_JAVA_HOME=${!home_string} BTRACE_TEST_DEBUG="false" ./gradlew test | tee -a build/reports/test_java_$VERSION.out || true
done