jtreg look like? How can I make sure that I can even run
the JavaTest harness?You may verify that the JavaTest harness can be properly invoked by using
jtreg to run this sample test.
/*
* @test
* @bug 2718282
* @summary Hello test
*/
public class Hello {
public static void main(String [] args) throws Exception {
if (true)
System.out.println("Hello World!");
else
throw new Exception("??");
}
}
A typical invocation of jtreg on that test is:
ribbit$ jtreg -verbose:all -testjdk:/usr/local/java/jdk1.4/solsparc Hello.java
where
-verbose:all is a verbose option which causes output
from all tests (regardless of whether they passed or failed) to be
printed at completion of the test.-testjdk specifies the location of the JDK version which
should be used to run the test.Modulo the line numbers, output for the successful invocation of
jtreg will look like:
1 --------------------------------------------------
2 TEST: Hello.java
3 JDK under test: (/usr/local/java/jdk1.4/solsparc/jre)
4 java version "1.4.0-beta"
5 Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b56)
6 Java HotSpot(TM) Client VM (build 1.4-beta-B56, mixed mode)
7
8 ACTION: build -- Passed. Compilation successful
9 REASON: Named class compiled on demand
10 TIME: 3.024 seconds
11
12 ACTION: compile -- Passed. Compilation successful
13 REASON: .class file out of date or does not exist
14 TIME: 3.023 seconds
15 STDOUT:
16 STDERR:
17
18 ACTION: main -- Passed. Execution successful
19 REASON: Assumed action based on file name: run main Hello
20 TIME: 0.862 seconds
21 STDOUT:
22 Hello World!
23 STDERR:
24 STATUS:Passed.
25
26 TEST RESULT: Passed. Execution successful
27 --------------------------------------------------
28 test results: passed: 1
29 Report written to /u/iag/jtwJTreport/report.html
30 Results written to /u/iag/jtw/JTwork
The test was compiled and executed. No exception was thrown during execution, thus the test passed.
Interpretation of this output is as follows:
-testjdk option).java
[-JVMOptions] version" is called for the JDK under test. Valid
[-JVMOptions] include -client, -server,
-hotspot, -d64, and -d32, as
applicable to the current platform and test JDK.main action contains the
string "Hello World!").html reports..jtr)
which contain information about the individual tests that were run.