Skip to content

Commit b2da0d3

Browse files
author
Alexey Semenyuk
committed
8352289: [macos] Review skipped tests in tools/jpackage/macosx/SigningPackage*
Reviewed-by: almatvee
1 parent ba658a7 commit b2da0d3

10 files changed

+73
-298
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -747,10 +747,10 @@ public String getValue(CannedFormattedString str) {
747747

748748
public JPackageCommand validateOutput(CannedFormattedString... str) {
749749
// Will look up the given errors in the order they are specified.
750-
return validateOutput(Stream.of(str)
751-
.map(this::getValue)
750+
Stream.of(str).map(this::getValue)
752751
.map(TKit::assertTextStream)
753-
.reduce(TKit.TextStreamVerifier::andThen).get());
752+
.reduce(TKit.TextStreamVerifier::andThen).ifPresent(this::validateOutput);
753+
return this;
754754
}
755755

756756
public boolean isWithToolProvider() {

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,10 @@ private PListWrapper(String xml) throws ParserConfigurationException,
397397
private final org.w3c.dom.Document doc;
398398
}
399399

400+
public static boolean isXcodeDevToolsInstalled() {
401+
return Inner.XCODE_DEV_TOOLS_INSTALLED;
402+
}
403+
400404
private static DocumentBuilder createDocumentBuilder() throws
401405
ParserConfigurationException {
402406
DocumentBuilderFactory dbf = DocumentBuilderFactory.newDefaultInstance();
@@ -432,6 +436,11 @@ private static Method initGetServicePListFileName() {
432436
}
433437
}
434438

439+
private static final class Inner {
440+
private static final boolean XCODE_DEV_TOOLS_INSTALLED =
441+
Executor.of("/usr/bin/xcrun", "--help").executeWithoutExitCodeCheck().getExitCode() == 0;
442+
}
443+
435444
static final Set<Path> CRITICAL_RUNTIME_FILES = Set.of(Path.of(
436445
"Contents/Home/lib/server/libjvm.dylib"));
437446

test/jdk/tools/jpackage/macosx/SigningAppImageTest.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,14 @@
4646
* @test
4747
* @summary jpackage with --type app-image --mac-sign
4848
* @library /test/jdk/tools/jpackage/helpers
49-
* @library /test/lib
5049
* @library base
5150
* @build SigningBase
52-
* @build SigningCheck
53-
* @build jtreg.SkippedException
5451
* @build jdk.jpackage.test.*
5552
* @build SigningAppImageTest
56-
* @requires (os.family == "mac")
53+
* @requires (jpackage.test.MacSignTests == "run")
5754
* @run main/othervm/timeout=720 -Xmx512m jdk.jpackage.test.Main
5855
* --jpt-run=SigningAppImageTest
56+
* --jpt-before-run=SigningBase.verifySignTestEnvReady
5957
*/
6058
public class SigningAppImageTest {
6159

@@ -72,8 +70,6 @@ public class SigningAppImageTest {
7270
public void test(boolean doSign, boolean signingKey, SigningBase.CertIndex certEnum) throws Exception {
7371
final var certIndex = certEnum.value();
7472

75-
SigningCheck.checkCertificates(certIndex);
76-
7773
JPackageCommand cmd = JPackageCommand.helloAppImage();
7874
if (doSign) {
7975
cmd.addArguments("--mac-sign",

test/jdk/tools/jpackage/macosx/SigningAppImageTwoStepsTest.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,14 @@
4747
* @test
4848
* @summary jpackage with --type app-image --app-image "appImage" --mac-sign
4949
* @library /test/jdk/tools/jpackage/helpers
50-
* @library /test/lib
5150
* @library base
5251
* @build SigningBase
53-
* @build SigningCheck
54-
* @build jtreg.SkippedException
5552
* @build jdk.jpackage.test.*
5653
* @build SigningAppImageTwoStepsTest
57-
* @requires (os.family == "mac")
54+
* @requires (jpackage.test.MacSignTests == "run")
5855
* @run main/othervm/timeout=720 -Xmx512m jdk.jpackage.test.Main
5956
* --jpt-run=SigningAppImageTwoStepsTest
57+
* --jpt-before-run=SigningBase.verifySignTestEnvReady
6058
*/
6159
public class SigningAppImageTwoStepsTest {
6260

@@ -68,11 +66,7 @@ public class SigningAppImageTwoStepsTest {
6866
@Parameter({"true", "false"})
6967
// Unsigned
7068
@Parameter({"false", "true"})
71-
public void test(String... testArgs) throws Exception {
72-
boolean signAppImage = Boolean.parseBoolean(testArgs[0]);
73-
boolean signingKey = Boolean.parseBoolean(testArgs[1]);
74-
75-
SigningCheck.checkCertificates(SigningBase.DEFAULT_INDEX);
69+
public void test(boolean signAppImage, boolean signingKey) throws Exception {
7670

7771
Path appimageOutput = TKit.createTempDirectory("appimage");
7872

test/jdk/tools/jpackage/macosx/SigningOptionsTest.java

Lines changed: 0 additions & 151 deletions
This file was deleted.

test/jdk/tools/jpackage/macosx/SigningPackageFromTwoStepAppImageTest.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,15 @@
5151
* @test
5252
* @summary jpackage with --type pkg,dmg --app-image
5353
* @library /test/jdk/tools/jpackage/helpers
54-
* @library /test/lib
5554
* @library base
5655
* @key jpackagePlatformPackage
5756
* @build SigningBase
58-
* @build SigningCheck
59-
* @build jtreg.SkippedException
6057
* @build jdk.jpackage.test.*
6158
* @build SigningPackageFromTwoStepAppImageTest
62-
* @requires (os.family == "mac")
59+
* @requires (jpackage.test.MacSignTests == "run")
6360
* @run main/othervm/timeout=720 -Xmx512m jdk.jpackage.test.Main
6461
* --jpt-run=SigningPackageFromTwoStepAppImageTest
62+
* --jpt-before-run=SigningBase.verifySignTestEnvReady
6563
*/
6664
public class SigningPackageFromTwoStepAppImageTest {
6765

@@ -103,11 +101,7 @@ private static void verifyAppImageInDMG(JPackageCommand cmd) {
103101
@Parameter({"true", "false"})
104102
// Unsigned
105103
@Parameter({"false", "true"})
106-
public void test(String... testArgs) throws Exception {
107-
boolean signAppImage = Boolean.parseBoolean(testArgs[0]);
108-
boolean signingKey = Boolean.parseBoolean(testArgs[1]);
109-
110-
SigningCheck.checkCertificates(SigningBase.DEFAULT_INDEX);
104+
public void test(boolean signAppImage, boolean signingKey) throws Exception {
111105

112106
Path appimageOutput = TKit.createTempDirectory("appimage");
113107

test/jdk/tools/jpackage/macosx/SigningPackageTest.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,15 @@
4949
* @test
5050
* @summary jpackage with --type pkg,dmg --mac-sign
5151
* @library /test/jdk/tools/jpackage/helpers
52-
* @library /test/lib
5352
* @library base
5453
* @key jpackagePlatformPackage
5554
* @build SigningBase
56-
* @build SigningCheck
57-
* @build jtreg.SkippedException
5855
* @build jdk.jpackage.test.*
5956
* @build SigningPackageTest
60-
* @requires (os.family == "mac")
57+
* @requires (jpackage.test.MacSignTests == "run")
6158
* @run main/othervm/timeout=720 -Xmx512m jdk.jpackage.test.Main
6259
* --jpt-run=SigningPackageTest
60+
* --jpt-before-run=SigningBase.verifySignTestEnvReady
6361
*/
6462
public class SigningPackageTest {
6563

@@ -129,8 +127,6 @@ private static int getCertIndex(JPackageCommand cmd) {
129127
public static void test(boolean signingKey, boolean signAppImage, boolean signPKG, SigningBase.CertIndex certEnum) throws Exception {
130128
final var certIndex = certEnum.value();
131129

132-
SigningCheck.checkCertificates(certIndex);
133-
134130
new PackageTest()
135131
.configureHelloApp()
136132
.forTypes(PackageType.MAC)

test/jdk/tools/jpackage/macosx/SigningPackageTwoStepTest.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,15 @@
5252
* @test
5353
* @summary jpackage with --type pkg,dmg --app-image
5454
* @library /test/jdk/tools/jpackage/helpers
55-
* @library /test/lib
5655
* @library base
5756
* @key jpackagePlatformPackage
5857
* @build SigningBase
59-
* @build SigningCheck
60-
* @build jtreg.SkippedException
6158
* @build jdk.jpackage.test.*
6259
* @build SigningPackageTwoStepTest
63-
* @requires (os.family == "mac")
60+
* @requires (jpackage.test.MacSignTests == "run")
6461
* @run main/othervm/timeout=720 -Xmx512m jdk.jpackage.test.Main
6562
* --jpt-run=SigningPackageTwoStepTest
63+
* --jpt-before-run=SigningBase.verifySignTestEnvReady
6664
*/
6765
public class SigningPackageTwoStepTest {
6866

@@ -107,12 +105,7 @@ private static void verifyAppImageInDMG(JPackageCommand cmd) {
107105
@Parameter({"true", "false"})
108106
// Unsigned
109107
@Parameter({"false", "true"})
110-
public static void test(String... testArgs) throws Exception {
111-
boolean signAppImage = Boolean.parseBoolean(testArgs[0]);
112-
boolean signingKey = Boolean.parseBoolean(testArgs[1]);
113-
114-
SigningCheck.checkCertificates(SigningBase.DEFAULT_INDEX);
115-
108+
public static void test(boolean signAppImage, boolean signingKey) throws Exception {
116109
Path appimageOutput = TKit.createTempDirectory("appimage");
117110

118111
JPackageCommand appImageCmd = JPackageCommand.helloAppImage()

0 commit comments

Comments
 (0)