Skip to content

Commit

Permalink
8299241: jdk/jfr/api/consumer/streaming/TestJVMCrash.java generates u…
Browse files Browse the repository at this point in the history
…nnecessary core file

Reviewed-by: coleenp
  • Loading branch information
Daniel D. Daugherty committed Dec 23, 2022
1 parent 33042a4 commit 188911c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions test/jdk/jdk/jfr/api/consumer/streaming/TestJVMCrash.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2022, 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
Expand Down Expand Up @@ -43,7 +43,7 @@ public class TestJVMCrash {
public static void main(String... args) throws Exception {
int id = 1;
while (true) {
try (TestProcess process = new TestProcess("crash-application-" + id++)) {
try (TestProcess process = new TestProcess("crash-application-" + id++, false /* createCore */)) {
AtomicInteger eventCounter = new AtomicInteger();
try (EventStream es = EventStream.openRepository(process.getRepository())) {
// Start from first event in repository
Expand Down
7 changes: 6 additions & 1 deletion test/jdk/jdk/jfr/api/consumer/streaming/TestProcess.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2022, 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
Expand Down Expand Up @@ -54,11 +54,16 @@ private static class TestEvent extends Event {
private final Path path;

public TestProcess(String name) throws IOException {
this(name, true /* createCore */);
}

public TestProcess(String name, boolean createCore) throws IOException {
this.path = Paths.get("action-" + System.currentTimeMillis()).toAbsolutePath();
String[] args = {
"--add-exports",
"java.base/jdk.internal.misc=ALL-UNNAMED",
"-XX:StartFlightRecording:settings=none",
"-XX:" + (createCore ? "+" : "-") + "CreateCoredumpOnCrash",
TestProcess.class.getName(), path.toString()
};
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args);
Expand Down

2 comments on commit 188911c

@GoeLin
Copy link
Member

@GoeLin GoeLin commented on 188911c Nov 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk17u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 188911c Nov 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GoeLin the backport was successfully created on the branch GoeLin-backport-188911c9 in my personal fork of openjdk/jdk17u-dev. To create a pull request with this backport targeting openjdk/jdk17u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 188911c9 from the openjdk/jdk repository.

The commit being backported was authored by Daniel D. Daugherty on 23 Dec 2022 and was reviewed by Coleen Phillimore.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk17u-dev:

$ git fetch https://github.com/openjdk-bots/jdk17u-dev.git GoeLin-backport-188911c9:GoeLin-backport-188911c9
$ git checkout GoeLin-backport-188911c9
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk17u-dev.git GoeLin-backport-188911c9

Please sign in to comment.