< prev index next >

test/jdk/tools/launcher/ExecutionEnvironment.java

Print this page
rev 59105 : imported patch corelibs


 157     /*
 158      * ensures that there are no execs as long as we are in the same
 159      * data model
 160      */
 161     @Test
 162     void testNoExec() {
 163         Map<String, String> env = new HashMap<>();
 164         env.put(JLDEBUG_KEY, "true");
 165         TestResult tr = doExec(env, javaCmd, "-version");
 166         if (tr.testOutput.contains(EXPECTED_MARKER)) {
 167             flagError(tr, "testNoExec: found  warning <" + EXPECTED_MARKER +
 168                     "> the process execing ?");
 169         }
 170     }
 171 
 172     /*
 173      * This test ensures that LD_LIBRARY_PATH* values are interpreted by the VM
 174      * and the expected java.library.path behaviour.
 175      * For Generic platforms (All *nixes):
 176      *    * All LD_LIBRARY_PATH variable should be on java.library.path
 177      * For Solaris 32-bit
 178      *    * The LD_LIBRARY_PATH_32 should override LD_LIBRARY_PATH if specified
 179      * For Solaris 64-bit
 180      *    * The LD_LIBRARY_PATH_64 should override LD_LIBRARY_PATH if specified
 181      */
 182     @Test
 183     void testJavaLibraryPath() {
 184         TestResult tr;
 185 
 186         Map<String, String> env = new HashMap<>();
 187 
 188         if (TestHelper.isSolaris) {
 189             // no override
 190             env.clear();
 191             env.put(LD_LIBRARY_PATH, LD_LIBRARY_PATH_VALUE);
 192             tr = doExec(env, javaCmd, "-jar", testJarFile.getAbsolutePath());
 193             verifyJavaLibraryPathGeneric(tr);
 194 
 195             env.clear();
 196             for (String x : LD_PATH_STRINGS) {
 197                 String pairs[] = x.split("=");
 198                 env.put(pairs[0], pairs[1]);
 199             }
 200 
 201             // verify the override occurs for 64-bit system
 202             tr = doExec(env, javaCmd, "-jar", testJarFile.getAbsolutePath());
 203             verifyJavaLibraryPathOverride(tr, false);
 204         } else {
 205             for (String x : LD_PATH_STRINGS) {
 206                 String pairs[] = x.split("=");
 207                 env.put(pairs[0], pairs[1]);
 208             }
 209 
 210             tr = doExec(env, javaCmd, "-jar", testJarFile.getAbsolutePath());
 211             verifyJavaLibraryPathGeneric(tr);
 212         }
 213     }
 214 
 215     private void verifyJavaLibraryPathGeneric(TestResult tr) {
 216         if (!tr.matches("java.library.path=.*" + LD_LIBRARY_PATH_VALUE + ".*")) {
 217             flagError(tr, "testJavaLibraryPath: java.library.path does not contain " +
 218                     LD_LIBRARY_PATH_VALUE);
 219         }
 220     }
 221 
 222     private void verifyJavaLibraryPathOverride(TestResult tr,
 223             boolean is32Bit) {
 224         // make sure the 32/64 bit value exists
 225         if (!tr.matches("java.library.path=.*" +
 226                 (is32Bit ? LD_LIBRARY_PATH_32_VALUE : LD_LIBRARY_PATH_64_VALUE) + ".*")) {
 227             flagError(tr, "verifyJavaLibraryPathOverride: " +
 228                 " java.library.path does not contain " +
 229                     (is32Bit ? LD_LIBRARY_PATH_32_VALUE : LD_LIBRARY_PATH_64_VALUE));
 230 
 231         }
 232         // make sure the generic value is absent




 157     /*
 158      * ensures that there are no execs as long as we are in the same
 159      * data model
 160      */
 161     @Test
 162     void testNoExec() {
 163         Map<String, String> env = new HashMap<>();
 164         env.put(JLDEBUG_KEY, "true");
 165         TestResult tr = doExec(env, javaCmd, "-version");
 166         if (tr.testOutput.contains(EXPECTED_MARKER)) {
 167             flagError(tr, "testNoExec: found  warning <" + EXPECTED_MARKER +
 168                     "> the process execing ?");
 169         }
 170     }
 171 
 172     /*
 173      * This test ensures that LD_LIBRARY_PATH* values are interpreted by the VM
 174      * and the expected java.library.path behaviour.
 175      * For Generic platforms (All *nixes):
 176      *    * All LD_LIBRARY_PATH variable should be on java.library.path




 177      */
 178     @Test
 179     void testJavaLibraryPath() {
 180         TestResult tr;
 181 
 182         Map<String, String> env = new HashMap<>();
 183 

















 184         for (String x : LD_PATH_STRINGS) {
 185             String pairs[] = x.split("=");
 186             env.put(pairs[0], pairs[1]);
 187         }
 188 
 189         tr = doExec(env, javaCmd, "-jar", testJarFile.getAbsolutePath());
 190         verifyJavaLibraryPathGeneric(tr);

 191     }
 192 
 193     private void verifyJavaLibraryPathGeneric(TestResult tr) {
 194         if (!tr.matches("java.library.path=.*" + LD_LIBRARY_PATH_VALUE + ".*")) {
 195             flagError(tr, "testJavaLibraryPath: java.library.path does not contain " +
 196                     LD_LIBRARY_PATH_VALUE);
 197         }
 198     }
 199 
 200     private void verifyJavaLibraryPathOverride(TestResult tr,
 201             boolean is32Bit) {
 202         // make sure the 32/64 bit value exists
 203         if (!tr.matches("java.library.path=.*" +
 204                 (is32Bit ? LD_LIBRARY_PATH_32_VALUE : LD_LIBRARY_PATH_64_VALUE) + ".*")) {
 205             flagError(tr, "verifyJavaLibraryPathOverride: " +
 206                 " java.library.path does not contain " +
 207                     (is32Bit ? LD_LIBRARY_PATH_32_VALUE : LD_LIBRARY_PATH_64_VALUE));
 208 
 209         }
 210         // make sure the generic value is absent


< prev index next >