--- old/test/tools/launcher/ExecutionEnvironment.java Thu Nov 14 14:34:34 2013 +++ new/test/tools/launcher/ExecutionEnvironment.java Thu Nov 14 14:34:33 2013 @@ -140,7 +140,8 @@ env.put(pairs[0], pairs[1]); } - tr = doExec(env, javaCmd, "-jar", testJarFile.getAbsolutePath()); + tr = doExec(env, javaCmd, haveServerVM ? "-server" : "-client", + "-jar", testJarFile.getAbsolutePath()); if (!tr.isNotZeroOutput()) { flagError(tr, "Error: No output at all. Did the test execute ?"); @@ -161,7 +162,9 @@ void testNoExec() { Map env = new HashMap<>(); env.put(JLDEBUG_KEY, "true"); - TestResult tr = doExec(env, javaCmd, "-version"); + TestResult tr = doExec(env, javaCmd, + haveServerVM ? "-server" : "-client", + "-version"); if (tr.testOutput.contains(EXPECTED_MARKER)) { flagError(tr, "testNoExec: found warning <" + EXPECTED_MARKER + "> the process execing ?"); @@ -190,9 +193,10 @@ env.put(pairs[0], pairs[1]); } - tr = doExec(env, javaCmd, "-jar", testJarFile.getAbsolutePath()); + tr = doExec(env, javaCmd, haveServerVM ? "-server" : "-client", + "-jar", testJarFile.getAbsolutePath()); verifyJavaLibraryPathGeneric(tr); - } else { + } else { // Solaris // no override env.clear(); env.put(LD_LIBRARY_PATH, LD_LIBRARY_PATH_VALUE); @@ -244,15 +248,17 @@ TestResult tr = null; - if (is32Bit) { + if (haveClientVM) { tr = doExec(javaCmd, "-client", "-version"); if (!tr.matches(".*Client VM.*")) { flagError(tr, "the expected vm -client did not launch"); } } - tr = doExec(javaCmd, "-server", "-version"); - if (!tr.matches(".*Server VM.*")) { - flagError(tr, "the expected vm -server did not launch"); + if (haveServerVM) { + tr = doExec(javaCmd, "-server", "-version"); + if (!tr.matches(".*Server VM.*")) { + flagError(tr, "the expected vm -server did not launch"); + } } } --- old/test/tools/launcher/Test7029048.java Thu Nov 14 14:34:36 2013 +++ new/test/tools/launcher/Test7029048.java Thu Nov 14 14:34:36 2013 @@ -208,6 +208,10 @@ System.out.println("Note: applicable on neither Windows nor MacOSX"); return; } + if (!TestHelper.haveServerVM) { + System.out.println("Note: test relies on server vm, not found, exiting"); + return; + } // create our test jar first ExecutionEnvironment.createTestJar(); --- old/test/tools/launcher/TestHelper.java Thu Nov 14 14:34:38 2013 +++ new/test/tools/launcher/TestHelper.java Thu Nov 14 14:34:37 2013 @@ -67,11 +67,15 @@ static final String JAVAHOME = System.getProperty("java.home"); static final String JAVA_BIN; static final String JAVA_JRE_BIN; + static final String JAVA_LIB; + static final String JAVA_JRE_LIB; static final boolean isSDK = JAVAHOME.endsWith("jre"); static final String javaCmd; static final String javawCmd; static final String javacCmd; static final String jarCmd; + static final boolean haveServerVM; + static final boolean haveClientVM; static final JavaCompiler compiler; @@ -88,6 +92,7 @@ System.getProperty("os.name", "unknown").startsWith("SunOS"); static final boolean isLinux = System.getProperty("os.name", "unknown").startsWith("Linux"); + static final String JVM_DLL = isWindows ? "jvm.dll" : "libjvm.so"; static final boolean isSparc = System.getProperty("os.arch").startsWith("sparc"); @@ -124,6 +129,7 @@ throw new RuntimeException("arch model is not 32 or 64 bit ?"); } compiler = ToolProvider.getSystemJavaCompiler(); + File binDir = (isSDK) ? new File((new File(JAVAHOME)).getParentFile(), "bin") : new File(JAVAHOME, "bin"); @@ -130,6 +136,14 @@ JAVA_BIN = binDir.getAbsolutePath(); JAVA_JRE_BIN = new File((new File(JAVAHOME)).getParentFile(), (isSDK) ? "jre/bin" : "bin").getAbsolutePath(); + + File libDir = (isSDK) + ? new File((new File(JAVAHOME)).getParentFile(), "lib") + : new File(JAVAHOME, "lib"); + JAVA_LIB = libDir.getAbsolutePath(); + JAVA_JRE_LIB = new File((new File(JAVAHOME)).getParentFile(), + (isSDK) ? "jre/lib" : "lib").getAbsolutePath(); + File javaCmdFile = (isWindows) ? new File(binDir, "java.exe") : new File(binDir, "java"); @@ -168,7 +182,22 @@ throw new RuntimeException("java <" + javacCmd + "> must exist and should be executable"); } + + haveClientVM = haveVmVariant("client"); + haveServerVM = haveVmVariant("server"); } + private static boolean haveVmVariant(String type) { + if (isWindows) { + File vmDir = new File(JAVA_JRE_BIN, type); + File jvmFile = new File(vmDir, JVM_DLL); + return jvmFile.exists(); + } else { + File vmDir = new File(JAVA_JRE_LIB, type); + File vmArchDir = new File(vmDir, getJreArch()); + File jvmFile = new File(vmArchDir, JVM_DLL); + return jvmFile.exists(); + } + } void run(String[] args) throws Exception { int passed = 0, failed = 0; final Pattern p = (args != null && args.length > 0)