JTREG(1)

๐Ÿ’– JTREG(1) ๐Ÿ’–

okay bestie, welcome to jtreg, aka the Regression Test Harness โ€” she lives in section 1 of the User Commands manual and she is THE girl for running tests. grab a boba, we're doing this ๐Ÿง‹โœจ


๐ŸŒธ NAME ๐ŸŒธ

jtreg โ€” Regression Test Harness ๐Ÿ‘‘


๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

โœจ Usage โœจ

jtreg options... tests...

so the vibe is: you hand her tests... and she runs them. those tests can be given as files or folders containing test files, or you can roll up by means of test groups. ๐Ÿซถ

and listen โ€” long lists of options and tests may be encapsulated in "at-files". yes bestie, at-files. iconic behaviour honestly.


๐Ÿ’… Verbose Options ๐Ÿ’…

These options control the amount of output written to the console while running tests. basically: how much does she yap about it ๐Ÿ—ฃ๏ธ

  • -v | --v:<value> | -verbose | --verbose:<value> โ€” Increase the amount of output written to the console. A value, or selected combinations of values separated by commas, may be given to select the type of output desired.
    • default โ€” Three lines of output per test: start, end, status
    • summary โ€” One line of output per test: status, test name
    • all โ€” Selected contents of JTR file for all tests (includes stdout/stderr)
    • pass โ€” Selected contents of JTR file for passed tests
    • fail โ€” Selected contents of JTR file for failed tests
    • error โ€” Selected contents of JTR file for errored tests
    • nopass โ€” Suppress output for tests that passed
    • time โ€” Elapsed time per action
    • multirun โ€” Updates for each testsuite when tests from more than one are being executed.
  • -v1 โ€” Short for -verbose:summary
  • -va โ€” Short for -verbose:all
  • -ve โ€” Short for -verbose:error
  • -vf โ€” Short for -verbose:fail
  • -vp โ€” Short for -verbose:pass
  • -vt โ€” Short for -verbose:time

๐ŸŽ€ Documentation Options ๐ŸŽ€

Options for additional documentation. when you just need to read about her instead of running her ๐Ÿ“–

  • --help [words...] | -h [words...] | -help [words...] | -usage [words...] โ€” Command line help. Give words to see help info containing those or use "-help all" to see all available help.
  • -n | -relnote โ€” Release notes
  • -t | -tagspec โ€” Tag specification supported by this implementation
  • -version โ€” Give information about the version of jtreg in use.

๐ŸŒˆ General Options ๐ŸŒˆ

the main character section fr fr ๐Ÿ’…

  • -allowSetSecurityManager | --allowSetSecurityManager:<boolean-value> โ€” Allow agentVM tests to set a security manager. Default is "yes" if option not given or no value given for option.
    • yes โ€” Allow agentVM tests to set a security manager
    • no โ€” Do not allow agentVM tests to set a security manager
    • on โ€” Allow agentVM tests to set a security manager
    • off โ€” Do not allow agentVM tests to set a security manager
    • true โ€” Allow agentVM tests to set a security manager
    • false โ€” Do not allow agentVM tests to set a security manager
  • -c | -check โ€” Verify correctness of test descriptions. Does NOT run tests. ๐Ÿšจ (she's just checking, bestie, not executing!)
  • -conc:<factor> | -concurrency:<factor> โ€” concurrency factor
  • -cygwin โ€” (Windows only) Use Cygwin to run shell tests
  • -dir:<dir> โ€” Specify a base directory for test files and directories
  • -e:name[=value][,name[=value]...] โ€” Specify additional environment variables to be passed to each test. If a value is not given for a name, the current value of the environment variable will be used. Standard environment variables, like DISPLAY, LANG, windir, SystemRoot, etc, will automatically be given to each test, if they are set in the current environment. ๐ŸŒฑ
  • -g | -gui โ€” Access regression extensions via the standard JavaTest harness gui
  • -i | --verify-exclude โ€” Validate contents of exclude files
  • -ignore:<value> โ€” Specify how to handle tests containing an @ignore tag.
    • quiet โ€” Completely ignore such tests.
    • error โ€” (Default.) Execute the actions up to the @ignore tag, then give an "Error" result.
    • run โ€” Run the test, as though the @ignore tag were not present.
  • -l | -listtests โ€” List the tests that would be executed instead of executing them.
  • -lock:<file> โ€” Lock file to use for tests in "exclusive access" directories when running tests in multiple concurrent instances of jtreg.
  • -nativepath:<path> โ€” Path to location of native libraries and programs needed by the tests.
  • -noignore โ€” suppress the effect of any @ignore tags, allowing the test to proceed as if the @ignore tags were not present. Deprecated: see the -ignore option. ๐Ÿ’€
  • -nr | -noreport โ€” Do not generate a final report.
  • -o:<classname> | -observer:<classname> โ€” Specifies the class to observe the progress of a test suite; the class must implement a specific interface; contact a developer for details. For example, -o:SampleRegressionObserver
  • -od:<path> | -observerDir:<path> | -op:<path> | -observerPath:<path> โ€” Specifies the pathname of a directory or .jar file in which the observer class is located. The given pathname is simply appended to the CLASSPATH used for the tests, thus care should be taken when naming an observer not to collide with the names of classes internal to the JavaTest harness or the JRE. For example, put the observer class in its own named package. ๐Ÿซถ
  • -r:<directory> | -reportDir:<directory> โ€” All report files placed here; "./JTreport" is default
  • -report:<value> โ€” Configure the report generated after tests are run.
    • none โ€” Do not generate a report; equivalent to -noreport.
    • executed โ€” Include tests executed in the latest run
    • files โ€” Include all tests specified by groups and paths on the command line, ignoring filters like status, exclude lists, and keywords.
    • all-executed โ€” Include all tests that have been executed in current work directory
    • all โ€” Include all tests that are present in the test suite, whether they have been executed
  • -retain | --retain:<none,lastRun,pass,fail,error,all,file-pattern>,... โ€” Specify files to be retained after each test completes executing. If -retain is not specified or is specified with lastRun, only the files from the last test executed will be retained, in the test's scratch directory. For all other uses of -retain, files will be retained in a test-specific directory in the work-directory. If -retain is specified with no argument, all files will be retained. Otherwise, the files may be described by one or more of the following values:
    • none โ€” Do not retain any of the files generated by each test
    • lastRun โ€” Retain files generated by the last test that was run (default)
    • pass โ€” Retain files generated by tests that pass
    • fail โ€” Retain files generated by tests that fail
    • error โ€” Retain files generated by tests that caused an error
    • all โ€” Retain all files generated by each test
    • file-pattern โ€” Retain files that match a specific filename. The name may contain '*' to match any sequence of characters. For example, result.* or *.err. ๐Ÿ”ฅ
  • -ro | -reportOnly โ€” Generate report for previously executed tests. This does not re-run any tests. A work directory containing the results of the executed tests must be provided. The default location is "./JTwork". To specify an alternate directory, use -workDir.
  • -show:[<section-name>/]<stream-name> โ€” Show the contents of a stream in a specific section or in all sections of the results file for a test. The content is shown as originally written to the stream: that is, without the escape encoding used in the .jtr file. If no section name is given, the output for the named stream in all sections is shown. For example, -show:rerun -show:main/System.out โœจ
  • -showGroups โ€” Show the expansion (to files and directories) of the groups given on the command line. To see the expansion of all the groups in a test suite, specify the name of the test suite.
  • -startHttpd โ€” Start the http server to view test results
  • -ttf:<classname> | -testThreadFactory:<classname> โ€” Specifies the class to create thread factory for test execution. The class should implement the java.util.concurrent.ThreadFactory interface.
  • -ttfp:<path> | -testThreadFactoryPath:<path> โ€” Specifies classspath for custom test thread factory implementation. The classes from this classpath are loaded by tested JDK only using URLClassLoader.
  • -w:<directory> | -workDir:<directory> โ€” Location for .class files, .jtr files, etc. "./JTwork" is default
  • -wsl โ€” (Windows only) Use the Windows Subsystem for Linux (WSL) to run shell tests
  • -xml | --xml:verify โ€” Create ant/junit xml files into the workDir. Optionally verify if the file is well-formed.

โฐ Timeout Options โฐ

These options control the behavior when tests run longer than their specified timeout value. yes she will call time on them โณ

  • -th:<classname> | -timeoutHandler:<classname> โ€” Specifies the class to handle timeouts. The class must extend com.sun.javatest.regtest.TimeoutHandler. For example, -th:MyHandler
  • -thd:<path> | -timeoutHandlerDir:<path> โ€” Specifies the pathname of a directory or .jar file in which the timeout handler class is located. The given pathname is simply appended to the CLASSPATH used for the tests, thus care should be taken when naming a timeout handler not to collide with the names of classes internal to the JavaTest harness or the JRE. For example, put the timeout handler class in its own named package.
  • -thtimeout:<#seconds> | -timeoutHandlerTimeout:<#seconds> โ€” Specifies execution time limitation for the timeout handler. If the timeout handler does not finish its actions within the specified period of time, it will be interrupted. Non-positive values mean no limitation. The default value is 5 minutes (300 seconds).
  • -timeout:<number> | -timeoutFactor:<number> โ€” A scaling factor to extend the default timeout of all tests. Typically used when running tests on slow systems or systems with slow file systems. ๐Ÿข
  • -tl:<#seconds> | -timelimit:<#seconds> โ€” Do not run tests which specify a timeout longer than a given value. The comparison is done against any values specified in the test, before any timeout factor is applied.

๐Ÿ‘‘ Agent Pool Options ๐Ÿ‘‘

Options to configure the size of the pool of VMs used to execute tests in agent mode. it's giving โœจpool partyโœจ

  • --agent-attempts <number> โ€” The number of attempts jtreg will make to access an agent with the desired characteristics, either by creating a new one, or obtaining one from the pool of reusable VMs. The minimum value, and the default value, is 1.
  • --max-pool-size <number> โ€” The maximum number of VMs to keep available in the agent pool. The default is either 2x the concurrency.
  • --pool-idle-timeout <number> โ€” how many seconds an idle VM can just be sitting there in the pool before it gets automatically closed. bye bestie ๐Ÿ’ค

โœจ Test Selection Options โœจ

Okay so these are the little filters that let you go "no, not ALL of them, just these ones" โ€” refine the set of tests you actually execute. ๐ŸŽฏ

  • -a | -automatic | -automagic โ€” literally any test with /manual in it will NOT be run. manual girlies stay home ๐Ÿ’…
  • -bug:<bugid> โ€” run only those tests which apply to the given bugid.
  • -exclude:<file> | -Xexclude:<file> โ€” hand it a file specifying tests that should not be run ๐Ÿšซ
  • -k:<keywordExpr> | -keywords:<keywordExpr> โ€” a keyword boolean expression for test selection. the expression can contain keyword names, and you can combine them with & (and), | (or), ! (not) and parentheses. it's giving algebra class but slay ๐Ÿงฎ
  • -m | -manual โ€” only tests with /manual will be run. manual mode girlies rise ๐Ÿ™‹โ€โ™€๏ธ
  • -match:<file> โ€” hand it a file specifying tests that can be run. it's the inverse of -exclude (iconic duo fr)
  • -noshell โ€” any tests which contain shell actions will not be run
  • -shell โ€” only tests which contain shell actions will be run ๐Ÿš
  • -status:<value>,... โ€” select tests according to their result in an earlier run. value can be one or more of the values below, separated by commas:
    • pass โ€” tests that passed โœจ
    • fail โ€” tests that failed ๐Ÿ˜ญ
    • notRun โ€” tests that have not been run
    • error โ€” tests that could not be run because of errors, or tests that were ignored ๐Ÿ’€

โœจ Test Mode Options โœจ

so every test is a series of steps, and we call those steps actions. the jtreg harness ships with different modes, and the mode decides which JVM gets used to execute each action. the default? brand new JVM for every single action. ok periodt.

  • -avm | -agentvm | -s | -svm | -samevm โ€” execute each action using a pool of reusable JVMs, except when an action specifies otherwise. it's giving good performance and reasonable isolation between actions: if a JVM can be reset to a standard state after it's been used, it gets returned to the pool for reuse; otherwise it's discarded and replaced if and when necessary. this mode is generally recommended for all use, no cap ๐Ÿซถ. the JDK to use can be specified with -testjdk or -jdk, except for @compile actions, which use -compilejdk or -jdk. if values are not provided, the environment variable JAVA_HOME is used.
  • -ovm | -othervm โ€” execute every action in a new JVM. this is the default. it provides the maximum isolation between actions, at a significant cost in performance (the math is mathing, bestie ๐Ÿ’ธ). the JDK to use can be specified with -testjdk or -jdk, except for @compile actions, which use -compilejdk or -jdk. if values are not provided, the environment variable JAVA_HOME is used.

by default, tests will be run using the default JVM in the test JDK. you can pass all applicable JVM options via -vmoption; and in addition, many common JVM options are also supported directly. for full details of any option, consult the documentation for that version of the JDK, or try java -help or java -X. if an option is not applicable to a particular platform or JDK release, it will be rejected. cold. โ„๏ธ

  • --add-modules <module>(,<module>)* โ€” root modules to resolve in addition to the initial module
  • -agentlib:<libname><[=<options>] โ€” load native agent library
  • -agentpath:<pathname><[=<options>] โ€” load native agent library by full pathname
  • -classic | -green | -native | -hotspot | -client | -server | -d32 | -d64 โ€” VM Options
  • -compilejdk:<java.home> โ€” compile all tests using the specified JDK. if not specified, tests are compiled with the JDK used to run the tests. see also -jdk. for example, -jdk:/usr/local/java/jdk1.5/solaris-sparc
  • -cpa:<path> | -classpathappend:<path> โ€” append the provided classPath to the CLASSPATH of every test. this is designed to be used primarily for tests which require non-core JDK functionality. for example, to test Swing, which is not part of core JDK1.1, the following addition to the CLASSPATH would be necessary: -cpa:/usr/local/java/swing-1.0.3/swingall.jar
  • -D<name>=<value> โ€” define a system property
  • -debug:<option>... โ€” use this to specify VM options to attach a debugger to a VM running a test. it's similar to -vmoptions except that it is not used when starting VMs used to query the properties of that VM. any timeout for a test is automatically disabled when this option is used ๐Ÿ›‘โฐ. see also -javaoptions and -vmoptions.
  • -enableassertions | --enableassertions:* | -ea | --ea:* | -disableassertions | --disableassertions:* | -da | --da:* โ€” enable or disable assertions
  • -enablesystemassertions | -esa | -disablesystemassertions | -dsa โ€” enable or disable system assertions
  • -javaagent:<jarpath><[=<options>] โ€” load Java programming language agent
  • -javacoption:<option> โ€” additional compiler option. you can give this option multiple times. any embedded filenames must be given with absolute paths.
  • -javacoptions:<option>... โ€” additional compiler options. you can give this option multiple times, or give many values together, separated by spaces. if you give multiple values, you may need to enclose them in quotes, depending on the shell you use. any embedded filenames must be given with absolute paths.
Warning: do not use this form if any of the options has an argument such as a filename that might contain spaces. in that case, use one or more -javacoption options instead. โš ๏ธ
  • -javaoption:<option> โ€” additional java option for running test classes. you can give this option multiple times. any embedded filenames must be given with absolute paths. see also -vmoption.
  • -javaoptions:<option>... โ€” additional java options for running test classes. you can give this option multiple times, or give many values together, separated by spaces. if you give multiple values, you may need to enclose them in quotes, depending on the shell you use. any embedded filenames must be given with absolute paths. see also -vmoptions.
Warning: do not use this form if any of the options has an argument such as a filename that might contain spaces. in that case, use one or more -javaoption options instead. โš ๏ธ
  • -jdk:<java.home> | -testjdk:<java.home> โ€” run all tests using the specified JDK. for example, -jdk:/usr/local/java/jdk1.5/solaris-sparc
  • -jit โ€” enable the JIT for the tests. the JIT is turned on by default.
  • --limit-modules <module>(,<module>)* โ€” limit the universe of observable modules
  • -nojit โ€” disable the JIT for the tests.
  • --patch-module <module>=<path> โ€” specify classes to override module classes
  • -vmoption:<option> โ€” any other VM option. you can give this option multiple times. any embedded filenames must be given with absolute paths. this option will be used when compiling and running classes. see also -javaoption.
  • -vmoptions:<option>... โ€” any other VM options. you can give this option multiple times, or give many values together, separated by spaces. if you give multiple values, you may need to enclose them in quotes, depending on the shell you use. any embedded filenames must be given with absolute paths. this option will be used when compiling and running classes. see also -javaoptions.
Warning: do not use this form if any of the options has an argument such as a filename that might contain spaces. in that case, use one or more -vmption options instead. โš ๏ธ
  • -X* โ€” non-standard VM Options.
  • -Xbootclasspath:<path> โ€” set search path for bootstrap classes and resources
  • -Xbootclasspath/a:<path> โ€” append to end of bootstrap class path
  • -Xbootclasspath/p:<path> โ€” prepend in front of bootstrap class path
  • -Xint* | -Xmixed* | -Xcomp* โ€” non-standard VM Options
  • -XX* | -Xms* | -Xmx* โ€” non-standard VM Options

โœจ Tests โœจ

Specifying collections of tests. ๐Ÿงช

  • Tests โ€” Specifying collections of tests.
  • Tests โ€” Specifying collections of tests.

at-files

long lists of options and tests may be encapsulated in "at-files". place the options and/or tests in a file and specify the name of the file on the command line with @file. options or tests that include white space should be enclosed within either single or double quote characters. comments may be included in the file by prefixing them with '#'. to specify an option beginning with '@' on the command line, use "@@" to avoid @file expansion. sneaky little escape hatch, love that for us ๐Ÿ™ˆ

Tests

Specifying collections of tests.

Groups

a test suite may define named groups of tests. to specify the name of a group of tests on the command line, use test-suite-dir:group-name, where test-suite-dir is a path to the root directory of the test suite (that is, the directory containing the TEST.ROOT file), and where group-name is the name of the group of tests defined in the test suite. if test-suite-dir is omitted it defaults to the value of the -dir option, if given, or to the current directory otherwise.

Note: on Windows, to avoid confusion with absolute path names including a drive specifier, the test-suite-dir must not be specified with a relative path consisting of a single letter. ๐ŸชŸ

Groups are defined in a test suite using one or more Java properties files. the names of these files must be listed in the "groups" entry in TEST.ROOT. if the filename is enclosed in square brackets, no error message will be given if the file cannot be found. within the property files, each entry specifies items to be included or excluded from the group. to include a test or directory of tests, simply specify the name of the test or directory. to exclude a test or directory of tests, use '-' followed by the name of the test or directory. to include the contents of another group, use ':' followed by the name of the group. there must be no spaces between the "-" or ":" and the name that follows. ok careful bestie, spacing matters here โœ‹

Summary

the following kinds of arguments can be used to specify tests to be executed. in these examples, square brackets are used to indicate optional parts.

  • directory โ€” all tests found in and under the given directory.
  • file[#id][?string] โ€” bestie, this one's the multitasker ๐Ÿ’…. Give it just a file and you get every single test in that file โ€” because yes, one file can hold a whole squad of tests, as long as each test description sits in its own separate comment block. Throw in an id and it narrows down to exactly that one test, no cap.

And then there's ?string ๐Ÿฆ‹ โ€” if you tack it on, that string gets handed off to the test so it can filter which parts of itself actually run. Typically the string is the name of a method you want executed, iykyk. Oh, and if you give conflicting values for the string on a specific test? The last one you gave wins โ€” no takebacks, periodt.

  • [path]:group-name โ€” a whole group of tests, defined in the TEST.groups file sitting in the testsuite root directory. If you give a path, that's your testsuite root directory, queen โœจ. If you don't give one, it defaults to the directory enclosing the current directory. It's giving "I'll find my own way home" energy.
  • @file โ€” a file stuffed with values that get treated as if they were right there on the command-line. Sneaky, iconic, lowkey my fave ๐ŸŽ€.

Where is this thing even living, and what's it running on ๐Ÿซถ

Installed in /build/reproducible-path/jtreg8-8.3+1+ds1/build/images/jtreg/lib/jtreg.jar

Running on platform version 21.0.12.1 from /usr/lib/jvm/java-21-openjdk-amd64.

Built with Java(TM) 2 SDK, Version 21.0.12.1+1-1-deb13u1-De on Fri, 23 Oct 2026 12:27:33 +0200.

Then the receipts keep coming ๐Ÿ’€ โ€” JT Harness, version 6.0 ea b24 (January 25, 1970), %%PRODUCT_NAME_LONG%%, version %%PRODUCT_VERSION%% %%PRODUCT_MILESTONE%% %%PRODUCT_BUILDNUMBER%% (%%BUILD_DATE%%).

TestNG: testng.jar, guice.jar, jcommander.jar, slf4j-simple.jar, slf4j-api.jar

  • TestNG (testng.jar): version 7.5
  • TestNG (guice.jar): version 5.1.0
  • TestNG (jcommander.jar): version unknown
  • TestNG (slf4j-simple.jar): version 1.7.32
  • TestNG (slf4j-api.jar): version 1.7.32

JUnit: junit-platform-console-standalone.jar

JUnit: version unknown


๐ŸŒˆ SEE ALSO ๐ŸŒˆ

Okay so the fullโœจdeluxeโœจdocumentation for jtreg lives as a Texinfo manual โ€” the main character of docs, honestly ๐Ÿ‘‘. And if the info and jtreg programs are properly installed at your site, then this command:

info jtreg

should give you access to the complete manual. Go get your girl ๐Ÿฆ‹๐Ÿ’–.


That's a wrap, bestie! This gorgeous little page is from jtreg 8.3-src+1, dated October 2026, and yes she is still out here being section JTREG(1) like the icon she is. Slay, read your man pages, stay curious ๐ŸŒธ๐Ÿ’…โœจ

๐Ÿ“ฆ where this page comes from