Skip to content

8365436: ImageReaderTest fails when jmods directory not present #26774

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
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions test/jdk/jdk/internal/jimage/ImageReaderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@
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;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.opentest4j.TestSkippedException;
import tests.Helper;
import tests.JImageGenerator;

Expand All @@ -54,6 +55,7 @@
* @test
* @summary Tests for ImageReader.
* @modules java.base/jdk.internal.jimage
* jdk.jlink/jdk.tools.jlink.internal
* jdk.jlink/jdk.tools.jimage
* @library /test/jdk/tools/lib
* /test/lib
Expand Down Expand Up @@ -214,15 +216,15 @@ 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;
boolean isLinkableRuntime = LinkableRuntimeImage.isLinkableRuntime();
helper = Helper.newHelper(isLinkableRuntime);
} catch (IOException e) {
throw new RuntimeException(e);
}
Assumptions.assumeTrue(helper != null, "Cannot create test helper, skipping test!");
return helper;
}

/// Loads and performs actions on classes stored in a given `ImageReader`.
Expand Down