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

8311775: [TEST] duplicate verifyHeapDump in several tests #15202

Closed
wants to merge 5 commits into from

Conversation

y1yang0
Copy link
Member

@y1yang0 y1yang0 commented Aug 9, 2023

This is a follow-up patch of #13667. verifyHeapDump is duplicated in several tests, this patch tries to consolidate them into one method.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8311775: [TEST] duplicate verifyHeapDump in several tests (Enhancement - P5)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/15202/head:pull/15202
$ git checkout pull/15202

Update a local copy of the PR:
$ git checkout pull/15202
$ git pull https://git.openjdk.org/jdk.git pull/15202/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 15202

View PR using the GUI difftool:
$ git pr show -t 15202

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/15202.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 9, 2023

👋 Welcome back yyang! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Aug 9, 2023
@openjdk
Copy link

openjdk bot commented Aug 9, 2023

@y1yang0 The following labels will be automatically applied to this pull request:

  • core-libs
  • hotspot-runtime
  • serviceability

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added serviceability serviceability-dev@openjdk.org hotspot-runtime hotspot-runtime-dev@openjdk.org core-libs core-libs-dev@openjdk.org labels Aug 9, 2023
@y1yang0
Copy link
Member Author

y1yang0 commented Aug 9, 2023

/label remove hotspot-runtime core-libs

@openjdk openjdk bot removed hotspot-runtime hotspot-runtime-dev@openjdk.org core-libs core-libs-dev@openjdk.org labels Aug 9, 2023
@openjdk
Copy link

openjdk bot commented Aug 9, 2023

@y1yang0
The hotspot-runtime label was successfully removed.

The core-libs label was successfully removed.

@mlbridge
Copy link

mlbridge bot commented Aug 9, 2023

Webrevs

Copy link
Contributor

@kevinjwalls kevinjwalls left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks.
One question on whether we need to change those "throws IOException" to "throws Exception", which is really me thinking if the existing HProfParser parse method really needs to throw Exception? Maybe it only needs IOException? (snapshot.resolve doesn't throw anything)
But looks good anyway and good to share this code. 8-)

@plummercj
Copy link
Contributor

Can you clarify what testing you did? I don't see BasicJMapTest.java being run as part of GHA. I also don't see com/sun/management/HotSpotDiagnosticMXBean/DumpHeap.java being run, which is impacted by your changes.

@alexmenkov
Copy link

Need to update copyright year in the files

Comment on lines 39 to 40
import jdk.test.lib.hprof.parser.PositionDataInputStream;
import jdk.test.lib.hprof.HprofParser;

Choose a reason for hiding this comment

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

PositionDataInputStream and HprofParser imports are not used anymore

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for review, all copyright year and unused imports are removed now

@y1yang0
Copy link
Member Author

y1yang0 commented Aug 11, 2023

Thanks for reviews!


@kevinjwalls

One question on whether we need to change those "throws IOException" to "throws Exception", which is really me thinking if the existing HProfParser parse method really needs to throw Exception? Maybe it only needs IOException? (snapshot.resolve doesn't throw anything) But looks good anyway and good to share this code. 8-)

Yes, we must change it to throws Exception otherwise we won't compile

/jdk/test/lib/jdk/test/lib/hprof/HprofParser.java:99: error: unreported exception Exception; must be caught or declared to be thrown
            try (Snapshot snapshot = Reader.readFile(dump.getAbsolutePath(), callStack, debugLevel)) {
                          ^
  exception thrown from implicit call to close() on resource variable 'snapshot'

I noticed another optional enhancement where I found that essentially all calls to HprofParser.parse should now be replaced with HprofParser.parseAndVerify or make it the standard parsing logic, but this is unrelated to my current patch.


@plummercj

Can you clarify what testing you did?

All involved tests work in Linux.

@plummercj
Copy link
Contributor

test/lib/jdk/test/lib/hprof/HprofParser.java needs a copyright update.

@openjdk
Copy link

openjdk bot commented Sep 1, 2023

@y1yang0 This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8311775: [TEST] duplicate verifyHeapDump in several tests

Reviewed-by: kevinw, amenkov, cjplummer

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 291 new commits pushed to the master branch:

  • 2a11bc4: 8314837: 5 compiled/codecache tests ignore VM flags
  • 2f7c65e: 8303427: Fixpath confused if unix root contains "/jdk"
  • e9e0c56: 8314319: LogCompilation doesn't reset lateInlining when it encounters a failure.
  • 56b8db1: 8258970: Disabled JPasswordField foreground color is wrong with GTK LAF
  • 0d4cadb: 8315195: RISC-V: Update hwprobe query for new extensions
  • b4f7069: 8315446: G1: Remove unused G1AllocRegion::attempt_allocation
  • cf02cf3: 8315098: Improve URLEncodeDecode microbenchmark
  • c32e340: 8315321: [aix] os::attempt_reserve_memory_at must map at the requested address or fail
  • 42f5b9e: 8315436: HttpsServer does not send TLS alerts
  • 033f311: 8315069: Relativize extended_sp in interpreter frames
  • ... and 281 more: https://git.openjdk.org/jdk/compare/31a307f2fbe7b99435f50e5404c2a95f07b9a77b...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 1, 2023
@y1yang0
Copy link
Member Author

y1yang0 commented Sep 4, 2023

/integrate

@openjdk
Copy link

openjdk bot commented Sep 4, 2023

Going to push as commit 75d4ac2.
Since your change was applied there have been 292 commits pushed to the master branch:

  • 4f90aba: 8311585: Add JRadioButtonMenuItem to bug8031573.java
  • 2a11bc4: 8314837: 5 compiled/codecache tests ignore VM flags
  • 2f7c65e: 8303427: Fixpath confused if unix root contains "/jdk"
  • e9e0c56: 8314319: LogCompilation doesn't reset lateInlining when it encounters a failure.
  • 56b8db1: 8258970: Disabled JPasswordField foreground color is wrong with GTK LAF
  • 0d4cadb: 8315195: RISC-V: Update hwprobe query for new extensions
  • b4f7069: 8315446: G1: Remove unused G1AllocRegion::attempt_allocation
  • cf02cf3: 8315098: Improve URLEncodeDecode microbenchmark
  • c32e340: 8315321: [aix] os::attempt_reserve_memory_at must map at the requested address or fail
  • 42f5b9e: 8315436: HttpsServer does not send TLS alerts
  • ... and 282 more: https://git.openjdk.org/jdk/compare/31a307f2fbe7b99435f50e5404c2a95f07b9a77b...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Sep 4, 2023
@openjdk openjdk bot closed this Sep 4, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Sep 4, 2023
@openjdk
Copy link

openjdk bot commented Sep 4, 2023

@y1yang0 Pushed as commit 75d4ac2.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated serviceability serviceability-dev@openjdk.org
4 participants