JavaTestSuite

Java Test Suite

(See also LanguageTestSuites )

Java has a number of test suites which ought to pass on Wine as well as they do on Windows.

JCK

Sun's official test suite for Java is the Java Compatibility Kit (JCK). It used to be hard to get, but is now available for open source use. See http://www.sun.com/software/opensource/java/

jtreg

The jtreg test suite is Java's regression test suite. It is used for everything not in the JCK and includes roughly 3347 tests taking about 2 hours to run.

The jtreg tests have been open-sourced as part of OpenJDK (http://openjdk.java.net/). Ideally you'd check out and compile OpenJDK, then run it against its own tests in the same tree. However compiling the Windows version of OpenJDK is painful even on Windows (http://hg.openjdk.java.net/jdk7/build/raw-file/tip/README-builds.html), needing Visual Studio running from Cygwin. Unfortunately OpenJDK Windows binaries are not distributed on http://download.java.net/openjdk/jdk7 either. Fortunately the closed-source JDK Windows binary snapshots are available.

  1. Install Mercurial and the Mercurial Forests extension. The Forests extension only works on older versions of Mercurial. See http://openjdk.java.net/guide/repositories.html#installConfig

  2. Check out OpenJDK as described on that same page.
  3. Install JDK for Windows on Wine. For this it is probably best to install a binary snapshot from http://jdk7.java.net/download.html

  4. Install the jtreg tool from http://openjdk.java.net/jtreg/index.html

  5. Run "wine java -Dprogram=jtreg -jar ${JT_HOME}/lib/jtreg.jar -a .". The "-a" will run only the automated tests (not those needing user input). Do this in an X session and leave your computer unattended as some tests will move your mouse. Results are eventually written to an HTML file in the JTreport directory.

Mauve

Mauve (http://sourceware.org/mauve/) was an earlier test suite for the Java language. It's mostly of historical interest.

It's not too hard to build it once you know how (we'll add instructions here later). It's very easy, given the .class file for Mauve, to run one of its test cases.

Here's how:

  • 1. Install a Windows JRE from http://java.sun.com/products/archive/ into your Wine instance, using a custom install to a directory like C:\JRE16. (Mauve doesn't like the default path, C:\Program Files\Java..., since it has a space in it.) 2.Download the precompiled Mauve testsuite .class file from http://kegel.com/wine/mauve.tgz and unpack it.

    3.Start the test suite and pass it the desired tests on the commandline, e.g.

echo gnu.testlet.java.io.BufferedWriter.Test > tests
wine .wine/drive_c/jre16/bin/java.exe -classpath mauve.jar RunnerProcess -debug < tests > log

Mauve will output the test results to stdout. Occasionally the messages contain embedded carriage returns that might matter (but probably don't). e.g. "cat -v log" after the above shows

FAIL: java.io.BufferedWriter.Test
  line 60: Did all chars make it through? [1] --
           got I used to live right behind this super-cool bar in
Chicago called Lounge Ax.  They have the best music of pretty
much anyplace in town with a great atmosphere and $1 Huber
on tap.  I go to tons of shows there, even though I moved.


           but expected I used to live right behind this super-cool bar in
Chicago called Lounge Ax.  They have the best music of pretty
much anyplace in town with a great atmosphere and $1 Huber
on tap.  I go to tons of shows there, even though I moved.^M


^M
I used to live right behind this super-cool bar in
Chicago called Lounge Ax.  They have the best music of pretty
much anyplace in town with a great atmosphere and $1 Huber
on tap.  I go to tons of shows there, even though I moved.
RunnerProcess:fail-1

To make sense of the results, you may need to consult the source code. The source for the above test is at http://sourceware.org/cgi-bin/cvsweb.cgi/mauve/gnu/testlet/java/io/BufferedWriter/?cvsroot=mauve and by consulting it, you can see that the extra copy of the test phrase came not from a bug, but probably from an extra print statement in the test code.

*Understanding* the bugs might requires compiling the test case yourself outside of Mauve and modifying it some. (I haven't done this yet for this example, so I don't know what the real bug is.)

We filed http://bugs.winehq.org/show_bug.cgi?id=9180 for this.


CategoryQualityAssurance

JavaTestSuite (last edited 2011-06-27 19:15:15 by DamjanJovanovic)