Skip to content
Permalink
Browse files

8219686: jdk/jfr/event/runtime/TestShutdownEvent.java recording file …

…length is 0

Reviewed-by: mgronlun, mseledtsov
  • Loading branch information
Erik Gahlin
Erik Gahlin committed Jan 30, 2020
1 parent 9cfd632 commit cb636b2c0b6d7fa211201277f09e1b621f5287a4
Showing with 29 additions and 10 deletions.
  1. +29 −10 test/jdk/jdk/jfr/event/runtime/TestShutdownEvent.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2020, 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
@@ -68,11 +68,25 @@

public static void main(String[] args) throws Throwable {
for (int i = 0; i < subTests.length; ++i) {
if (subTests[i].isApplicable()) {
runSubtest(i);
} else {
int attempts = subTests[i].attempts();
if (attempts == 0) {
System.out.println("Skipping non-applicable test: " + i);
}
for (int j = 0; j < attempts -1; j++) {
try {
runSubtest(i);
return;
} catch (Exception e) {
System.out.println("Failed: " + e.getMessage());
System.out.println();
System.out.println("Retry " + i + 1);
} catch (OutOfMemoryError | StackOverflowError e) {
System.out.println("Error");
// Can happen when parsing corrupt file. Abort test.
return;
}
}
runSubtest(i);
}
}

@@ -115,8 +129,8 @@ public static void main(String[] args) throws Exception {
}

private interface ShutdownEventSubTest {
default boolean isApplicable() {
return true;
default int attempts() {
return 1;
}
void runTest();
void verifyEvents(RecordedEvent event, int exitCode);
@@ -174,6 +188,11 @@ public void verifyEvents(RecordedEvent event, int exitCode) {
// see 8219082 for details (running the crashed VM with -Xint would solve the issue too)
//validateStackTrace(event.getStackTrace());
}

@Override
public int attempts() {
return 3;
}
}

private static class TestUnhandledException implements ShutdownEventSubTest {
@@ -207,14 +226,14 @@ public void verifyEvents(RecordedEvent event, int exitCode) {
private final String signalName;

@Override
public boolean isApplicable() {
public int attempts() {
if (Platform.isWindows()) {
return false;
return 0;
}
if (signalName.equals("HUP") && Platform.isSolaris()) {
return false;
return 0;
}
return true;
return 1;
}

public TestSig(String signalName) {

0 comments on commit cb636b2

Please sign in to comment.