# HG changeset patch # User iignatyev # Date 1591156882 25200 # Tue Jun 02 21:01:22 2020 -0700 # Node ID 70d80461d4bb915bf61e7cbe94b30fb25179bb48 # Parent a176f9b64054805ac6e07af4c7759de2d9aef608 [mq]: 8246387-jtreg5.1 diff --git a/make/conf/jib-profiles.js b/make/conf/jib-profiles.js --- a/make/conf/jib-profiles.js +++ b/make/conf/jib-profiles.js @@ -1046,10 +1046,10 @@ jtreg: { server: "jpg", product: "jtreg", - version: "5.0", + version: "5.1", build_number: "b01", checksum_file: "MD5_VALUES", - file: "bundles/jtreg_bin-5.0.zip", + file: "bundles/jtreg_bin-5.1.zip", environment_name: "JT_HOME", environment_path: input.get("jtreg", "home_path") + "/bin", configure_args: "--with-jtreg=" + input.get("jtreg", "home_path"), diff --git a/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherDiagnosticInfoObserver.java b/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherDiagnosticInfoObserver.java --- a/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherDiagnosticInfoObserver.java +++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherDiagnosticInfoObserver.java @@ -121,29 +121,4 @@ compileJdk = rp.getCompileJDK().getAbsoluteFile().toPath(); testJdk = rp.getTestJDK().getAbsoluteFile().toPath(); } - - @Override - public void startingTest(TestResult tr) { - // no-op - } - - @Override - public void stoppingTestRun() { - // no-op - } - - @Override - public void finishedTesting() { - // no-op - } - - @Override - public void finishedTestRun(boolean allOK) { - // no-op - } - - @Override - public void error(String msg) { - // no-op - } } diff --git a/test/hotspot/jtreg/TEST.ROOT b/test/hotspot/jtreg/TEST.ROOT --- a/test/hotspot/jtreg/TEST.ROOT +++ b/test/hotspot/jtreg/TEST.ROOT @@ -71,7 +71,7 @@ test.vm.gc.nvdimm # Minimum jtreg version -requiredVersion=5.0 b1 +requiredVersion=5.1 b1 # Path to libraries in the topmost test directory. This is needed so @library # does not need ../../../ notation to reach them diff --git a/test/hotspot/jtreg/runtime/condy/staticInit/TestInitException.java b/test/hotspot/jtreg/runtime/condy/staticInit/TestInitException.java --- a/test/hotspot/jtreg/runtime/condy/staticInit/TestInitException.java +++ b/test/hotspot/jtreg/runtime/condy/staticInit/TestInitException.java @@ -40,13 +40,14 @@ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("Example"); OutputAnalyzer oa = new OutputAnalyzer(pb.start()); // First call stack trace - oa.shouldContain("at Example.$jacocoInit(Example.jasm)"); + // shouldMatch is used to workaround CODETOOLS-7902686 + oa.shouldMatch("^\tat Example\\.\\$jacocoInit\\(.*Example\\.jasm\\)$"); oa.shouldContain("Caused by: java.lang.RuntimeException"); oa.shouldContain("at StaticInit.(StaticInit.java:27)"); // Second call stack trace, with the message oa.shouldContain("java.lang.ExceptionInInitializerError: $jacocoData"); - oa.shouldContain("at Example.foo(Example.jasm)"); - oa.shouldContain("at Example.main(Example.jasm)"); + oa.shouldMatch("^\tat Example\\.foo\\(.*Example\\.jasm\\)$"); + oa.shouldMatch("^\tat Example\\.main\\(.*Example\\.jasm\\)$"); oa.shouldHaveExitValue(1); } } diff --git a/test/jaxp/TEST.ROOT b/test/jaxp/TEST.ROOT --- a/test/jaxp/TEST.ROOT +++ b/test/jaxp/TEST.ROOT @@ -23,7 +23,7 @@ groups=TEST.groups # Minimum jtreg version -requiredVersion=5.0 b1 +requiredVersion=5.1 b1 # Path to libraries in the topmost test directory. This is needed so @library # does not need ../../ notation to reach them diff --git a/test/jdk/TEST.ROOT b/test/jdk/TEST.ROOT --- a/test/jdk/TEST.ROOT +++ b/test/jdk/TEST.ROOT @@ -58,7 +58,7 @@ release.implementor # Minimum jtreg version -requiredVersion=5.0 b1 +requiredVersion=5.1 b1 # Path to libraries in the topmost test directory. This is needed so @library # does not need ../../ notation to reach them diff --git a/test/langtools/TEST.ROOT b/test/langtools/TEST.ROOT --- a/test/langtools/TEST.ROOT +++ b/test/langtools/TEST.ROOT @@ -15,7 +15,7 @@ groups=TEST.groups # Minimum jtreg version -requiredVersion=5.0 b1 +requiredVersion=5.1 b1 # Use new module options useNewOptions=true diff --git a/test/lib-test/TEST.ROOT b/test/lib-test/TEST.ROOT --- a/test/lib-test/TEST.ROOT +++ b/test/lib-test/TEST.ROOT @@ -2,7 +2,7 @@ # It also contains test-suite configuration information. # Minimum jtreg version -requiredVersion=5.0 b1 +requiredVersion=5.1 b1 # Path to libraries in the topmost test directory. This is needed so @library # does not need ../../ notation to reach them diff --git a/test/lib/jdk/test/lib/Utils.java b/test/lib/jdk/test/lib/Utils.java --- a/test/lib/jdk/test/lib/Utils.java +++ b/test/lib/jdk/test/lib/Utils.java @@ -112,6 +112,11 @@ public static final String TEST_CLASSES = System.getProperty("test.classes", "."); /** + * Returns the value of 'test.name' system property + */ + public static final String TEST_NAME = System.getProperty("test.name", "."); + + /** * Defines property name for seed value. */ public static final String SEED_PROPERTY_NAME = "jdk.test.lib.random.seed"; @@ -823,59 +828,6 @@ } } - // This method is intended to be called from a jtreg test. - // It will identify the name of the test by means of stack walking. - // It can handle both jtreg tests and a testng tests wrapped inside jtreg tests. - // For jtreg tests the name of the test will be searched by stack-walking - // until the method main() is found; the class containing that method is the - // main test class and will be returned as the name of the test. - // Special handling is used for testng tests. - @SuppressWarnings("unchecked") - public static String getTestName() { - String result = null; - // If we are using testng, then we should be able to load the "Test" annotation. - Class testClassAnnotation; - - try { - testClassAnnotation = (Class)Class.forName("org.testng.annotations.Test"); - } catch (ClassNotFoundException e) { - testClassAnnotation = null; - } - - StackTraceElement[] elms = (new Throwable()).getStackTrace(); - for (StackTraceElement n: elms) { - String className = n.getClassName(); - - // If this is a "main" method, then use its class name, but only - // if we are not using testng. - if (testClassAnnotation == null && "main".equals(n.getMethodName())) { - result = className; - break; - } - - // If this is a testng test, the test will have no "main" method. We can - // detect a testng test class by looking for the org.testng.annotations.Test - // annotation. If present, then use the name of this class. - if (testClassAnnotation != null) { - try { - Class c = Class.forName(className); - if (c.isAnnotationPresent(testClassAnnotation)) { - result = className; - break; - } - } catch (ClassNotFoundException e) { - throw new RuntimeException("Unexpected exception: " + e, e); - } - } - } - - if (result == null) { - throw new RuntimeException("Couldn't find main test class in stack trace"); - } - - return result; - } - /** * Creates an empty file in "user.dir" if the property set. *

diff --git a/test/lib/jdk/test/lib/cds/CDSTestUtils.java b/test/lib/jdk/test/lib/cds/CDSTestUtils.java --- a/test/lib/jdk/test/lib/cds/CDSTestUtils.java +++ b/test/lib/jdk/test/lib/cds/CDSTestUtils.java @@ -499,7 +499,7 @@ // create file containing the specified class list public static File makeClassList(String classes[]) throws Exception { - return makeClassList(getTestName() + "-", classes); + return makeClassList(testName + "-", classes); } // create file containing the specified class list @@ -529,18 +529,7 @@ } } - - // Optimization for getting a test name. - // Test name does not change during execution of the test, - // but getTestName() uses stack walking hence it is expensive. - // Therefore cache it and reuse it. - private static String testName; - public static String getTestName() { - if (testName == null) { - testName = Utils.getTestName(); - } - return testName; - } + private static String testName = Utils.TEST_NAME.replace('/', '.'); private static final SimpleDateFormat timeStampFormat = new SimpleDateFormat("HH'h'mm'm'ss's'SSS"); @@ -549,7 +538,7 @@ // Call this method to start new archive with new unique name public static void startNewArchiveName() { - defaultArchiveName = getTestName() + + defaultArchiveName = testName + timeStampFormat.format(new Date()) + ".jsa"; } @@ -561,7 +550,7 @@ // ===================== FILE ACCESS convenience methods public static File getOutputFile(String name) { File dir = new File(System.getProperty("test.classes", ".")); - return new File(dir, getTestName() + "-" + name); + return new File(dir, testName + "-" + name); } @@ -582,7 +571,7 @@ long started = System.currentTimeMillis(); OutputAnalyzer output = new OutputAnalyzer(pb.start()); String outputFileNamePrefix = - getTestName() + "-" + String.format("%04d", getNextLogCounter()) + "-" + logName; + testName + "-" + String.format("%04d", getNextLogCounter()) + "-" + logName; writeFile(getOutputFile(outputFileNamePrefix + ".stdout"), output.getStdout()); writeFile(getOutputFile(outputFileNamePrefix + ".stderr"), output.getStderr());