jdk/test/tools/launcher/ExecutionEnvironment.java
changeset 30034 a0f26b338318
parent 28115 3931c251d78f
child 37540 e92d95400f31
equal deleted inserted replaced
30033:b9c86c17164a 30034:a0f26b338318
     1 /*
     1 /*
     2  * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   182     void testJavaLibraryPath() {
   182     void testJavaLibraryPath() {
   183         TestResult tr = null;
   183         TestResult tr = null;
   184 
   184 
   185         Map<String, String> env = new HashMap<>();
   185         Map<String, String> env = new HashMap<>();
   186 
   186 
   187         if (TestHelper.isLinux || TestHelper.isMacOSX || TestHelper.isAIX) {
   187         if (TestHelper.isSolaris) {
   188             for (String x : LD_PATH_STRINGS) {
       
   189                 String pairs[] = x.split("=");
       
   190                 env.put(pairs[0], pairs[1]);
       
   191             }
       
   192 
       
   193             tr = doExec(env, javaCmd, "-jar", testJarFile.getAbsolutePath());
       
   194             verifyJavaLibraryPathGeneric(tr);
       
   195         } else { // Solaris
       
   196             // no override
   188             // no override
   197             env.clear();
   189             env.clear();
   198             env.put(LD_LIBRARY_PATH, LD_LIBRARY_PATH_VALUE);
   190             env.put(LD_LIBRARY_PATH, LD_LIBRARY_PATH_VALUE);
   199             tr = doExec(env, javaCmd, "-jar", testJarFile.getAbsolutePath());
   191             tr = doExec(env, javaCmd, "-jar", testJarFile.getAbsolutePath());
   200             verifyJavaLibraryPathGeneric(tr);
   192             verifyJavaLibraryPathGeneric(tr);
   206             }
   198             }
   207 
   199 
   208             // verify the override occurs for 64-bit system
   200             // verify the override occurs for 64-bit system
   209             tr = doExec(env, javaCmd, "-jar", testJarFile.getAbsolutePath());
   201             tr = doExec(env, javaCmd, "-jar", testJarFile.getAbsolutePath());
   210             verifyJavaLibraryPathOverride(tr, false);
   202             verifyJavaLibraryPathOverride(tr, false);
       
   203         } else {
       
   204             for (String x : LD_PATH_STRINGS) {
       
   205                 String pairs[] = x.split("=");
       
   206                 env.put(pairs[0], pairs[1]);
       
   207             }
       
   208 
       
   209             tr = doExec(env, javaCmd, "-jar", testJarFile.getAbsolutePath());
       
   210             verifyJavaLibraryPathGeneric(tr);
   211         }
   211         }
   212     }
   212     }
   213 
   213 
   214     private void verifyJavaLibraryPathGeneric(TestResult tr) {
   214     private void verifyJavaLibraryPathGeneric(TestResult tr) {
   215         if (!tr.matches("java.library.path=.*" + LD_LIBRARY_PATH_VALUE + ".*")) {
   215         if (!tr.matches("java.library.path=.*" + LD_LIBRARY_PATH_VALUE + ".*")) {