jdk icon indicating copy to clipboard operation
jdk copied to clipboard

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

Open lahodaj opened this issue 7 months ago • 4 comments

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

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

Integration blocker

 ⚠️ Dependency #19969 must be integrated first

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

lahodaj avatar Jul 01 '24 14:07 lahodaj