-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8365436: ImageReaderTest fails when jmods directory not present #26773
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
Conversation
👋 Welcome back david-beaumont! A progress list of the required criteria for merging this PR into |
❗ This change is not yet ready to be integrated. |
@david-beaumont The following label will be automatically applied to this pull request:
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. |
// '--generate-linkable-runtime' was used to build the runtime). | ||
// This may be reporting as a skipped test, or a pass, depending | ||
// on how the test was run. | ||
Assumptions.assumeTrue(helper != null, "Cannot create test helper (no jimage file)"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a jimage file, Helper.newHelper is returning null because there are no packaged modules in the runtime image (= no jmods directory).
In passing, tests.Helper is the supporting class for the jlink tests. We should rename it or create a sub-directory in test/jdk/tools/lib/tests as the location/naming just won't work for this very specific class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other PR on the bug (https://github.com/openjdk/jdk/pull/26774/files) changes the comment.
Happy for a more specific wording though.
This PR is likely redundant now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest to make the test run on as many scenarios as possible. This patch seems to work for me on a JEP 493-enabled build:
diff --git a/test/jdk/jdk/internal/jimage/ImageReaderTest.java b/test/jdk/jdk/internal/jimage/ImageReaderTest.java
index 62281151126..14c5f8eac21 100644
--- a/test/jdk/jdk/internal/jimage/ImageReaderTest.java
+++ b/test/jdk/jdk/internal/jimage/ImageReaderTest.java
@@ -25,6 +25,7 @@
import jdk.internal.jimage.ImageReader.Node;
import jdk.test.lib.compiler.InMemoryJavaCompiler;
import jdk.test.lib.util.JarBuilder;
+import jdk.tools.jlink.internal.LinkableRuntimeImage;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
@@ -55,6 +56,7 @@
* @summary Tests for ImageReader.
* @modules java.base/jdk.internal.jimage
* jdk.jlink/jdk.tools.jimage
+ * jdk.jlink/jdk.tools.jlink.internal
* @library /test/jdk/tools/lib
* /test/lib
* @build tests.*
@@ -216,7 +218,8 @@ public String toString() {
private static Helper getHelper() {
Helper helper;
try {
- helper = Helper.newHelper();
+ boolean isLinkableRuntime = LinkableRuntimeImage.isLinkableRuntime();
+ helper = Helper.newHelper(isLinkableRuntime);
} catch (IOException e) {
throw new RuntimeException(e);
}
The comments seem wrong as Alan pointed out.
throw new TestSkippedException("Cannot create test helper (exploded image?)"); | ||
} | ||
return helper; | ||
helper = Helper.newHelper(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
helper = Helper.newHelper(); | |
boolean isLinkableRuntime = LinkableRuntimeImage.isLinkableRuntime(); | |
helper = Helper.newHelper(isLinkableRuntime); |
This will make the test run (not abort) for JEP 493-enabled builds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this was done for https://github.com/openjdk/jdk/pull/26774/files once I knew about it and could patch in the extra modules line.
I'm not sure why you've created another PR for the same issue, but I think this should get closed. |
I'm closing this alternate PR, please review #26774 instead. |
Switched from TestSkippedException (not honoured by JUnit) to TestAbortedException (via Assumptions class) to avoid false negative test "failure". Note that now, the test is either shown as skipped, or passed, depending on which report is being looked at. Tweaked error message slightly since using an "exploded image" isn't the only cause.
Progress
Issue
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/26773/head:pull/26773
$ git checkout pull/26773
Update a local copy of the PR:
$ git checkout pull/26773
$ git pull https://git.openjdk.org/jdk.git pull/26773/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 26773
View PR using the GUI difftool:
$ git pr show -t 26773
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/26773.diff
Using Webrev
Link to Webrev Comment