< prev index next >

test/jdk/tools/launcher/TestSpecialArgs.java

Print this page




 229         envMap.put("CLASSPATH", ".");
 230         tr = doExec(envMap, javaCmd, "Foo", "-XX:NativeMemoryTracking=summary");
 231         checkTestResult(tr);
 232 
 233         // should accept with no warnings
 234         tr = doExec(javaCmd, "-cp", jarFile.getName(),
 235                     "-XX:NativeMemoryTracking=summary", "Foo");
 236         ensureNoWarnings(tr);
 237 
 238         // should accept with no warnings
 239         tr = doExec(javaCmd, "-classpath", jarFile.getName(),
 240                     "-XX:NativeMemoryTracking=summary", "Foo");
 241         ensureNoWarnings(tr);
 242 
 243         // make sure a missing class is handled correctly, because the class
 244         // resolution is performed by the JVM.
 245         tr = doExec(javaCmd, "AbsentClass", "-XX:NativeMemoryTracking=summary");
 246         if (!tr.contains("Error: Could not find or load main class AbsentClass")) {
 247             throw new RuntimeException("Test Fails");
 248         }




 249     }
 250 
 251     void ensureNoWarnings(TestResult tr) {
 252         checkTestResult(tr);
 253         if (tr.contains("warning: Native Memory Tracking")) {
 254             System.err.println(tr.toString());
 255             throw new RuntimeException("Test Fails");
 256         }
 257     }
 258 
 259     void checkTestResult(TestResult tr) {
 260         if (!tr.isOK()) {
 261             System.err.println(tr.toString());
 262             throw new RuntimeException("Test Fails");
 263         }
 264     }
 265 }


 229         envMap.put("CLASSPATH", ".");
 230         tr = doExec(envMap, javaCmd, "Foo", "-XX:NativeMemoryTracking=summary");
 231         checkTestResult(tr);
 232 
 233         // should accept with no warnings
 234         tr = doExec(javaCmd, "-cp", jarFile.getName(),
 235                     "-XX:NativeMemoryTracking=summary", "Foo");
 236         ensureNoWarnings(tr);
 237 
 238         // should accept with no warnings
 239         tr = doExec(javaCmd, "-classpath", jarFile.getName(),
 240                     "-XX:NativeMemoryTracking=summary", "Foo");
 241         ensureNoWarnings(tr);
 242 
 243         // make sure a missing class is handled correctly, because the class
 244         // resolution is performed by the JVM.
 245         tr = doExec(javaCmd, "AbsentClass", "-XX:NativeMemoryTracking=summary");
 246         if (!tr.contains("Error: Could not find or load main class AbsentClass")) {
 247             throw new RuntimeException("Test Fails");
 248         }
 249 
 250         // Make sure we handle correctly the module long form (--module=)
 251         tr = doExec(javaCmd, "-XX:NativeMemoryTracking=summary", "--module=jdk.compiler/com.sun.tools.javac.Main", "--help");
 252         ensureNoWarnings(tr);
 253     }
 254 
 255     void ensureNoWarnings(TestResult tr) {
 256         checkTestResult(tr);
 257         if (tr.contains("warning: Native Memory Tracking")) {
 258             System.err.println(tr.toString());
 259             throw new RuntimeException("Test Fails");
 260         }
 261     }
 262 
 263     void checkTestResult(TestResult tr) {
 264         if (!tr.isOK()) {
 265             System.err.println(tr.toString());
 266             throw new RuntimeException("Test Fails");
 267         }
 268     }
 269 }
< prev index next >