Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/tools/jpackage/macosx/SigningAppImageTest.java
51315 views
1
/*
2
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
import java.nio.file.Path;
25
import jdk.jpackage.test.JPackageCommand;
26
import jdk.jpackage.test.Annotations.Test;
27
28
/**
29
* Tests generation of app image with --mac-sign and related arguments. Test will
30
* generate app image and verify signature of main launcher and app bundle itself.
31
* This test requires that machine is configured with test certificate for
32
* "Developer ID Application: jpackage.openjdk.java.net" or alternately
33
* "Developer ID Application: " + name specified by system property:
34
* "jpackage.mac.signing.key.user.name"
35
* in the jpackagerTest keychain (or alternately the keychain specified with
36
* the system property "jpackage.mac.signing.keychain".
37
* If this certificate is self-signed, it must have be set to
38
* always allowe access to this keychain" for user which runs test.
39
* (If cert is real (not self signed), the do not set trust to allow.)
40
*/
41
42
/*
43
* @test
44
* @summary jpackage with --type app-image --mac-sign
45
* @library ../helpers
46
* @library /test/lib
47
* @library base
48
* @build SigningBase
49
* @build SigningCheck
50
* @build jtreg.SkippedException
51
* @build jdk.jpackage.test.*
52
* @build SigningAppImageTest
53
* @modules jdk.jpackage/jdk.jpackage.internal
54
* @requires (os.family == "mac")
55
* @run main/othervm -Xmx512m jdk.jpackage.test.Main
56
* --jpt-run=SigningAppImageTest
57
*/
58
public class SigningAppImageTest {
59
60
@Test
61
public static void test() throws Exception {
62
SigningCheck.checkCertificates();
63
64
JPackageCommand cmd = JPackageCommand.helloAppImage();
65
cmd.addArguments("--mac-sign", "--mac-signing-key-user-name",
66
SigningBase.DEV_NAME, "--mac-signing-keychain",
67
SigningBase.KEYCHAIN);
68
cmd.executeAndAssertHelloAppImageCreated();
69
70
Path launcherPath = cmd.appLauncherPath();
71
SigningBase.verifyCodesign(launcherPath, true);
72
73
Path appImage = cmd.outputBundle();
74
SigningBase.verifyCodesign(appImage, true);
75
SigningBase.verifySpctl(appImage, "exec");
76
}
77
}
78
79