Skip to content

Commit de2c216

Browse files
7903323: Review and improve performance of jtreg reporting.
Reviewed-by: iris
1 parent 66efe4b commit de2c216

File tree

15 files changed

+663
-6
lines changed

15 files changed

+663
-6
lines changed

src/share/classes/com/sun/javatest/regtest/config/RegressionTestFinder.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import com.sun.javatest.finder.JavaCommentStream;
5151
import com.sun.javatest.finder.ShScriptCommentStream;
5252
import com.sun.javatest.finder.TagTestFinder;
53+
import com.sun.javatest.regtest.agent.Flags;
5354
import com.sun.javatest.regtest.exec.Action;
5455
import com.sun.javatest.regtest.util.StringUtils;
5556
import com.sun.javatest.util.I18NResourceBundle;
@@ -127,6 +128,10 @@ protected void setRoot(File testSuiteRoot) throws Fault {
127128

128129
@Override
129130
protected void scanFile(File file) {
131+
if (traceFinder) {
132+
System.err.println("RegressionTestFinder: reading " + file);
133+
}
134+
130135
try {
131136
File tngRoot = properties.getTestNGRoot(file);
132137
if (tngRoot != null) {
@@ -1058,4 +1063,6 @@ private static Pattern getOptionPattern(String name) {
10581063
private static final I18NResourceBundle i18n = I18NResourceBundle.getBundleForClass(RegressionTestFinder.class);
10591064
private static final boolean rejectTrailingBuild =
10601065
!Boolean.getBoolean("javatest.regtest.allowTrailingBuild");
1066+
1067+
private static final boolean traceFinder = Flags.get("traceFinder");
10611068
}

src/share/classes/com/sun/javatest/regtest/tool/Tool.java

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ public String[] getChoices() {
393393
}
394394

395395
@Override
396-
public void process(String opt, String arg) {
396+
public void process(String opt, String arg) throws BadArgs {
397397
switch (arg) {
398398
case "none":
399399
reportMode = ReportMode.NONE;
@@ -404,9 +404,14 @@ public void process(String opt, String arg) {
404404
case "all-executed":
405405
reportMode = ReportMode.ALL_EXECUTED;
406406
break;
407+
case "files":
408+
reportMode = ReportMode.FILES;
409+
break;
407410
case "all":
408411
reportMode = ReportMode.ALL;
409412
break;
413+
default:
414+
throw new BadArgs(i18n, "main.badReportOption", arg);
410415
}
411416
}
412417
},
@@ -1928,11 +1933,12 @@ public void error(String msg) {
19281933
default:
19291934
throw new IllegalStateException();
19301935

1931-
case EXECUTED:
1936+
case EXECUTED: {
19321937
ParameterFilter pf = new ParameterFilter();
19331938
pf.update(params);
19341939
tf = pf;
19351940
break;
1941+
}
19361942

19371943
case ALL_EXECUTED:
19381944
boolean[] statusValues = new boolean[Status.NUM_STATES];
@@ -1946,8 +1952,21 @@ public void error(String msg) {
19461952
case ALL:
19471953
tf = new AllTestsFilter();
19481954
break;
1949-
}
19501955

1956+
case FILES: {
1957+
try {
1958+
RegressionParameters reportParams = new RegressionParameters("regtest", params.getTestSuite(), out::println);
1959+
reportParams.setWorkDirectory(params.getWorkDirectory());
1960+
reportParams.setTests(params.getTests());
1961+
ParameterFilter pf = new ParameterFilter();
1962+
pf.update(reportParams);
1963+
tf = pf;
1964+
break;
1965+
} catch (Interview.Fault e) {
1966+
throw new Fault(i18n, "main.cantCreateReportParameters", e);
1967+
}
1968+
}
1969+
}
19511970
}
19521971
r.report(params, elapsedTimeHandler, stats, tf, quiet);
19531972
}
@@ -2247,7 +2266,7 @@ private static File getNormalizedFile(File f) {
22472266
private boolean guiFlag;
22482267
private boolean reportOnlyFlag;
22492268
private String showStream;
2250-
public enum ReportMode { NONE, EXECUTED, ALL_EXECUTED, ALL }
2269+
public enum ReportMode { NONE, EXECUTED, FILES, ALL_EXECUTED, ALL }
22512270
private ReportMode reportMode;
22522271
private boolean allowSetSecurityManagerFlag = true;
22532272
private static Verbose verbose;

src/share/classes/com/sun/javatest/regtest/tool/i18n.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ help.main.report.all-executed.desc=Include all tests that have been executed in
196196
current work directory
197197
help.main.report.all.desc=Include all tests that are present in the test suite, \
198198
whether they have been executed
199+
help.main.report.files.desc=Include all tests specified by groups and paths \
200+
on the command line, ignoring filters like status, exclude lists, and keywords.
199201
help.main.startHttpd.desc=Start the http server to view test results
200202
help.main.showGroups.desc=Show the expansion (to files and directories) of the \
201203
groups given on the command line. To see the expansion of all the groups \
@@ -444,12 +446,14 @@ main.badLockFile=Bad lock file: {0}
444446
main.badMaxPoolSize=Bad value for maximum pool size: {0}
445447
main.badParams=Bad parameters specified: {0}
446448
main.badPoolIdleTimeout=Bad value for agent pool idle timeout: {0}
449+
main.badReportOption=Bad value for -report: {0}
447450
main.badRetainNone="none" cannot be combined with other options for -retain
448451
main.badRetainLastRun="lastRun" cannot be combined with other options for -retain
449452
main.badTestOrGroup=bad test or group specification: {0}
450453
main.badTimeLimit=Bad value for -timeLimit
451454
main.badTimeoutFactor=Bad use of -timeoutFactor
452455
main.badTimeoutHandlerTimeout=Bad value for -timeoutHandlerTimeout
456+
main.cantCreateReportParameters=Cannot create report parameters: {0}
453457
main.cantCreateDir=Cannot create directory: {0}
454458
main.cantCreateLockFile="Can''t create lock file: {0}
455459
main.cantCreateParameters="Can''t create parameters: {0}

src/share/doc/javatest/regtest/faq.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ implement this specification, and is an older name for what is now known as
5858

5959
### What are the system requirements for using the JDK regression extensions?
6060

61-
It is recommended that you run jtreg using JDK 1.8 or later.
61+
It is recommended that you run jtreg using JDK 11 or later.
6262

6363
### Where can I find a copy of jtreg?
6464

@@ -559,7 +559,8 @@ The plain text files in the report directory include the following:
559559
* `summary.txt`: summary of test results: one test per line, suitable for use with `grep`
560560
* `timeStats.txt`: some statistics regarding test execution times
561561

562-
Reports can be disabled with the `-noreport` option.
562+
Reports can be disabled with the `-noreport` option; the set of tests included
563+
in the report can be selected with the `-report:`_value_ option.
563564

564565
It is generally recommended that the work and report directories should _not_ be
565566
placed anywhere in the test suite itself. Since jtreg may scan the entire test suite
@@ -1091,6 +1092,16 @@ of the test execution times. If there are any tests taking an
10911092
unexpectedly long time to execute, they can be determined by examining
10921093
the `elapsed` entries in the `.jtr` files.
10931094

1095+
### Why is there a delay after the tests have been run, before jtreg exits?
1096+
1097+
By default, jtreg reports on all the tests that have been executed
1098+
and which have results in the work directory. It may take a few seconds
1099+
to find the set of tests for the report. You can use the `-report:`_value_
1100+
option to specify which tests should be in the report. If you are just
1101+
running a single test or a few tests, you may want to use `-report:files`,
1102+
to just report on the tests specified in the files and/or groups given on the
1103+
command line.
1104+
10941105
### How do I find the tests that took longest to run?
10951106

10961107
Using the [`elapsed`](#my-tests-take-a-long-time-to-run-how-do-i-find-where-the-time-goes)

0 commit comments

Comments
 (0)