8344326: Move jpackage tests from "jdk.jpackage.tests" package to the default package
Reviewed-by: almatvee
This commit is contained in:
parent
41a2d49f0a
commit
2c509a158f
@ -64,22 +64,6 @@ public class WindowsHelper {
|
||||
return Path.of(cmd.getArgumentValue("--install-dir", cmd::name));
|
||||
}
|
||||
|
||||
// Tests have problems on windows where path in the temp dir are too long
|
||||
// for the wix tools. We can't use a tempDir outside the TKit's WorkDir, so
|
||||
// we minimize both the tempRoot directory name (above) and the tempDir name
|
||||
// (below) to the extension part (which is necessary to differenciate between
|
||||
// the multiple PackageTypes that will be run for one JPackageCommand).
|
||||
// It might be beter if the whole work dir name was shortened from:
|
||||
// jtreg_open_test_jdk_tools_jpackage_share_jdk_jpackage_tests_BasicTest_java.
|
||||
public static Path getTempDirectory(JPackageCommand cmd, Path tempRoot) {
|
||||
String ext = cmd.outputBundle().getFileName().toString();
|
||||
int i = ext.lastIndexOf(".");
|
||||
if (i > 0 && i < (ext.length() - 1)) {
|
||||
ext = ext.substring(i+1);
|
||||
}
|
||||
return tempRoot.resolve(ext);
|
||||
}
|
||||
|
||||
private static void runMsiexecWithRetries(Executor misexec) {
|
||||
Executor.Result result = null;
|
||||
for (int attempt = 0; attempt < 8; ++attempt) {
|
||||
|
@ -21,7 +21,6 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.jpackage.tests;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
@ -46,7 +45,7 @@ import org.w3c.dom.Document;
|
||||
* @build jdk.jpackage.test.*
|
||||
* @compile AppVersionTest.java
|
||||
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
|
||||
* --jpt-run=jdk.jpackage.tests.AppVersionTest
|
||||
* --jpt-run=AppVersionTest
|
||||
*/
|
||||
|
||||
public final class AppVersionTest {
|
@ -21,7 +21,6 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.jpackage.tests;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
@ -45,8 +44,6 @@ import jdk.jpackage.test.Annotations.Parameter;
|
||||
import jdk.jpackage.test.Functional.ThrowingConsumer;
|
||||
import static jdk.jpackage.test.RunnablePackageTest.Action.CREATE_AND_UNPACK;
|
||||
|
||||
import static jdk.jpackage.test.WindowsHelper.getTempDirectory;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary jpackage basic testing
|
||||
@ -54,7 +51,7 @@ import static jdk.jpackage.test.WindowsHelper.getTempDirectory;
|
||||
* @build jdk.jpackage.test.*
|
||||
* @compile BasicTest.java
|
||||
* @run main/othervm/timeout=720 -Xmx512m jdk.jpackage.test.Main
|
||||
* --jpt-run=jdk.jpackage.tests.BasicTest
|
||||
* --jpt-run=BasicTest
|
||||
*/
|
||||
|
||||
public final class BasicTest {
|
||||
@ -345,7 +342,7 @@ public final class BasicTest {
|
||||
// Force save of package bundle in test work directory.
|
||||
.addInitializer(JPackageCommand::setDefaultInputOutput)
|
||||
.addInitializer(cmd -> {
|
||||
Path tempDir = getTempDirectory(cmd, tempRoot);
|
||||
Path tempDir = tempRoot.resolve(cmd.packageType().name());
|
||||
switch (type) {
|
||||
case TEMPDIR_EMPTY -> Files.createDirectories(tempDir);
|
||||
case TEMPDIR_NOT_EXIST -> Files.createDirectories(tempDir.getParent());
|
||||
@ -362,20 +359,16 @@ public final class BasicTest {
|
||||
if (TestTempType.TEMPDIR_NOT_EMPTY.equals(type)) {
|
||||
pkgTest.setExpectedExitCode(1).addBundleVerifier(cmd -> {
|
||||
// Check jpackage didn't use the supplied directory.
|
||||
Path tempDir = getTempDirectory(cmd, tempRoot);
|
||||
String[] tempDirContents = tempDir.toFile().list();
|
||||
TKit.assertStringListEquals(List.of("foo.txt"), List.of(
|
||||
tempDirContents), String.format(
|
||||
"Check the contents of the supplied temporary directory [%s]",
|
||||
tempDir));
|
||||
Path tempDir = Path.of(cmd.getArgumentValue("--temp"));
|
||||
TKit.assertDirectoryContent(tempDir).match(Path.of("foo.txt"));
|
||||
TKit.assertStringListEquals(List.of("Hello Duke!"),
|
||||
Files.readAllLines(tempDir.resolve(tempDirContents[0])),
|
||||
Files.readAllLines(tempDir.resolve("foo.txt")),
|
||||
"Check the contents of the file in the supplied temporary directory");
|
||||
});
|
||||
} else {
|
||||
pkgTest.addBundleVerifier(cmd -> {
|
||||
// Check jpackage used the supplied directory.
|
||||
Path tempDir = getTempDirectory(cmd, tempRoot);
|
||||
Path tempDir = Path.of(cmd.getArgumentValue("--temp"));
|
||||
TKit.assertDirectoryNotEmpty(tempDir);
|
||||
});
|
||||
}
|
@ -21,7 +21,6 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.jpackage.tests;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
@ -46,7 +45,7 @@ import jdk.jpackage.test.TKit;
|
||||
* @build jdk.jpackage.test.*
|
||||
* @compile CookedRuntimeTest.java
|
||||
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
|
||||
* --jpt-run=jdk.jpackage.tests.CookedRuntimeTest
|
||||
* --jpt-run=CookedRuntimeTest
|
||||
*/
|
||||
|
||||
public final class CookedRuntimeTest {
|
@ -21,7 +21,6 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.jpackage.tests;
|
||||
|
||||
import jdk.jpackage.test.JPackageCommand;
|
||||
import jdk.jpackage.test.HelloApp;
|
||||
@ -37,7 +36,7 @@ import jdk.jpackage.test.Annotations.Test;
|
||||
* @build jdk.jpackage.test.*
|
||||
* @compile DotInNameTest.java
|
||||
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
|
||||
* --jpt-run=jdk.jpackage.tests.DotInNameTest
|
||||
* --jpt-run=DotInNameTest
|
||||
* --jpt-before-run=jdk.jpackage.test.JPackageCommand.useToolProviderByDefault
|
||||
*/
|
||||
|
@ -21,7 +21,6 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.jpackage.tests;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -37,7 +36,7 @@ import jdk.jpackage.test.TKit;
|
||||
* @build jdk.jpackage.test.*
|
||||
* @compile ErrorTest.java
|
||||
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
|
||||
* --jpt-run=jdk.jpackage.tests.ErrorTest
|
||||
* --jpt-run=ErrorTest
|
||||
* --jpt-before-run=jdk.jpackage.test.JPackageCommand.useExecutableByDefault
|
||||
*/
|
||||
|
||||
@ -48,7 +47,7 @@ import jdk.jpackage.test.TKit;
|
||||
* @build jdk.jpackage.test.*
|
||||
* @compile ErrorTest.java
|
||||
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
|
||||
* --jpt-run=jdk.jpackage.tests.ErrorTest
|
||||
* --jpt-run=ErrorTest
|
||||
* --jpt-before-run=jdk.jpackage.test.JPackageCommand.useToolProviderByDefault
|
||||
*/
|
||||
|
@ -21,7 +21,6 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.jpackage.tests;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -37,7 +36,7 @@ import jdk.jpackage.test.TKit;
|
||||
* @build jdk.jpackage.test.*
|
||||
* @compile JLinkOptionsTest.java
|
||||
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
|
||||
* --jpt-run=jdk.jpackage.tests.JLinkOptionsTest
|
||||
* --jpt-run=JLinkOptionsTest
|
||||
*/
|
||||
|
||||
public final class JLinkOptionsTest {
|
@ -21,7 +21,6 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.jpackage.tests;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -39,7 +38,7 @@ import jdk.jpackage.test.TKit;
|
||||
* @build jdk.jpackage.test.*
|
||||
* @compile JavaOptionsEqualsTest.java
|
||||
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
|
||||
* --jpt-run=jdk.jpackage.tests.JavaOptionsEqualsTest
|
||||
* --jpt-run=JavaOptionsEqualsTest
|
||||
* --jpt-before-run=jdk.jpackage.test.JPackageCommand.useExecutableByDefault
|
||||
*/
|
||||
|
||||
@ -50,7 +49,7 @@ import jdk.jpackage.test.TKit;
|
||||
* @build jdk.jpackage.test.*
|
||||
* @compile JavaOptionsEqualsTest.java
|
||||
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
|
||||
* --jpt-run=jdk.jpackage.tests.JavaOptionsEqualsTest
|
||||
* --jpt-run=JavaOptionsEqualsTest
|
||||
* --jpt-before-run=jdk.jpackage.test.JPackageCommand.useToolProviderByDefault
|
||||
*/
|
||||
|
@ -21,7 +21,6 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.jpackage.tests;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -39,7 +38,7 @@ import jdk.jpackage.test.TKit;
|
||||
* @build jdk.jpackage.test.*
|
||||
* @compile JavaOptionsTest.java
|
||||
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
|
||||
* --jpt-run=jdk.jpackage.tests.JavaOptionsTest
|
||||
* --jpt-run=JavaOptionsTest
|
||||
* --jpt-before-run=jdk.jpackage.test.JPackageCommand.useToolProviderByDefault
|
||||
*/
|
||||
|
@ -21,7 +21,6 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.jpackage.tests;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
@ -46,7 +45,7 @@ import jdk.jpackage.test.Annotations.Parameters;
|
||||
import jdk.jpackage.test.Annotations.Test;
|
||||
import jdk.jpackage.test.CfgFile;
|
||||
import jdk.jpackage.test.Functional.ThrowingConsumer;
|
||||
import static jdk.jpackage.tests.MainClassTest.Script.MainClassType.*;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@ -56,7 +55,7 @@ import static jdk.jpackage.tests.MainClassTest.Script.MainClassType.*;
|
||||
* @build jdk.jpackage.test.*
|
||||
* @compile MainClassTest.java
|
||||
* @run main/othervm/timeout=720 -Xmx512m jdk.jpackage.test.Main
|
||||
* --jpt-run=jdk.jpackage.tests.MainClassTest
|
||||
* --jpt-run=MainClassTest
|
||||
*/
|
||||
|
||||
public final class MainClassTest {
|
||||
@ -82,7 +81,7 @@ public final class MainClassTest {
|
||||
}
|
||||
|
||||
Script withJarMainClass(MainClassType v) {
|
||||
appDesc.setWithMainClass(v != NotSet);
|
||||
appDesc.setWithMainClass(v != MainClassType.NotSet);
|
||||
jarMainClass = v;
|
||||
return this;
|
||||
}
|
||||
@ -172,7 +171,8 @@ public final class MainClassTest {
|
||||
|
||||
@Parameters
|
||||
public static Collection scripts() {
|
||||
final var withMainClass = Set.of(SetWrong, SetRight);
|
||||
final var withMainClass = Set.of(Script.MainClassType.SetWrong,
|
||||
Script.MainClassType.SetRight);
|
||||
|
||||
List<Script[]> scripts = new ArrayList<>();
|
||||
for (var withJLink : List.of(true, false)) {
|
||||
@ -205,7 +205,7 @@ public final class MainClassTest {
|
||||
|
||||
@Test
|
||||
public void test() throws IOException {
|
||||
if (script.jarMainClass == SetWrong) {
|
||||
if (script.jarMainClass == Script.MainClassType.SetWrong) {
|
||||
initJarWithWrongMainClass();
|
||||
}
|
||||
|
||||
@ -224,11 +224,11 @@ public final class MainClassTest {
|
||||
boolean appShouldSucceed = false;
|
||||
|
||||
// Should succeed if valid main class is set on the command line.
|
||||
appShouldSucceed |= (script.mainClass == SetRight);
|
||||
appShouldSucceed |= (script.mainClass == Script.MainClassType.SetRight);
|
||||
|
||||
// Should succeed if main class is not set on the command line but set
|
||||
// to valid value in the jar.
|
||||
appShouldSucceed |= (script.mainClass == NotSet && script.jarMainClass == SetRight);
|
||||
appShouldSucceed |= (script.mainClass == Script.MainClassType.NotSet && script.jarMainClass == Script.MainClassType.SetRight);
|
||||
|
||||
if (appShouldSucceed) {
|
||||
cmd.executeAndAssertHelloAppImageCreated();
|
@ -21,7 +21,6 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.jpackage.tests;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -48,7 +47,7 @@ import jdk.jpackage.test.Annotations.Test;
|
||||
* @build jdk.jpackage.test.*
|
||||
* @compile ModulePathTest.java
|
||||
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
|
||||
* --jpt-run=jdk.jpackage.tests.ModulePathTest
|
||||
* --jpt-run=ModulePathTest
|
||||
*/
|
||||
|
||||
public final class ModulePathTest {
|
@ -21,7 +21,6 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.jpackage.tests;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
@ -40,7 +39,7 @@ import jdk.jpackage.test.TKit;
|
||||
* @build jdk.jpackage.test.*
|
||||
* @compile ModulePathTest2.java
|
||||
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
|
||||
* --jpt-run=jdk.jpackage.tests.ModulePathTest2
|
||||
* --jpt-run=ModulePathTest2
|
||||
*/
|
||||
|
||||
public final class ModulePathTest2 {
|
@ -21,7 +21,6 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.jpackage.tests;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
@ -53,7 +52,7 @@ import org.w3c.dom.Document;
|
||||
* @build jdk.jpackage.test.*
|
||||
* @compile ModulePathTest3.java
|
||||
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
|
||||
* --jpt-run=jdk.jpackage.tests.ModulePathTest3
|
||||
* --jpt-run=ModulePathTest3
|
||||
*/
|
||||
|
||||
public final class ModulePathTest3 {
|
@ -21,7 +21,6 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.jpackage.tests;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import jdk.jpackage.test.Annotations.Test;
|
||||
@ -37,7 +36,7 @@ import jdk.jpackage.test.JPackageCommand;
|
||||
* @build jdk.jpackage.test.*
|
||||
* @compile MultipleJarAppTest.java
|
||||
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
|
||||
* --jpt-run=jdk.jpackage.tests.MultipleJarAppTest
|
||||
* --jpt-run=MultipleJarAppTest
|
||||
*/
|
||||
|
||||
public final class MultipleJarAppTest {
|
@ -21,7 +21,6 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.jpackage.tests;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
@ -47,7 +46,7 @@ import jdk.jpackage.test.HelloApp;
|
||||
* @build jdk.jpackage.test.*
|
||||
* @compile NoMPathRuntimeTest.java
|
||||
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
|
||||
* --jpt-run=jdk.jpackage.tests.NoMPathRuntimeTest
|
||||
* --jpt-run=NoMPathRuntimeTest
|
||||
*/
|
||||
|
||||
public final class NoMPathRuntimeTest {
|
@ -21,7 +21,6 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.jpackage.tests;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -37,7 +36,7 @@ import jdk.jpackage.test.TKit;
|
||||
* @build jdk.jpackage.test.*
|
||||
* @compile NonExistentTest.java
|
||||
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
|
||||
* --jpt-run=jdk.jpackage.tests.NonExistentTest
|
||||
* --jpt-run=NonExistentTest
|
||||
*/
|
||||
|
||||
public final class NonExistentTest {
|
@ -21,7 +21,6 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.jpackage.tests;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
@ -42,11 +41,11 @@ import jdk.jpackage.test.TKit;
|
||||
* @compile PredefinedAppImageErrorTest.java
|
||||
*
|
||||
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
|
||||
* --jpt-run=jdk.jpackage.tests.PredefinedAppImageErrorTest
|
||||
* --jpt-run=PredefinedAppImageErrorTest
|
||||
* --jpt-before-run=jdk.jpackage.test.JPackageCommand.useExecutableByDefault
|
||||
*
|
||||
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
|
||||
* --jpt-run=jdk.jpackage.tests.PredefinedAppImageErrorTest
|
||||
* --jpt-run=PredefinedAppImageErrorTest
|
||||
* --jpt-before-run=jdk.jpackage.test.JPackageCommand.useToolProviderByDefault
|
||||
*/
|
||||
|
@ -21,7 +21,6 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.jpackage.tests;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
import jdk.jpackage.test.TKit;
|
||||
@ -38,7 +37,7 @@ import jdk.jpackage.test.JPackageCommand;
|
||||
* @compile UnicodeArgsTest.java
|
||||
* @requires (os.family == "windows")
|
||||
* @run main/othervm/timeout=720 -Xmx512m jdk.jpackage.test.Main
|
||||
* --jpt-run=jdk.jpackage.tests.UnicodeArgsTest
|
||||
* --jpt-run=UnicodeArgsTest
|
||||
*/
|
||||
|
||||
public final class UnicodeArgsTest {
|
@ -21,7 +21,6 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.jpackage.tests;
|
||||
|
||||
import jdk.jpackage.test.PackageTest;
|
||||
import jdk.jpackage.test.PackageType;
|
||||
@ -61,7 +60,7 @@ import jdk.jpackage.test.Annotations.Test;
|
||||
* @build jdk.jpackage.test.*
|
||||
* @compile VendorTest.java
|
||||
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
|
||||
* --jpt-run=jdk.jpackage.tests.VendorTest
|
||||
* --jpt-run=VendorTest
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -74,7 +73,7 @@ import jdk.jpackage.test.Annotations.Test;
|
||||
* @build jdk.jpackage.test.*
|
||||
* @compile VendorTest.java
|
||||
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
|
||||
* --jpt-run=jdk.jpackage.tests.VendorTest
|
||||
* --jpt-run=VendorTest
|
||||
*/
|
||||
public class VendorTest {
|
||||
|
@ -22,7 +22,6 @@
|
||||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import jdk.jpackage.test.TKit;
|
||||
import jdk.jpackage.test.PackageTest;
|
||||
@ -37,8 +36,6 @@ import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import jdk.jpackage.test.Executor;
|
||||
|
||||
import static jdk.jpackage.test.WindowsHelper.getTempDirectory;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary Custom l10n of msi installers in jpackage
|
||||
@ -182,9 +179,8 @@ public class WinL10nTest {
|
||||
}
|
||||
|
||||
// Preserve config dir to check the set of copied l10n files.
|
||||
Path tempDir = getTempDirectory(cmd, tempRoot);
|
||||
Files.createDirectories(tempDir.getParent());
|
||||
cmd.addArguments("--temp", tempDir.toString());
|
||||
Path tempDir = tempRoot.resolve(cmd.packageType().name());
|
||||
cmd.addArguments("--temp", tempDir);
|
||||
})
|
||||
.addBundleVerifier((cmd, result) -> {
|
||||
if (expectedCultures != null) {
|
||||
@ -213,7 +209,7 @@ public class WinL10nTest {
|
||||
v.createCmdOutputVerifier(wixSrcDir).apply(getBuildCommandLine(result));
|
||||
}
|
||||
}
|
||||
Path tempDir = getTempDirectory(cmd, tempRoot).toAbsolutePath();
|
||||
var tempDir = Path.of(cmd.getArgumentValue("--temp")).toAbsolutePath();
|
||||
for (var v : createDefaultL10nFilesLocVerifiers(tempDir)) {
|
||||
v.apply(getBuildCommandLine(result));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user