Skip to content

8332474: Tighten up ToolBox' JavacTask to not silently accept javac crash as a failure #19972

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

Closed
wants to merge 9 commits into from

Conversation

lahodaj
Copy link
Contributor

@lahodaj lahodaj commented Jul 1, 2024

Tests for javac use several test frameworks, and one of them is the "toolbox", which provides JavacTask that allows to conveniently run javac on a given set of sources. The problem with JavacTask is that, by default, when a compilation failure is expected, javac crash (exit code 4) is tolerated by the JavacTask. And the test must manually select a specific exit code to overwrite this behavior.

This then leads to bugs like https://bugs.openjdk.org/browse/JDK-8335385, which are silently ignored by JavacTask.

The proposal herein is to tighten up the JavacTask, and effectively disallow exit code 4 for JavacTask (but permit any other exit code, as javac is using several exit codes). The base implementation in AbstractTask is changed to use a validator for the exit codes, which is then leveraged by JavacTask.

This patch depends on PR #19969, as that fixes JDK-8335385, where the javac crash is ignored. It also tweaks module attribution to not leave empty JCModuleDecl.sym for duplicate modules, and set it to an erroneous module. The empty (null) symbol here crashes javac in the test/langtools/tools/javac/modules/MultiModuleModeTest.java#testDuplicateModules, and the test wouldn't pass with this more strict JavacTask.


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-8332474: Tighten up ToolBox' JavacTask to not silently accept javac crash as a failure (Task - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 19972

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 1, 2024

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

@openjdk
Copy link

openjdk bot commented Jul 1, 2024

@lahodaj 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:

8332474: Tighten up ToolBox' JavacTask to not silently accept javac crash as a failure

Reviewed-by: vromero

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 71 new commits pushed to the master branch:

  • dea9274: 8332125: [nmt] Totals in diff report should print out total malloc and mmap diffs
  • 5c612c2: 8332689: RISC-V: Use load instead of trampolines
  • 6fcd49f: 8336239: Fix javadoc markup in java.lang.Process
  • b32e4a6: 8335356: Shenandoah: Improve concurrent cleanup locking
  • 62cbf70: 8336085: Fix simple -Wzero-as-null-pointer-constant warnings in CDS code
  • 2928753: 8324966: Allow selecting jtreg test case by ID from make
  • 1772a92: 8334457: Test javax/swing/JTabbedPane/bug4666224.java fail on macOS with because pressing the ‘C’ key does not switch the layout to WRAP_TAB_LAYOUT
  • b7d0eff: 8207908: JMXStatusTest.java fails assertion intermittently
  • cf940e1: 8335553: [Graal] Compiler thread calls into jdk.internal.vm.VMSupport.decodeAndThrowThrowable and crashes in OOM situation
  • b363de8: 8335946: DTrace code snippets should be generated when DTrace flags are enabled
  • ... and 61 more: https://git.openjdk.org/jdk/compare/3e3f83f62c67caf960ca031439b022f915e1102a...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 rfr Pull request is ready for review label Jul 1, 2024
@openjdk
Copy link

openjdk bot commented Jul 1, 2024

@lahodaj The following label will be automatically applied to this pull request:

  • compiler

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

@openjdk openjdk bot added the compiler compiler-dev@openjdk.org label Jul 1, 2024
@mlbridge
Copy link

mlbridge bot commented Jul 1, 2024

Webrevs

@lahodaj lahodaj changed the title 8332474: Tighten up ToolBox' JavacTask to not silently access javac crash as a failure 8332474: Tighten up ToolBox' JavacTask to not silently accept javac crash as a failure Jul 1, 2024

@Override
public Result run(Expect expect, int exitCode) {
if (exitCode == 4) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess we never expect javac to crash, and should not be able to test that it does, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not too worried about a test that would intentionally crash javac, and would need to test for that. It is not clear to me what would be the purpose of the test. And, assuming this need would indeed be rare, there are other ways to test for that. So, I opted for a more strict approach. OTOH, I don't have a too strong opinion on this, so I can re-allow exit code 4 here if desired.

Copy link
Contributor

@vicente-romero-oracle vicente-romero-oracle left a comment

Choose a reason for hiding this comment

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

lgtm

@openjdk-notifier openjdk-notifier bot changed the base branch from pr/19969 to master July 4, 2024 08:39
@openjdk-notifier
Copy link

The parent pull request that this pull request depends on has now been integrated and the target branch of this pull request has been updated. This means that changes from the dependent pull request can start to show up as belonging to this pull request, which may be confusing for reviewers. To remedy this situation, simply merge the latest changes from the new target branch into this pull request by running commands similar to these in the local repository for your personal fork:

git checkout JDK-8332474
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# if there are conflicts, follow the instructions given by git merge
git commit -m "Merge master"
git push

@openjdk
Copy link

openjdk bot commented Jul 4, 2024

⚠️ @lahodaj This pull request contains merges that bring in commits not present in the target repository. Since this is not a "merge style" pull request, these changes will be squashed when this pull request in integrated. If this is your intention, then please ignore this message. If you want to preserve the commit structure, you must change the title of this pull request to Merge <project>:<branch> where <project> is the name of another project in the OpenJDK organization (for example Merge jdk:master).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jul 4, 2024
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Jul 4, 2024
Copy link
Contributor

@vicente-romero-oracle vicente-romero-oracle left a comment

Choose a reason for hiding this comment

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

lgtm

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jul 11, 2024
@lahodaj
Copy link
Contributor Author

lahodaj commented Jul 12, 2024

/integrate

@openjdk
Copy link

openjdk bot commented Jul 12, 2024

Going to push as commit 559826c.
Since your change was applied there have been 86 commits pushed to the master branch:

  • eec0e15: 8335619: Add an @APinote to j.l.i.ClassFileTransformer to warn about recursive class loading and ClassCircularityErrors
  • 9b6f6c5: 8336082: Fix -Wzero-as-null-pointer-constant warnings in SimpleCompactHashtable
  • 7a62032: 8336081: Fix -Wzero-as-null-pointer-constant warnings in JVMTypedFlagLimit ctors
  • f677b90: 8267887: RMIConnector_NPETest.java fails after removal of RMI Activation (JDK-8267123)
  • 1fe3ada: 8336284: Test TestClhsdbJstackLock.java/TestJhsdbJstackLock.java fails with -Xcomp after JDK-8335743
  • c703d29: 8335710: serviceability/dcmd/vm/SystemDumpMapTest.java and SystemMapTest.java fail on Linux Alpine after 8322475
  • 81a0d1b: 8325525: Create jtreg test case for JDK-8325203
  • b3ef2a6: 8336036: Synthetic documentation for a record's equals is incorrect for floating-point types
  • 687601e: 8336257: Additional tests in jmxremote/startstop to match on PID not app name
  • 8890557: 8335623: Clean up HtmlTag.HtmlTag and make the ARIA role attribute global
  • ... and 76 more: https://git.openjdk.org/jdk/compare/3e3f83f62c67caf960ca031439b022f915e1102a...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jul 12, 2024

@lahodaj Pushed as commit 559826c.

💡 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
compiler compiler-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants