Skip to content

Commit 2c509a1

Browse files
author
Alexey Semenyuk
committed
8344326: Move jpackage tests from "jdk.jpackage.tests" package to the default package
Reviewed-by: almatvee
1 parent 41a2d49 commit 2c509a1

21 files changed

+37
-80
lines changed

test/jdk/tools/jpackage/helpers/jdk/jpackage/test/WindowsHelper.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -64,22 +64,6 @@ private static Path getInstallationSubDirectory(JPackageCommand cmd) {
6464
return Path.of(cmd.getArgumentValue("--install-dir", cmd::name));
6565
}
6666

67-
// Tests have problems on windows where path in the temp dir are too long
68-
// for the wix tools. We can't use a tempDir outside the TKit's WorkDir, so
69-
// we minimize both the tempRoot directory name (above) and the tempDir name
70-
// (below) to the extension part (which is necessary to differenciate between
71-
// the multiple PackageTypes that will be run for one JPackageCommand).
72-
// It might be beter if the whole work dir name was shortened from:
73-
// jtreg_open_test_jdk_tools_jpackage_share_jdk_jpackage_tests_BasicTest_java.
74-
public static Path getTempDirectory(JPackageCommand cmd, Path tempRoot) {
75-
String ext = cmd.outputBundle().getFileName().toString();
76-
int i = ext.lastIndexOf(".");
77-
if (i > 0 && i < (ext.length() - 1)) {
78-
ext = ext.substring(i+1);
79-
}
80-
return tempRoot.resolve(ext);
81-
}
82-
8367
private static void runMsiexecWithRetries(Executor misexec) {
8468
Executor.Result result = null;
8569
for (int attempt = 0; attempt < 8; ++attempt) {

test/jdk/tools/jpackage/linux/jdk/jpackage/tests/UsrTreeTest.java renamed to test/jdk/tools/jpackage/linux/UsrTreeTest.java

File renamed without changes.

test/jdk/tools/jpackage/share/jdk/jpackage/tests/AppVersionTest.java renamed to test/jdk/tools/jpackage/share/AppVersionTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
* questions.
2222
*/
2323

24-
package jdk.jpackage.tests;
2524

2625
import java.io.IOException;
2726
import java.util.Collection;
@@ -46,7 +45,7 @@
4645
* @build jdk.jpackage.test.*
4746
* @compile AppVersionTest.java
4847
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
49-
* --jpt-run=jdk.jpackage.tests.AppVersionTest
48+
* --jpt-run=AppVersionTest
5049
*/
5150

5251
public final class AppVersionTest {

test/jdk/tools/jpackage/share/jdk/jpackage/tests/BasicTest.java renamed to test/jdk/tools/jpackage/share/BasicTest.java

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
* questions.
2222
*/
2323

24-
package jdk.jpackage.tests;
2524

2625
import java.io.IOException;
2726
import java.nio.file.Files;
@@ -45,16 +44,14 @@
4544
import jdk.jpackage.test.Functional.ThrowingConsumer;
4645
import static jdk.jpackage.test.RunnablePackageTest.Action.CREATE_AND_UNPACK;
4746

48-
import static jdk.jpackage.test.WindowsHelper.getTempDirectory;
49-
5047
/*
5148
* @test
5249
* @summary jpackage basic testing
5350
* @library /test/jdk/tools/jpackage/helpers
5451
* @build jdk.jpackage.test.*
5552
* @compile BasicTest.java
5653
* @run main/othervm/timeout=720 -Xmx512m jdk.jpackage.test.Main
57-
* --jpt-run=jdk.jpackage.tests.BasicTest
54+
* --jpt-run=BasicTest
5855
*/
5956

6057
public final class BasicTest {
@@ -345,7 +342,7 @@ public void testTemp(TestTempType type) throws IOException {
345342
// Force save of package bundle in test work directory.
346343
.addInitializer(JPackageCommand::setDefaultInputOutput)
347344
.addInitializer(cmd -> {
348-
Path tempDir = getTempDirectory(cmd, tempRoot);
345+
Path tempDir = tempRoot.resolve(cmd.packageType().name());
349346
switch (type) {
350347
case TEMPDIR_EMPTY -> Files.createDirectories(tempDir);
351348
case TEMPDIR_NOT_EXIST -> Files.createDirectories(tempDir.getParent());
@@ -362,20 +359,16 @@ public void testTemp(TestTempType type) throws IOException {
362359
if (TestTempType.TEMPDIR_NOT_EMPTY.equals(type)) {
363360
pkgTest.setExpectedExitCode(1).addBundleVerifier(cmd -> {
364361
// Check jpackage didn't use the supplied directory.
365-
Path tempDir = getTempDirectory(cmd, tempRoot);
366-
String[] tempDirContents = tempDir.toFile().list();
367-
TKit.assertStringListEquals(List.of("foo.txt"), List.of(
368-
tempDirContents), String.format(
369-
"Check the contents of the supplied temporary directory [%s]",
370-
tempDir));
362+
Path tempDir = Path.of(cmd.getArgumentValue("--temp"));
363+
TKit.assertDirectoryContent(tempDir).match(Path.of("foo.txt"));
371364
TKit.assertStringListEquals(List.of("Hello Duke!"),
372-
Files.readAllLines(tempDir.resolve(tempDirContents[0])),
365+
Files.readAllLines(tempDir.resolve("foo.txt")),
373366
"Check the contents of the file in the supplied temporary directory");
374367
});
375368
} else {
376369
pkgTest.addBundleVerifier(cmd -> {
377370
// Check jpackage used the supplied directory.
378-
Path tempDir = getTempDirectory(cmd, tempRoot);
371+
Path tempDir = Path.of(cmd.getArgumentValue("--temp"));
379372
TKit.assertDirectoryNotEmpty(tempDir);
380373
});
381374
}

test/jdk/tools/jpackage/share/jdk/jpackage/tests/CookedRuntimeTest.java renamed to test/jdk/tools/jpackage/share/CookedRuntimeTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
* questions.
2222
*/
2323

24-
package jdk.jpackage.tests;
2524

2625
import java.io.IOException;
2726
import java.nio.file.Files;
@@ -46,7 +45,7 @@
4645
* @build jdk.jpackage.test.*
4746
* @compile CookedRuntimeTest.java
4847
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
49-
* --jpt-run=jdk.jpackage.tests.CookedRuntimeTest
48+
* --jpt-run=CookedRuntimeTest
5049
*/
5150

5251
public final class CookedRuntimeTest {

test/jdk/tools/jpackage/share/jdk/jpackage/tests/DotInNameTest.java renamed to test/jdk/tools/jpackage/share/DotInNameTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
* questions.
2222
*/
2323

24-
package jdk.jpackage.tests;
2524

2625
import jdk.jpackage.test.JPackageCommand;
2726
import jdk.jpackage.test.HelloApp;
@@ -37,7 +36,7 @@
3736
* @build jdk.jpackage.test.*
3837
* @compile DotInNameTest.java
3938
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
40-
* --jpt-run=jdk.jpackage.tests.DotInNameTest
39+
* --jpt-run=DotInNameTest
4140
* --jpt-before-run=jdk.jpackage.test.JPackageCommand.useToolProviderByDefault
4241
*/
4342

test/jdk/tools/jpackage/share/jdk/jpackage/tests/ErrorTest.java renamed to test/jdk/tools/jpackage/share/ErrorTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
* questions.
2222
*/
2323

24-
package jdk.jpackage.tests;
2524

2625
import java.util.Collection;
2726
import java.util.List;
@@ -37,7 +36,7 @@
3736
* @build jdk.jpackage.test.*
3837
* @compile ErrorTest.java
3938
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
40-
* --jpt-run=jdk.jpackage.tests.ErrorTest
39+
* --jpt-run=ErrorTest
4140
* --jpt-before-run=jdk.jpackage.test.JPackageCommand.useExecutableByDefault
4241
*/
4342

@@ -48,7 +47,7 @@
4847
* @build jdk.jpackage.test.*
4948
* @compile ErrorTest.java
5049
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
51-
* --jpt-run=jdk.jpackage.tests.ErrorTest
50+
* --jpt-run=ErrorTest
5251
* --jpt-before-run=jdk.jpackage.test.JPackageCommand.useToolProviderByDefault
5352
*/
5453

test/jdk/tools/jpackage/share/jdk/jpackage/tests/JLinkOptionsTest.java renamed to test/jdk/tools/jpackage/share/JLinkOptionsTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
* questions.
2222
*/
2323

24-
package jdk.jpackage.tests;
2524

2625
import java.util.Collection;
2726
import java.util.List;
@@ -37,7 +36,7 @@
3736
* @build jdk.jpackage.test.*
3837
* @compile JLinkOptionsTest.java
3938
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
40-
* --jpt-run=jdk.jpackage.tests.JLinkOptionsTest
39+
* --jpt-run=JLinkOptionsTest
4140
*/
4241

4342
public final class JLinkOptionsTest {

test/jdk/tools/jpackage/share/jdk/jpackage/tests/JavaOptionsEqualsTest.java renamed to test/jdk/tools/jpackage/share/JavaOptionsEqualsTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
* questions.
2222
*/
2323

24-
package jdk.jpackage.tests;
2524

2625
import java.util.Collection;
2726
import java.util.List;
@@ -39,7 +38,7 @@
3938
* @build jdk.jpackage.test.*
4039
* @compile JavaOptionsEqualsTest.java
4140
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
42-
* --jpt-run=jdk.jpackage.tests.JavaOptionsEqualsTest
41+
* --jpt-run=JavaOptionsEqualsTest
4342
* --jpt-before-run=jdk.jpackage.test.JPackageCommand.useExecutableByDefault
4443
*/
4544

@@ -50,7 +49,7 @@
5049
* @build jdk.jpackage.test.*
5150
* @compile JavaOptionsEqualsTest.java
5251
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
53-
* --jpt-run=jdk.jpackage.tests.JavaOptionsEqualsTest
52+
* --jpt-run=JavaOptionsEqualsTest
5453
* --jpt-before-run=jdk.jpackage.test.JPackageCommand.useToolProviderByDefault
5554
*/
5655

test/jdk/tools/jpackage/share/jdk/jpackage/tests/JavaOptionsTest.java renamed to test/jdk/tools/jpackage/share/JavaOptionsTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
* questions.
2222
*/
2323

24-
package jdk.jpackage.tests;
2524

2625
import java.util.Collection;
2726
import java.util.List;
@@ -39,7 +38,7 @@
3938
* @build jdk.jpackage.test.*
4039
* @compile JavaOptionsTest.java
4140
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
42-
* --jpt-run=jdk.jpackage.tests.JavaOptionsTest
41+
* --jpt-run=JavaOptionsTest
4342
* --jpt-before-run=jdk.jpackage.test.JPackageCommand.useToolProviderByDefault
4443
*/
4544

0 commit comments

Comments
 (0)