author | herrick |
Wed, 16 Oct 2019 10:32:08 -0400 | |
branch | JDK-8200758-branch |
changeset 58648 | 3bf53ffa9ae7 |
parent 58464 | d82489644b15 |
child 58993 | b5e1baa9d2c3 |
permissions | -rw-r--r-- |
58464
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
1 |
/* |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
2 |
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
4 |
* |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
8 |
* |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
13 |
* accompanied this code). |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
14 |
* |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
18 |
* |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
21 |
* questions. |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
22 |
*/ |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
23 |
|
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
24 |
import java.nio.file.Path; |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
25 |
import jdk.jpackage.test.JPackageCommand; |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
26 |
import jdk.jpackage.test.TKit; |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
27 |
|
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
28 |
/** |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
29 |
* Tests generation of app image with --mac-sign and related arguments. Test will |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
30 |
* generate app image and verify signature of main launcher and app bundle itself. |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
31 |
* This test requires that machine is configured with test certificate for |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
32 |
* "Developer ID Application: jpackage.openjdk.java.net" in jpackagerTest keychain with |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
33 |
* always allowed access to this keychain for user which runs test. |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
34 |
*/ |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
35 |
|
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
36 |
/* |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
37 |
* @test |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
38 |
* @summary jpackage with --package-type app-image --mac-sign |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
39 |
* @library ../helpers |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
40 |
* @library /test/lib |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
41 |
* @library base |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
42 |
* @build SigningBase |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
43 |
* @build SigningCheck |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
44 |
* @build jtreg.SkippedException |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
45 |
* @build jdk.jpackage.test.* |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
46 |
* @modules jdk.jpackage/jdk.jpackage.internal |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
47 |
* @requires (os.family == "mac") |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
48 |
* @run main/othervm -Xmx512m SigningAppImageTest |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
49 |
*/ |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
50 |
public class SigningAppImageTest { |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
51 |
|
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
52 |
public static void main(String[] args) throws Exception { |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
53 |
TKit.run(args, () -> { |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
54 |
SigningCheck.checkCertificates(); |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
55 |
|
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
56 |
JPackageCommand cmd = JPackageCommand.helloAppImage(); |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
57 |
cmd.addArguments("--mac-sign", "--mac-signing-key-user-name", |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
58 |
SigningBase.DEV_NAME, "--mac-signing-keychain", |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
59 |
"jpackagerTest.keychain"); |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
60 |
cmd.executeAndAssertHelloAppImageCreated(); |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
61 |
|
58648 | 62 |
Path launcherPath = cmd.appLauncherPath(); |
58464
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
63 |
SigningBase.verifyCodesign(launcherPath, true); |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
64 |
|
58648 | 65 |
Path appImage = cmd.outputBundle(); |
58464
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
66 |
SigningBase.verifyCodesign(appImage, true); |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
67 |
SigningBase.verifySpctl(appImage, "exec"); |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
68 |
}); |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
69 |
} |
d82489644b15
8215895: Verify and create tests for Mac installer specific signing options
herrick
parents:
diff
changeset
|
70 |
} |