📄 runlist.java
字号:
if ( jvmflags != null ) p.put("jvmflags", jvmflags); if ( classpath != null ) p.put("classpath", classpath); if ( classpathServer != null ) p.put("classpathServer", classpathServer); if ( systemdiff != null ) p.put("systemdiff", systemdiff); if ( verbose == true ) p.put("verbose", "true"); if ( bootcp != null ) p.put("bootcp", "bootcp"); if ( canondir != null ) p.put("canondir", canondir); if ( (outputdir == null) || (outputdir.length() == 0) ) { outputdir = p.getProperty("outputdir"); if (outputdir == null) outputdir = userdir; } // framework may be set at the top, or just // set for individual suites if ( parentProperties.getProperty("framework") != null ) p.put("framework", framework); else framework = p.getProperty("framework"); // same for serverJvm and serverJvmName if ( parentProperties.getProperty("serverJvm") != null ) p.put("serverJvm", serverJvm); else serverJvm = p.getProperty("serverJvm"); if ( parentProperties.getProperty("serverJvmName") != null ) p.put("serverJvmName", serverJvmName); else serverJvmName = p.getProperty("serverJvmName"); // Encryption may be set at the top or just for a subsuite if ( parentProperties.getProperty("encryption") != null ) p.put("encryption", encryption); else encryption = p.getProperty("encryption"); // Encryption provider may be set at the top or just for a subsuite if ( parentProperties.getProperty("testEncryptionProvider") != null ) p.put("testEncryptionProvider", testEncryptionProvider); else testEncryptionProvider = p.getProperty("testEncryptionProvider"); // jdk12test may be set at the top or just for a subsuite if ( parentProperties.getProperty("jdk12test") != null ) p.put("jdk12test", jdk12test); else jdk12test = p.getProperty("jdk12test"); // jdk12exttest may be set at the top or just for a subsuite if ( parentProperties.getProperty("jdk12exttest") != null ) p.put("jdk12exttest", jdk12exttest); else jdk12exttest = p.getProperty("jdk12exttest"); // jdk14test may be set at the top or just for a subsuite if ( parentProperties.getProperty("jdk14test") != null ) p.put("jdk14test", jdk14test); else jdk14test = p.getProperty("jdk14test"); // runwithibmjvm may be set at the top or just for a subsuite if ( parentProperties.getProperty("runwithibmjvm") != null ) p.put("runwithibmjvm", runwithibmjvm); else runwithibmjvm = p.getProperty("runwithibmjvm"); // runwithjvm may be set at the top or just for a subsuite String testJVM = (jvmName.startsWith("j9") ? "j9" : jvmName); if ( parentProperties.getProperty("runwith" + testJVM) != null ) p.put("runwith" + testJVM, runwithjvm); else runwithjvm = p.getProperty("runwith" + testJVM); // runwithj9 may be set at the top or just for a subsuite if ( parentProperties.getProperty("runwithj9") != null ) p.put("runwithj9", runwithj9); else runwithj9 = p.getProperty("runwithj9"); // excludeJCC may be set at the top or just for a subsuite if ( parentProperties.getProperty("excludeJCC") != null ) p.put("excludeJCC", excludeJCC); else excludeJCC = p.getProperty("excludeJCC"); // useprocess may be set at the top or just for a subsuite String upr = parentProperties.getProperty("useprocess"); if ( upr != null ) p.put("useprocess", upr); else { upr = p.getProperty("useprocess"); if ( upr == null) useprocess = true; else if (upr.equals("false")) useprocess = false; else useprocess = true; } // properties specific to a single suite usesystem = p.getProperty("usesystem"); shutdownurl = p.getProperty("shutdownurl"); upgradetest = p.getProperty("upgradetest"); jarfile = p.getProperty("jarfile"); skipsed = p.getProperty("skipsed"); if (skipsed == null) skipsed = "false"; if ( "true".equals(keepfiles) ) p.put("keepfiles", keepfiles); // testJavaFlags should get appended String testflags = p.getProperty("testJavaFlags"); if ( parentProperties.getProperty("testJavaFlags") != null ) { if ( (testflags != null) && (!testflags.equals(testJavaFlags)) ) { testJavaFlags = testJavaFlags + "^" + testflags; } p.put("testJavaFlags", testJavaFlags); } else testJavaFlags = p.getProperty("testJavaFlags"); // The following could change between suites or // may be set for the whole set of suites if ( parentProperties.getProperty("reportstderr") != null ) p.put("reportstderr", reportstderr); else reportstderr = p.getProperty("reportstderr"); if ( parentProperties.getProperty("timeout") != null ) p.put("timeout", timeout); else timeout = p.getProperty("timeout"); // outcopy is very specific to a single suite outcopy = p.getProperty("outcopy"); // useoutput is very specific to a single suite useoutput = p.getProperty("useoutput"); // mtestdir is very specific to a multi suite mtestdir = p.getProperty("mtestdir"); // ijdefaultResourcePackage is specific for a suite ijdefaultResourcePackage = p.getProperty("ij.defaultResourcePackage"); if ( topSuiteName == null ) topSuiteName = p.getProperty("suitename"); else p.put("suitename", topSuiteName); skip = shouldSkipTest(); // Set the suite subdir under top outputdir setSuiteDir(suiteName, isParent, isTop); // This individual suite may also have special flags // Reset otherSpecialProps in case another suite had any set otherSpecialProps = ""; Properties specialProps = SpecialFlags.getSpecialProperties(p); if ( (specialProps != null) && (!specialProps.isEmpty()) ) // Add any special properties to suiteJavaFlags string setSpecialProps(specialProps, false); } /** Determine if a test should be skipped or not. These are ad-hoc rules, see comments within for details. Examples of what is checked: JVM version, framework, encryption, jdk12test, Sets some global variables so that skip reporting is clearer. @return true if test should not be run. */ private static boolean shouldSkipTest() { boolean result = false; // figure out if suite should be skipped ... adhoc rules boolean isJdk12 = false; // really now 'isJdk12orHigher' boolean isJdk14 = false; boolean isJdk15 = false; boolean isJdk118 = false; boolean isJdk117 = false; boolean isEncryption = false; boolean isJdk12Test = false; boolean isJdk12ExtTest = false; boolean isJdk14Test = false; boolean isSyncTest = false; boolean isSyncProduct = false; boolean isExcludeJCC = false; // runwithibmjvm is really tri-state. null = run-anywhere, // true = only ibm jvms, false = only non-IBM jvms. // reset skip reason parameters driverNotFound = false; needSync = false; needJdk12 = false; needJdk12ext = false; needJdk14 = false; excludedFromJCC = false; needIBMjvm = null; // Determine if this is jdk12 or higher (with or without extensions) if (iminor >= 2) isJdk12 = true; if ( System.getProperty("java.version").startsWith("1.1.8") ) isJdk118 = true; if ( System.getProperty("java.version").startsWith("1.1.7") ) isJdk117 = true; if ( System.getProperty("java.version").startsWith("1.4.") ) isJdk14 = true; if ( System.getProperty("java.version").startsWith("1.5.") ) isJdk15 = true; // if a test needs an ibm jvm, skip if runwithibmjvm is true. // if a test needs to not run in an ibm jvm, skip if runwithibmjvm is false. // if null, continue in all cases. if (runwithibmjvm != null) { if (runwithibmjvm.equals("")) { needIBMjvm = null; } else { needIBMjvm = new Boolean(runwithibmjvm); } } if (runwithibmjvm == null) { needIBMjvm = null; } if (needIBMjvm != null) { boolean needsibm = needIBMjvm.booleanValue(); boolean ibmjvm = false; String vendor = System.getProperty("java.vendor"); if (vendor.startsWith("IBM")) { ibmjvm = true; } if (!needsibm && ibmjvm) { return true; } if (needsibm && !ibmjvm) { return true; } } if (runwithjvm != null && runwithjvm.equals("false")) { return true; } if ( (framework != null) && (framework.length()>0) ) { if (framework.equals("DerbyNet")) { // skip if the derbynet.jar is not in the Classpath try { Class.forName("org.apache.derby.drda.NetworkServerControl"); } catch (ClassNotFoundException cnfe) { driverNotFound = true; result = true; } // skip if the IBM Universal JDBC Driver is not in the Classpath // note that that driver loads some javax.naming.* classes which may not // be present at runtime, and thus we need to catch a possible error too try { Class.forName("com.ibm.db2.jcc.DB2Driver"); } catch (ClassNotFoundException cnfe) { driverNotFound = true; result = true; } catch (NoClassDefFoundError err) { driverNotFound = true; result = true; } } } if (result) return true; // stop looking once know should skip if ( (encryption != null) && (encryption.length()>0) ) if ("true".equalsIgnoreCase(encryption)) isEncryption = true; if ( (jdk12test != null) && (jdk12test.length()>0) ) if ("true".equalsIgnoreCase(jdk12test)) isJdk12Test = true; if ( (jdk12exttest != null) && (jdk12exttest.length()>0) ) if ("true".equalsIgnoreCase(jdk12exttest)) isJdk12ExtTest = true; if ( (jdk14test != null) && (jdk14test.length()>0) ) if ("true".equalsIgnoreCase(jdk14test)) isJdk14Test = true; // Skip any suite if jvm is not jdk12 or higher for encryption, jdk12test or jdk12exttest if (!isJdk12) { if ( (isEncryption) || (isJdk12Test) || (isJdk12ExtTest) ) { needJdk12 = true; result = true; // Can't run in this combination } if (result) return true; // stop looking once know should skip } // Skip any suite if jvm is not jdk14 or higher for jdk14test if ((!isJdk14 && !isJdk15) && isJdk14Test) { needJdk14 = true; return true; } // Also require jdk12 extensions for encryption and jdk12exttest if ( (isEncryption) || (isJdk12ExtTest) ) { needJdk12ext = true; // Check for extensions try { Class jtaClass = Class.forName("javax.transaction.xa.Xid"); Class jdbcClass = Class.forName("javax.sql.RowSet"); } catch (ClassNotFoundException cnfe) { // at least one of the extension classes was not found result = true; // skip this test } if (result) return true; // stop looking once know should skip } if (isEncryption) // make sure encryption classes are available { needEncryption = true; try { Class jceClass = Class.forName("javax.crypto.Cipher"); } catch (ClassNotFoundException cnfe) { result = true; } if (result) return true; } if (excludeJCC != null) { Class c = null; Method m = null; Object o = null; Integer i = null; int jccMajor = 0; int jccMinor = 0; try { c = Class.forName("com.ibm.db2.jcc.DB2Driver"); o = c.newInstance(); m = c.getMethod("getMajorVersion", null); i = (Integer)m.invoke(o, null); jccMajor = i.intValue(); m = c.getMethod("getMinorVersion", null); i = (Integer)m.invoke(o, null); jccMinor = i.intValue(); } catch (Exception e) { if (verbose) System.out.println("Exception in shouldSkipTest: " + e); } try { checkClientExclusion(excludeJCC, "JCC", jccMajor, jccMinor, javaVersion); } catch (Exception e) { excludedFromJCC = true; clientExclusionMessage = e.getMessage(); return true; } } return result; // last test result is returned } public static void setSuiteDir(String suiteName, boolean isParent, boolean isTop) throws IOException { if (isTop) // This is the very top suite for this RunList { // Here we want to set the topsuitedir if ( (topsuitedir == null) || (topsuitedir.length() == 0) ) { topsuitedir = userdir; outputdir = topsuitedir; } else outputdir = topsuitedir; // Create the topsuite directory under the outputdir File topdir = new File(outputdir, topSuiteName); topdir.mkdir(); if (!topParentSuite.equals(topSuiteName)) { File topparent = new File(topdir, topParentSuite);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -