author | ehelin |
Wed, 07 Aug 2013 16:47:32 +0200 | |
changeset 19322 | e35f9ed4f081 |
parent 19150 | 32f41bad4250 |
child 20281 | e4d33bd980c4 |
permissions | -rw-r--r-- |
18071 | 1 |
/* |
2 |
* Copyright (c) 2013, 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 |
package com.oracle.java.testlibrary; |
|
25 |
||
26 |
public class Platform { |
|
27 |
private static final String osName = System.getProperty("os.name"); |
|
28 |
private static final String dataModel = System.getProperty("sun.arch.data.model"); |
|
29 |
private static final String vmVersion = System.getProperty("java.vm.version"); |
|
19150
32f41bad4250
7073961: [TESTBUG] closed/runtime/4845371/DBB.java failed on solaris 10 X65
hseigel
parents:
18071
diff
changeset
|
30 |
private static final String osArch = System.getProperty("os.arch"); |
18071 | 31 |
|
32 |
public static boolean is64bit() { |
|
33 |
return dataModel.equals("64"); |
|
34 |
} |
|
35 |
||
36 |
public static boolean isSolaris() { |
|
37 |
return osName.toLowerCase().startsWith("sunos"); |
|
38 |
} |
|
39 |
||
40 |
public static boolean isWindows() { |
|
41 |
return osName.toLowerCase().startsWith("win"); |
|
42 |
} |
|
43 |
||
44 |
public static boolean isOSX() { |
|
45 |
return osName.toLowerCase().startsWith("mac"); |
|
46 |
} |
|
47 |
||
48 |
public static boolean isLinux() { |
|
49 |
return osName.toLowerCase().startsWith("linux"); |
|
50 |
} |
|
51 |
||
52 |
public static String getOsName() { |
|
53 |
return osName; |
|
54 |
} |
|
55 |
||
56 |
public static boolean isDebugBuild() { |
|
57 |
return vmVersion.toLowerCase().contains("debug"); |
|
58 |
} |
|
59 |
||
60 |
public static String getVMVersion() { |
|
61 |
return vmVersion; |
|
62 |
} |
|
19150
32f41bad4250
7073961: [TESTBUG] closed/runtime/4845371/DBB.java failed on solaris 10 X65
hseigel
parents:
18071
diff
changeset
|
63 |
|
32f41bad4250
7073961: [TESTBUG] closed/runtime/4845371/DBB.java failed on solaris 10 X65
hseigel
parents:
18071
diff
changeset
|
64 |
// Returns true for sparc and sparcv9. |
32f41bad4250
7073961: [TESTBUG] closed/runtime/4845371/DBB.java failed on solaris 10 X65
hseigel
parents:
18071
diff
changeset
|
65 |
public static boolean isSparc() { |
32f41bad4250
7073961: [TESTBUG] closed/runtime/4845371/DBB.java failed on solaris 10 X65
hseigel
parents:
18071
diff
changeset
|
66 |
return osArch.toLowerCase().startsWith("sparc"); |
32f41bad4250
7073961: [TESTBUG] closed/runtime/4845371/DBB.java failed on solaris 10 X65
hseigel
parents:
18071
diff
changeset
|
67 |
} |
32f41bad4250
7073961: [TESTBUG] closed/runtime/4845371/DBB.java failed on solaris 10 X65
hseigel
parents:
18071
diff
changeset
|
68 |
|
32f41bad4250
7073961: [TESTBUG] closed/runtime/4845371/DBB.java failed on solaris 10 X65
hseigel
parents:
18071
diff
changeset
|
69 |
public static String getOsArch() { |
32f41bad4250
7073961: [TESTBUG] closed/runtime/4845371/DBB.java failed on solaris 10 X65
hseigel
parents:
18071
diff
changeset
|
70 |
return osArch; |
32f41bad4250
7073961: [TESTBUG] closed/runtime/4845371/DBB.java failed on solaris 10 X65
hseigel
parents:
18071
diff
changeset
|
71 |
} |
32f41bad4250
7073961: [TESTBUG] closed/runtime/4845371/DBB.java failed on solaris 10 X65
hseigel
parents:
18071
diff
changeset
|
72 |
|
18071 | 73 |
} |