-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,11 +25,11 @@ | |
import jdk.internal.jimage.ImageReader.Node; | ||
import jdk.test.lib.compiler.InMemoryJavaCompiler; | ||
import jdk.test.lib.util.JarBuilder; | ||
import org.junit.jupiter.api.Assumptions; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.TestInstance; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.ValueSource; | ||
import org.opentest4j.TestSkippedException; | ||
import tests.Helper; | ||
import tests.JImageGenerator; | ||
|
||
|
@@ -214,15 +214,18 @@ public String toString() { | |
|
||
/// Returns the helper for building JAR and jimage files. | ||
private static Helper getHelper() { | ||
Helper helper; | ||
try { | ||
Helper helper = Helper.newHelper(); | ||
if (helper == null) { | ||
throw new TestSkippedException("Cannot create test helper (exploded image?)"); | ||
} | ||
return helper; | ||
helper = Helper.newHelper(); | ||
} catch (IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
// Gracefully skip if there's no jimage to work with (e.g. if | ||
// '--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 commentThe 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 commentThe 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. |
||
return helper; | ||
} | ||
|
||
/// Loads and performs actions on classes stored in a given `ImageReader`. | ||
|
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.
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.