tools/FxTestRunner/src/client/test/runner/TestScript.java

Print this page

        

*** 47,56 **** --- 47,60 ---- import java.lang.reflect.Method; import java.net.ServerSocket; import java.net.Socket; import java.net.URL; import java.net.UnknownHostException; + import java.util.ArrayList; + import java.util.HashSet; + import java.util.List; + import java.util.Set; import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; import java.util.logging.Level; import java.util.logging.Logger; import org.junit.runner.RunWith;
*** 332,348 **** String additionalOptions = getAdditionalOptions(); String[] jvmVmOptions = savedEnv.lookup(BasicFXInterview.VM_OPTIONS_PARAM_NAME); String jvmArgPrismOrder = getJvmArgPrismOrder(); - //TODO (SG): is this still required? - String jvmArgLibraryPath = ""; - if (fxSdkHome != null) { - jvmArgLibraryPath = "-Djava.library.path=" + fxSdkHome + File.separator + "rt"; - } // String externaloutput = lookup(BasicFXInterview.EXTERNALOUTPUT, ""); // if (externaloutput != null) { // jvmArgImageUtils = "-Dimageutils.outputpath=" + externaloutput + File.separator; // } --- 336,365 ---- String additionalOptions = getAdditionalOptions(); String[] jvmVmOptions = savedEnv.lookup(BasicFXInterview.VM_OPTIONS_PARAM_NAME); + String[] xPatch = savedEnv.lookup(BasicFXInterview.XPATCH_PARAM_NAME); + String xPatchArg = ""; + if (xPatch != null && xPatch.length > 0) { + File xPatchFile = new File(xPatch[0]); + xPatchArg = xPatchFile.getAbsolutePath(); + } + + boolean enableAddExports = YesNoQuestion.YES.equals(lookup( + BasicFXInterview.ENABLE_ADD_EXPORTS_PARAM_NAME, YesNoQuestion.NO)); + + String noAddExportsArg = enableAddExports ? null : "-DnoAddExports=true"; + + String addExportsArg[] = enableAddExports + ? combineAddExports( + savedEnv.lookup(BasicFXInterview.ADD_EXPORTS_PARAM_NAME), + td.getParameter(RunUITestFinder.ADD_EXPORTS)) + : null; + String jvmArgPrismOrder = getJvmArgPrismOrder(); // String externaloutput = lookup(BasicFXInterview.EXTERNALOUTPUT, ""); // if (externaloutput != null) { // jvmArgImageUtils = "-Dimageutils.outputpath=" + externaloutput + File.separator; // }
*** 372,382 **** final boolean isFXCompatibility = System.getProperty("java.class.path").contains("JavaFXCompatibility"); String ipV4 = isFXCompatibility ? "-Djava.net.preferIPv4Stack=true" : ""; String swtTestOpt = ""; try { ! if (System.getProperty("os.name").toLowerCase().indexOf("mac") >= 0) { RunWith wunWithAnnotation = Class.forName(testClassName).getAnnotation(RunWith.class); if ((wunWithAnnotation != null) && (wunWithAnnotation.value().equals(CanvasRunner.class))) { swtTestOpt = "-XstartOnFirstThread"; System.out.println("Use -XstartOnFirstThread option, as we on MacOS, and SWT test is run."); } --- 389,399 ---- final boolean isFXCompatibility = System.getProperty("java.class.path").contains("JavaFXCompatibility"); String ipV4 = isFXCompatibility ? "-Djava.net.preferIPv4Stack=true" : ""; String swtTestOpt = ""; try { ! if (System.getProperty("os.name").toLowerCase().contains("mac")) { RunWith wunWithAnnotation = Class.forName(testClassName).getAnnotation(RunWith.class); if ((wunWithAnnotation != null) && (wunWithAnnotation.value().equals(CanvasRunner.class))) { swtTestOpt = "-XstartOnFirstThread"; System.out.println("Use -XstartOnFirstThread option, as we on MacOS, and SWT test is run."); }
*** 388,410 **** String jvmArgClientTestRoot = "-DtestRoot=" + RunUITestFinder.testRoot; String[] command = new String[]{}; command = addToArray(command, javaExec.trim()); command = addToArray(command, jvmVmOptions); command = addToArray(command, lookAndFeelOptions); command = addToArray(command, ipV4); ! command = addToArray(command, jvmArgPrismOrder, jvmArgLibraryPath, jvmArgImageUtils); command = addToArray(command, additionalOptions); command = addToArray(command, jvmArgNoDesc, jvmProxyHost, jvmProxyPort, jvmInterop, swtTestOpt); command = addToArray(command, jvmArgClientTestRoot); command = addToArray(command, "-DmasterPort=" + port); command = addToArray(command, "-classpath", System.getProperty("java.class.path")); // command = addToArray(command, "-Xdebug", "-Xnoagent", "-Djava.compiler=NONE", "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5858"); command = addToArray(command, isJunit ? JUnit2TestRunner.class.getName() : TestRunner.class.getName(), testClassName); return command; } /** * * @param td * @param resultDir * @return --- 405,464 ---- String jvmArgClientTestRoot = "-DtestRoot=" + RunUITestFinder.testRoot; String[] command = new String[]{}; command = addToArray(command, javaExec.trim()); command = addToArray(command, jvmVmOptions); + if (addExportsArg != null) { + command = addToArray(command, addExportsArg); + } else if (noAddExportsArg != null) { + command = addToArray(command, noAddExportsArg); + } + if (xPatchArg != null && !xPatchArg.isEmpty()) { + command = addToArray(command, "-Xpatch:" + xPatchArg); + } command = addToArray(command, lookAndFeelOptions); command = addToArray(command, ipV4); ! command = addToArray(command, jvmArgPrismOrder, jvmArgImageUtils); command = addToArray(command, additionalOptions); command = addToArray(command, jvmArgNoDesc, jvmProxyHost, jvmProxyPort, jvmInterop, swtTestOpt); command = addToArray(command, jvmArgClientTestRoot); command = addToArray(command, "-DmasterPort=" + port); command = addToArray(command, "-classpath", System.getProperty("java.class.path")); // command = addToArray(command, "-Xdebug", "-Xnoagent", "-Djava.compiler=NONE", "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5858"); command = addToArray(command, isJunit ? JUnit2TestRunner.class.getName() : TestRunner.class.getName(), testClassName); return command; } + static String[] combineAddExports(String[] addExportsArray, String addExportsValue) { + if (addExportsValue == null) { + return combineAddExports(addExportsArray); + } else { + String[] newArray = new String[addExportsArray.length + 1]; + System.arraycopy(addExportsArray, 0, newArray, 1, addExportsArray.length); + newArray[0] = addExportsValue; + return combineAddExports(newArray); + } + } + + static String[] combineAddExports(String[] addExportsArray) { + List<String> addExportsList = new ArrayList<>(); + for (String addExports : addExportsArray) { + if (addExports != null) { + for (String value : addExports.split("\\s*,\\s*")) { + if (!value.isEmpty() && !addExportsList.contains(value.trim())) { + addExportsList.add("--add-exports"); + addExportsList.add(value.trim()); + addExportsList.add("--add-opens"); + addExportsList.add(value.trim()); + } + } + } + } + return addExportsList.toArray(new String[addExportsList.size()]); + } + + /** * * @param td * @param resultDir * @return