< prev index next >

test/lib/jdk/test/lib/Platform.java

Print this page
@  rev 55753 : 8228434: jdk/net/Sockets/Test.java fails after JDK-8227642
|  Reviewed-by: duke
~


  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 jdk.test.lib;
  25 
  26 import java.io.File;
  27 import java.io.IOException;
  28 import java.io.RandomAccessFile;
  29 import java.util.regex.Pattern;
  30 import java.security.AccessController;
  31 import java.security.PrivilegedAction;
  32 import java.security.PrivilegedActionException;
  33 import java.security.PrivilegedExceptionAction;
  34 
  35 public class Platform {


  36     // Use this property to specify docker location on your system.
  37     // E.g.: "/usr/local/bin/docker". We define this constant here so
  38     // that it can be used in VMProps as well which checks docker support
  39     // via this command
  40     public static final String DOCKER_COMMAND =
  41         System.getProperty("jdk.test.docker.command", "docker");





  42     public  static final String vmName      = privilegedGetProperty("java.vm.name");
  43     public  static final String vmInfo      = privilegedGetProperty("java.vm.info");
  44     private static final String osVersion   = privilegedGetProperty("os.version");
  45     private static       int osVersionMajor = -1;
  46     private static       int osVersionMinor = -1;
  47     private static final String osName      = privilegedGetProperty("os.name");
  48     private static final String dataModel   = privilegedGetProperty("sun.arch.data.model");
  49     private static final String vmVersion   = privilegedGetProperty("java.vm.version");
  50     private static final String jdkDebug    = privilegedGetProperty("jdk.debug");
  51     private static final String osArch      = privilegedGetProperty("os.arch");
  52     private static final String userName    = privilegedGetProperty("user.name");
  53     private static final String compiler    = privilegedGetProperty("sun.management.compiler");
  54 
  55     private static String privilegedGetProperty(String key) {
  56         return AccessController.doPrivileged((
  57                 PrivilegedAction<String>) () -> System.getProperty(key));
  58     }
  59 
  60     public static boolean isClient() {
  61         return vmName.endsWith(" Client VM");




  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 jdk.test.lib;
  25 
  26 import java.io.File;
  27 import java.io.IOException;
  28 import java.io.RandomAccessFile;
  29 import java.util.regex.Pattern;
  30 import java.security.AccessController;
  31 import java.security.PrivilegedAction;
  32 import java.security.PrivilegedActionException;
  33 import java.security.PrivilegedExceptionAction;
  34 
  35 public class Platform {
  36 
  37     public static class Docker {
  38         // Use this property to specify docker location on your system.
  39         // E.g.: "/usr/local/bin/docker". We define this constant here so
  40         // that it can be used in VMProps as well which checks docker support
  41         // via this command
  42         public static final String DOCKER_COMMAND = privilegedGetProperty("jdk.test.docker.command", "docker");
  43 
  44         private static String privilegedGetProperty(String key, String defaultValue) {
  45             PrivilegedAction<String> pa = () -> System.getProperty(key, defaultValue);
  46             return AccessController.doPrivileged(pa);
  47         }
  48     }
  49     public  static final String vmName      = privilegedGetProperty("java.vm.name");
  50     public  static final String vmInfo      = privilegedGetProperty("java.vm.info");
  51     private static final String osVersion   = privilegedGetProperty("os.version");
  52     private static       int osVersionMajor = -1;
  53     private static       int osVersionMinor = -1;
  54     private static final String osName      = privilegedGetProperty("os.name");
  55     private static final String dataModel   = privilegedGetProperty("sun.arch.data.model");
  56     private static final String vmVersion   = privilegedGetProperty("java.vm.version");
  57     private static final String jdkDebug    = privilegedGetProperty("jdk.debug");
  58     private static final String osArch      = privilegedGetProperty("os.arch");
  59     private static final String userName    = privilegedGetProperty("user.name");
  60     private static final String compiler    = privilegedGetProperty("sun.management.compiler");
  61 
  62     private static String privilegedGetProperty(String key) {
  63         return AccessController.doPrivileged((
  64                 PrivilegedAction<String>) () -> System.getProperty(key));
  65     }
  66 
  67     public static boolean isClient() {
  68         return vmName.endsWith(" Client VM");


< prev index next >