author | kvn |
Thu, 05 Dec 2013 15:13:12 -0800 | |
changeset 22858 | f4a6f0eba875 |
parent 20201 | 50cc2d25a60b |
child 22066 | f2133b498789 |
permissions | -rw-r--r-- |
11687
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
1 |
/* |
20201
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
11687
diff
changeset
|
2 |
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. |
11687
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
4 |
* |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
8 |
* |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
13 |
* accompanied this code). |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
14 |
* |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
18 |
* |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
21 |
* questions. |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
22 |
*/ |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
23 |
|
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
24 |
/** |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
25 |
* @test |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
26 |
* @bug 4894330 4810347 6277269 |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
27 |
* @compile -XDignore.symbol.file ChangeDataModel.java |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
28 |
* @run main ChangeDataModel |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
29 |
* @summary Verify -d32 and -d64 options are accepted(rejected) on all platforms |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
30 |
* @author Joseph D. Darcy, ksrini |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
31 |
*/ |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
32 |
import java.io.File; |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
33 |
|
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
34 |
public class ChangeDataModel extends TestHelper { |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
35 |
private static final File TestJar = new File("test" + JAR_FILE_EXT); |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
36 |
private static final String OPT_PREFIX = "ARCH_OPT:"; |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
37 |
|
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
38 |
public static void main(String... args) throws Exception { |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
39 |
String[] code = { |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
40 |
" public static void main(String argv[]) {", |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
41 |
" System.out.println(\"" + OPT_PREFIX + "-d\" + System.getProperty(\"sun.arch.data.model\", \"none\"));", |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
42 |
" }", |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
43 |
}; |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
44 |
createJar(TestJar, code); |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
45 |
|
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
46 |
// verify if data model flag for default data model is accepted |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
47 |
if (is32Bit) { |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
48 |
checkAcceptance(javaCmd, "-d32"); |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
49 |
} else if (is64Bit) { |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
50 |
checkAcceptance(javaCmd, "-d64"); |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
51 |
} else { |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
52 |
throw new Error("unsupported data model"); |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
53 |
} |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
54 |
|
20201
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
11687
diff
changeset
|
55 |
// Negative tests: ensure that non-dual mode systems reject the |
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
11687
diff
changeset
|
56 |
// complementary (other) data model |
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
11687
diff
changeset
|
57 |
if (is32Bit) { |
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
11687
diff
changeset
|
58 |
checkRejection(javaCmd, "-d64"); |
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
11687
diff
changeset
|
59 |
} else if (is64Bit) { |
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
11687
diff
changeset
|
60 |
checkRejection(javaCmd, "-d32"); |
11687
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
61 |
} else { |
20201
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
11687
diff
changeset
|
62 |
throw new Error("unsupported data model"); |
11687
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
63 |
} |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
64 |
} |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
65 |
|
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
66 |
static void checkAcceptance(String cmd, String dmodel) { |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
67 |
TestResult tr = doExec(cmd, dmodel, "-jar", TestJar.getAbsolutePath()); |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
68 |
if (!tr.contains(OPT_PREFIX + dmodel)) { |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
69 |
System.out.println(tr); |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
70 |
String message = "Data model flag " + dmodel + |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
71 |
" not accepted or had improper effect."; |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
72 |
throw new RuntimeException(message); |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
73 |
} |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
74 |
} |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
75 |
|
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
76 |
static void checkRejection(String cmd, String dmodel) { |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
77 |
TestResult tr = doExec(cmd, dmodel, "-jar", TestJar.getAbsolutePath()); |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
78 |
if (tr.contains(OPT_PREFIX + dmodel)) { |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
79 |
System.out.println(tr); |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
80 |
String message = "Data model flag " + dmodel + " was accepted."; |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
81 |
throw new RuntimeException(message); |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
82 |
} |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
83 |
} |
f13cadbb0bb5
7127906: (launcher) convert the launcher regression tests to java
ksrini
parents:
diff
changeset
|
84 |
} |