< prev index next >

test/jdk/tools/launcher/Test7029048.java

Print this page
rev 53718 : 8217216: Launcher does not defend itself against LD_LIBRARY_PATH_64 (Solaris)

@@ -21,11 +21,11 @@
  * questions.
  */
 
 /**
  * @test
- * @bug 7029048 8217340
+ * @bug 7029048 8217340 8217216
  * @summary Ensure that the launcher defends against user settings of the
  *          LD_LIBRARY_PATH environment variable on Unixes
  * @library /test/lib
  * @compile -XDignore.symbol.file ExecutionEnvironment.java Test7029048.java
  * @run main Test7029048

@@ -87,10 +87,33 @@
         System.out.println(tr);
         analyze(tr, nLLPComponents, caseID);
     }
 
     static void analyze(TestResult tr, int nLLPComponents, String caseID) {
+        if (isSolaris) {
+            String envValue = getValue("LD_LIBRARY_PATH_64", tr.testOutput);
+           /*
+            * the envValue can never be null, since the test code should always
+            * print a "null" string.
+            */
+            if (envValue == null) {
+                throw new RuntimeException("NPE, likely a program crash ??");
+            }
+            boolean noLLP64 = envValue.equals("null");
+            if (nLLPComponents == 0 && noLLP64) {
+                System.out.println("FAIL: test7029048, " + caseID);
+                System.out.println(" Missing LD_LIBRARY_PATH_64");
+                errors++;
+                return;
+            } else if (nLLPComponents > 3 && !noLLP64) {
+                System.out.println("FAIL: test7029048, " + caseID);
+                System.out.println(" Unexpected LD_LIBRARY_PATH_64: " + envValue);
+                errors++;
+                return;
+            }
+        }
+
         String envValue = getValue(LD_LIBRARY_PATH, tr.testOutput);
        /*
         * the envValue can never be null, since the test code should always
         * print a "null" string.
         */

@@ -200,12 +223,12 @@
                  * java64 LLP_64 is relevant, LLP_32 is ignored
                  */
                 env.clear();
                 env.put(LD_LIBRARY_PATH_64, dstServerDir.getAbsolutePath());
                 run(env,
-                    v.value,            // Do not add one, since we didn't set
-                                        // LD_LIBRARY_PATH here
+                    // LD_LIBRARY_PATH_64 is copied into LD_LIBRARY_PATH for LIBJVM case
+                    v.value == 0 ? 0 : v.value + 1,
                     "Case 3: " + desc);
             }
         }
         return;
     }
< prev index next >