8341443: [macos] AppContentTest and SigningOptionsTest failed due to "codesign" does not fails with "--app-content" on macOS 15
Reviewed-by: asemenyuk
This commit is contained in:
parent
33e4bfdf91
commit
85e0e6452d
@ -91,8 +91,17 @@ public final class SigningOptionsTest {
|
||||
new String[]{"--type"},
|
||||
"Option [--mac-installer-sign-identity] is not valid with type"},
|
||||
// --app-content and --type app-image
|
||||
// JDK-8340802: "codesign" may or may not fail if additional
|
||||
// content is specified based on macOS version. For example on
|
||||
// macOS 15 aarch64 "codesign" will not fail with additional content.
|
||||
// Since we only need to check that warning is displayed when
|
||||
// "codesign" fails and "--app-content" is provided, lets fail
|
||||
// "codesign" for some better reason like identity which does not
|
||||
// exists.
|
||||
{"Hello",
|
||||
new String[]{"--app-content", TEST_DUKE},
|
||||
new String[]{"--app-content", TEST_DUKE,
|
||||
"--mac-sign",
|
||||
"--mac-app-image-sign-identity", "test-identity"},
|
||||
null,
|
||||
"\"codesign\" failed and additional application content" +
|
||||
" was supplied via the \"--app-content\" parameter."},
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -34,6 +34,7 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import jdk.internal.util.OSVersion;
|
||||
|
||||
/**
|
||||
* Tests generation of packages with input folder containing empty folders.
|
||||
@ -48,6 +49,7 @@ import java.util.List;
|
||||
* @build jdk.jpackage.test.*
|
||||
* @build AppContentTest
|
||||
* @modules jdk.jpackage/jdk.jpackage.internal
|
||||
* @modules java.base/jdk.internal.util
|
||||
* @run main/othervm/timeout=720 -Xmx512m jdk.jpackage.test.Main
|
||||
* --jpt-run=AppContentTest
|
||||
*/
|
||||
@ -81,6 +83,17 @@ public class AppContentTest {
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
|
||||
// On macOS signing may or may not work for modified app bundles.
|
||||
// It works on macOS 15 and up, but fails on macOS below 15.
|
||||
final int expectedJPackageExitCode;
|
||||
final boolean isMacOS15 = (OSVersion.current().compareTo(
|
||||
new OSVersion(15, 0, 0)) > 0);
|
||||
if (testPathArgs.contains(TEST_BAD) || (TKit.isOSX() && !isMacOS15)) {
|
||||
expectedJPackageExitCode = 1;
|
||||
} else {
|
||||
expectedJPackageExitCode = 0;
|
||||
}
|
||||
|
||||
new PackageTest().configureHelloApp()
|
||||
.addInitializer(cmd -> {
|
||||
for (String arg : testPathArgs) {
|
||||
@ -99,9 +112,7 @@ public class AppContentTest {
|
||||
}
|
||||
|
||||
})
|
||||
// On macOS we always signing app image and signing will fail, since
|
||||
// test produces invalid app bundle.
|
||||
.setExpectedExitCode(testPathArgs.contains(TEST_BAD) || TKit.isOSX() ? 1 : 0)
|
||||
.setExpectedExitCode(expectedJPackageExitCode)
|
||||
.run();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user