Mercurial > hg > truffle
annotate test/runtime/6981737/Test6981737.java @ 17947:1772223a25a2
8037112: gc/g1/TestHumongousAllocInitialMark.java caused SIGSEGV
Reviewed-by: brutisso, mgerdin
author | pliden |
---|---|
date | Fri, 11 Apr 2014 11:00:12 +0200 |
parents | 35f885165c69 |
children |
rev | line source |
---|---|
1956
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
1 /* |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
2 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
4 * |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
8 * |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
13 * accompanied this code). |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
14 * |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
18 * |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
21 * questions. |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
22 */ |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
23 |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
24 /* |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
25 * @test Test6981737.java |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
26 * @bug 6981737 |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
27 * @summary check for correct vm properties |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
28 * @run main Test6981737 |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
29 * @author kamg |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
30 */ |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
31 |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
32 public class Test6981737 { |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
33 |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
34 /** |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
35 * Check the 'vendor' properties java.vm.specification.version |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
36 * property. Before jdk7, they should be "Sun Micro..." and "1.0". |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
37 * In jdk7 onwards they should be "Oracle..." and "1.<major_version>" |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
38 */ |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
39 public static void main(String[] args) throws Exception { |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
40 |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
41 String version = verifyProperty("java.version", "[0-9]+\\.[0-9]+\\..*"); |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
42 String major_version_spec = version.split("\\.")[1]; |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
43 int major_version = new Integer(major_version_spec).intValue(); |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
44 |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
45 String vendor_re = "Oracle Corporation"; |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
46 String vm_spec_version_re = "1\\." + major_version_spec; |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
47 if (major_version < 7) { |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
48 vendor_re = "Sun Microsystems Inc\\."; |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
49 vm_spec_version_re = "1\\.0"; |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
50 } |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
51 verifyProperty("java.vendor", vendor_re); |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
52 verifyProperty("java.vm.vendor", vendor_re); |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
53 verifyProperty("java.vm.specification.vendor", vendor_re); |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
54 verifyProperty("java.specification.vendor", vendor_re); |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
55 verifyProperty("java.vm.specification.version", vm_spec_version_re); |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
56 System.out.println("PASS"); |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
57 } |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
58 |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
59 public static String verifyProperty(String name, String expected_re) { |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
60 String value = System.getProperty(name, ""); |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
61 System.out.print("Checking " + name + ": \"" + value + |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
62 "\".matches(\"" + expected_re + "\")... "); |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
63 if (!value.matches(expected_re)) { |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
64 System.out.println("no."); |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
65 throw new RuntimeException("FAIL: Wrong value for " + name + |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
66 " property, \"" + value + "\", expected to be of form: \"" + |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
67 expected_re + "\""); |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
68 } |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
69 System.out.println("yes."); |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
70 return value; |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
71 } |
35f885165c69
6981737: The java.vm.specification.version property is 1.0, seems like it should be 2.0
kamg
parents:
diff
changeset
|
72 } |