Skip to content

Commit 64c2048

Browse files
committed
8299241: jdk/jfr/api/consumer/streaming/TestJVMCrash.java generates unnecessary core file
Backport-of: 188911c925e4067c7f912c5ddb6f715bad7a3892
1 parent f60d396 commit 64c2048

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

test/jdk/jdk/jfr/api/consumer/streaming/TestJVMCrash.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,7 @@ public class TestJVMCrash {
4343
public static void main(String... args) throws Exception {
4444
int id = 1;
4545
while (true) {
46-
try (TestProcess process = new TestProcess("crash-application-" + id++)) {
46+
try (TestProcess process = new TestProcess("crash-application-" + id++, false /* createCore */)) {
4747
AtomicInteger eventCounter = new AtomicInteger();
4848
try (EventStream es = EventStream.openRepository(process.getRepository())) {
4949
// Start from first event in repository

test/jdk/jdk/jfr/api/consumer/streaming/TestProcess.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -54,11 +54,16 @@ private static class TestEvent extends Event {
5454
private final Path path;
5555

5656
public TestProcess(String name) throws IOException {
57+
this(name, true /* createCore */);
58+
}
59+
60+
public TestProcess(String name, boolean createCore) throws IOException {
5761
this.path = Paths.get("action-" + System.currentTimeMillis()).toAbsolutePath();
5862
String[] args = {
5963
"--add-exports",
6064
"java.base/jdk.internal.misc=ALL-UNNAMED",
6165
"-XX:StartFlightRecording:settings=none",
66+
"-XX:" + (createCore ? "+" : "-") + "CreateCoredumpOnCrash",
6267
TestProcess.class.getName(), path.toString()
6368
};
6469
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args);

0 commit comments

Comments
 (0)