< prev index next >
jdk/test/tools/jmod/JmodNegativeTest.java
Print this page
@@ -22,12 +22,12 @@
*/
/*
* @test
* @library /lib/testlibrary
- * @modules jdk.jlink/jdk.tools.jmod
- * jdk.compiler
+ * @modules jdk.compiler
+ * jdk.jlink
* @build jdk.testlibrary.FileUtils CompilerUtils
* @run testng JmodNegativeTest
* @summary Negative tests for jmod
*/
@@ -37,10 +37,11 @@
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Supplier;
+import java.util.spi.ToolProvider;
import java.util.zip.ZipOutputStream;
import jdk.testlibrary.FileUtils;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -49,10 +50,15 @@
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.testng.Assert.assertTrue;
public class JmodNegativeTest {
+ static final ToolProvider JMOD_TOOL = ToolProvider.findFirst("jmod")
+ .orElseThrow(() ->
+ new RuntimeException("jmod tool not found")
+ );
+
static final String TEST_SRC = System.getProperty("test.src", ".");
static final Path SRC_DIR = Paths.get(TEST_SRC, "src");
static final Path EXPLODED_DIR = Paths.get("build");
static final Path MODS_DIR = Paths.get("jmods");
@@ -513,11 +519,11 @@
static JmodResult jmod(String... args) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
System.out.println("jmod " + Arrays.asList(args));
- int ec = jdk.tools.jmod.Main.run(args, ps);
+ int ec = JMOD_TOOL.run(ps, ps, args);
return new JmodResult(ec, new String(baos.toByteArray(), UTF_8));
}
static class JmodResult {
final int exitCode;
< prev index next >