Skip to content
This repository was archived by the owner on Aug 27, 2022. It is now read-only.
/ lanai Public archive

Commit e47b2bc

Browse files
committedJun 10, 2020
8246387: switch to jtreg 5.1
Reviewed-by: dholmes, erikj
1 parent bf22f82 commit e47b2bc

File tree

10 files changed

+23
-134
lines changed

10 files changed

+23
-134
lines changed
 

‎make/conf/jib-profiles.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1045,10 +1045,10 @@ var getJibProfilesDependencies = function (input, common) {
10451045
jtreg: {
10461046
server: "jpg",
10471047
product: "jtreg",
1048-
version: "5.0",
1048+
version: "5.1",
10491049
build_number: "b01",
10501050
checksum_file: "MD5_VALUES",
1051-
file: "bundles/jtreg_bin-5.0.zip",
1051+
file: "bundles/jtreg_bin-5.1.zip",
10521052
environment_name: "JT_HOME",
10531053
environment_path: input.get("jtreg", "home_path") + "/bin",
10541054
configure_args: "--with-jtreg=" + input.get("jtreg", "home_path"),

‎test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherDiagnosticInfoObserver.java

+1-26
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -121,29 +121,4 @@ public void startingTestRun(Parameters params) {
121121
compileJdk = rp.getCompileJDK().getAbsoluteFile().toPath();
122122
testJdk = rp.getTestJDK().getAbsoluteFile().toPath();
123123
}
124-
125-
@Override
126-
public void startingTest(TestResult tr) {
127-
// no-op
128-
}
129-
130-
@Override
131-
public void stoppingTestRun() {
132-
// no-op
133-
}
134-
135-
@Override
136-
public void finishedTesting() {
137-
// no-op
138-
}
139-
140-
@Override
141-
public void finishedTestRun(boolean allOK) {
142-
// no-op
143-
}
144-
145-
@Override
146-
public void error(String msg) {
147-
// no-op
148-
}
149124
}

‎test/hotspot/jtreg/TEST.ROOT

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ requires.properties= \
7575
test.vm.gc.nvdimm
7676

7777
# Minimum jtreg version
78-
requiredVersion=5.0 b1
78+
requiredVersion=5.1 b1
7979

8080
# Path to libraries in the topmost test directory. This is needed so @library
8181
# does not need ../../../ notation to reach them

‎test/hotspot/jtreg/runtime/condy/staticInit/TestInitException.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,14 @@ public static void main(java.lang.String[] unused) throws Exception {
4040
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("Example");
4141
OutputAnalyzer oa = new OutputAnalyzer(pb.start());
4242
// First call stack trace
43-
oa.shouldContain("at Example.$jacocoInit(Example.jasm)");
43+
// shouldMatch is used to workaround CODETOOLS-7902686
44+
oa.shouldMatch("^\tat Example\\.\\$jacocoInit\\(.*Example\\.jasm\\)$");
4445
oa.shouldContain("Caused by: java.lang.RuntimeException");
4546
oa.shouldContain("at StaticInit.<clinit>(StaticInit.java:27)");
4647
// Second call stack trace, with the message
4748
oa.shouldContain("java.lang.ExceptionInInitializerError: $jacocoData");
48-
oa.shouldContain("at Example.foo(Example.jasm)");
49-
oa.shouldContain("at Example.main(Example.jasm)");
49+
oa.shouldMatch("^\tat Example\\.foo\\(.*Example\\.jasm\\)$");
50+
oa.shouldMatch("^\tat Example\\.main\\(.*Example\\.jasm\\)$");
5051
oa.shouldHaveExitValue(1);
5152
}
5253
}

‎test/jaxp/TEST.ROOT

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ modules=java.xml
2323
groups=TEST.groups
2424

2525
# Minimum jtreg version
26-
requiredVersion=5.0 b1
26+
requiredVersion=5.1 b1
2727

2828
# Path to libraries in the topmost test directory. This is needed so @library
2929
# does not need ../../ notation to reach them

‎test/jdk/TEST.ROOT

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ requires.properties= \
5959
release.implementor
6060

6161
# Minimum jtreg version
62-
requiredVersion=5.0 b1
62+
requiredVersion=5.1 b1
6363

6464
# Path to libraries in the topmost test directory. This is needed so @library
6565
# does not need ../../ notation to reach them

‎test/langtools/TEST.ROOT

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ keys=intermittent randomness
1515
groups=TEST.groups
1616

1717
# Minimum jtreg version
18-
requiredVersion=5.0 b1
18+
requiredVersion=5.1 b1
1919

2020
# Use new module options
2121
useNewOptions=true

‎test/lib-test/TEST.ROOT

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# It also contains test-suite configuration information.
33

44
# Minimum jtreg version
5-
requiredVersion=5.0 b1
5+
requiredVersion=5.1 b1
66

77
# Path to libraries in the topmost test directory. This is needed so @library
88
# does not need ../../ notation to reach them

‎test/lib/jdk/test/lib/Utils.java

+5-81
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ public final class Utils {
113113
public static final String TEST_CLASSES = System.getProperty("test.classes", ".");
114114

115115
/**
116+
* Returns the value of 'test.name' system property
117+
*/
118+
public static final String TEST_NAME = System.getProperty("test.name", ".");
119+
120+
/**
116121
* Defines property name for seed value.
117122
*/
118123
public static final String SEED_PROPERTY_NAME = "jdk.test.lib.random.seed";
@@ -824,87 +829,6 @@ public static String distro() {
824829
}
825830
}
826831

827-
// This method is intended to be called from a jtreg test.
828-
// It will identify the name of the test by means of stack walking.
829-
// It can handle both jtreg tests and a testng tests wrapped inside jtreg tests.
830-
// For jtreg tests the name of the test will be searched by stack-walking
831-
// until the method main() is found; the class containing that method is the
832-
// main test class and will be returned as the name of the test.
833-
// Special handling is used for testng tests.
834-
@SuppressWarnings("unchecked")
835-
public static String getTestName() {
836-
String result = null;
837-
// If we are using testng, then we should be able to load the "Test" annotation.
838-
Class<? extends Annotation> testClassAnnotation, junitTestClassAnnotation;
839-
840-
try {
841-
testClassAnnotation = (Class<? extends Annotation>)Class.forName("org.testng.annotations.Test");
842-
} catch (ClassNotFoundException e) {
843-
testClassAnnotation = null;
844-
}
845-
846-
// If we are using junit, then we should be able to load the "Test" annotation.
847-
try {
848-
junitTestClassAnnotation = (Class<? extends Annotation>)Class.forName("org.junit.Test");
849-
} catch (ClassNotFoundException e) {
850-
junitTestClassAnnotation = null;
851-
}
852-
853-
StackTraceElement[] elms = (new Throwable()).getStackTrace();
854-
for (StackTraceElement n: elms) {
855-
String className = n.getClassName();
856-
857-
// If this is a "main" method, then use its class name, but only
858-
// if we are not using testng or junit.
859-
if (testClassAnnotation == null && junitTestClassAnnotation == null &&
860-
"main".equals(n.getMethodName())) {
861-
result = className;
862-
break;
863-
}
864-
865-
// If this is a testng test, the test will have no "main" method. We can
866-
// detect a testng test class by looking for the org.testng.annotations.Test
867-
// annotation. If present, then use the name of this class.
868-
if (testClassAnnotation != null) {
869-
try {
870-
Class<?> c = Class.forName(className);
871-
if (c.isAnnotationPresent(testClassAnnotation)) {
872-
result = className;
873-
break;
874-
}
875-
} catch (ClassNotFoundException e) {
876-
throw new RuntimeException("Unexpected exception: " + e, e);
877-
}
878-
}
879-
880-
// If this is a junit test, the test will have no "main" method. We can
881-
// detect a junit test class by going through all the methods and
882-
// check if the method has the org.junit.Test annotation. If present,
883-
// then use the name of this class.
884-
if (junitTestClassAnnotation != null) {
885-
try {
886-
Class<?> c = Class.forName(className);
887-
Method[] methods = c.getMethods();
888-
for (Method method : methods) {
889-
if (method.getName().equals(n.getMethodName()) &&
890-
method.isAnnotationPresent(junitTestClassAnnotation)) {
891-
result = className;
892-
break;
893-
}
894-
}
895-
} catch (ClassNotFoundException e) {
896-
throw new RuntimeException("Unexpected exception: " + e, e);
897-
}
898-
}
899-
}
900-
901-
if (result == null) {
902-
throw new RuntimeException("Couldn't find main test class in stack trace");
903-
}
904-
905-
return result;
906-
}
907-
908832
/**
909833
* Creates an empty file in "user.dir" if the property set.
910834
* <p>

‎test/lib/jdk/test/lib/cds/CDSTestUtils.java

+6-17
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -499,7 +499,7 @@ public static File getTestArtifact(String name, boolean checkExistence) {
499499
// create file containing the specified class list
500500
public static File makeClassList(String classes[])
501501
throws Exception {
502-
return makeClassList(getTestName() + "-", classes);
502+
return makeClassList(testName + "-", classes);
503503
}
504504

505505
// create file containing the specified class list
@@ -529,18 +529,7 @@ public static void addToClassList(PrintStream ps, String classes[])
529529
}
530530
}
531531

532-
533-
// Optimization for getting a test name.
534-
// Test name does not change during execution of the test,
535-
// but getTestName() uses stack walking hence it is expensive.
536-
// Therefore cache it and reuse it.
537-
private static String testName;
538-
public static String getTestName() {
539-
if (testName == null) {
540-
testName = Utils.getTestName();
541-
}
542-
return testName;
543-
}
532+
private static String testName = Utils.TEST_NAME.replace('/', '.');
544533

545534
private static final SimpleDateFormat timeStampFormat =
546535
new SimpleDateFormat("HH'h'mm'm'ss's'SSS");
@@ -549,7 +538,7 @@ public static String getTestName() {
549538

550539
// Call this method to start new archive with new unique name
551540
public static void startNewArchiveName() {
552-
defaultArchiveName = getTestName() +
541+
defaultArchiveName = testName +
553542
timeStampFormat.format(new Date()) + ".jsa";
554543
}
555544

@@ -561,7 +550,7 @@ public static String getDefaultArchiveName() {
561550
// ===================== FILE ACCESS convenience methods
562551
public static File getOutputFile(String name) {
563552
File dir = new File(System.getProperty("test.classes", "."));
564-
return new File(dir, getTestName() + "-" + name);
553+
return new File(dir, testName + "-" + name);
565554
}
566555

567556

@@ -582,7 +571,7 @@ public static OutputAnalyzer executeAndLog(ProcessBuilder pb, String logName) th
582571
long started = System.currentTimeMillis();
583572
OutputAnalyzer output = new OutputAnalyzer(pb.start());
584573
String outputFileNamePrefix =
585-
getTestName() + "-" + String.format("%04d", getNextLogCounter()) + "-" + logName;
574+
testName + "-" + String.format("%04d", getNextLogCounter()) + "-" + logName;
586575

587576
writeFile(getOutputFile(outputFileNamePrefix + ".stdout"), output.getStdout());
588577
writeFile(getOutputFile(outputFileNamePrefix + ".stderr"), output.getStderr());

0 commit comments

Comments
 (0)
This repository has been archived.