Allowing partial jtreg samejvm safe runs

Mark Wielaard mark at
Sun Nov 23 09:17:54 PST 2008


Jonathan Gibbons has been extending jtreg so that tests can be run in
the same vm. He also made it so that most langtools tests are run that
way. That brings an enormous speed up. Since running all jdk tests takes
ages it would be great if we could use this same speedup there.

Problem is that -samevm only works if all tests have been adapted to
behave well (or marked as needing /othervm). So my idea was to add a
"whitelist mechanism" so you can indicate which (sub)dirs are ready to
be run with samevm.

Luckily jtreg has mostly been setup for this already. All Actions ask
their Script whether or not they should be running in an othervm. So we
hook into that to check the scripts location against a whitelist.

I choose the TEST.ROOT file as the location of the whitelist. Since that
is also the root of the test suite. I made the code so that the
whitelist is only used when running the full test suite from the root.
That way you can still experiment with -samevm or -othervm when running
subtrees of tests.

Also CCed jdk-regtest at since that address is mentioned in the
TEST.ROOT file with an request to contact them if you change anything in
that file.

Below is the implementation as I checked into icedtea6 (patch also

2008-11-23  Mark Wielaard  <mark at>

    * test/jtreg/com/sun/javatest/regtest/
    (createParameters): Set same jvm safe dirs when non-null.
    (getSameJVMSafeDirs): New method that reads samejvmsafe property
    from TEST.ROOT.
    (sameJVMSafeDirs): New private field.
    * test/jtreg/com/sun/javatest/regtest/
    (SAME_JVM_SAFE_DIRS): New static final field.
    (load): Read same jvm safe dirs.
    (save0): Write same jvm safe dirs.
    (getSameJVMSafeDirs): New method.
    (setSameJVMSafeDirs): New method.
    * test/jtreg/com/sun/javatest/regtest/
    (run): Set testDirPath.
    (isOtherJVM): Take same jvm safe into account.
    (isSameJVMSafe): New method.
    (testDirPath): New private field.

For icedtea6 I did a quick scan of the openjdk/jdk/test subdirs and
listed an initial set that work with -samejvm and added a patch to
augment the TEST.ROOT file (attached).

2008-11-23  Mark Wielaard  <mark at>

    * patches/icedtea-samejvm-safe.patch: New patch.
    * (ICEDTEA_PATCHES): Add new patch.
    (check-jdk): Run jtreg with -samevm.
    * HACKING: Document new patch.

Comments on the idea and the implementation very appreciated.

With this 'make check-jdk' takes a little bit less than 3 hours on my
machine now. It was almost 3.5 hours, so it already saves a lot of time.
But we need to make much more tests work with samevm to bring the total
test running time down to something an ordinary developer would be
comfortable with running every day.

We have to see whether or not that is really possible. It seems jdi, rmi
and awt take up a lot of the time needed to run all tests, and I am not
sure those tests can be speed up much.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: jtreg-samejvm-safe.patch
Type: text/x-patch
Size: 6370 bytes
Desc: not available
Url : 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: icedtea-samejvm-safe.patch
Type: text/x-patch
Size: 1489 bytes
Desc: not available
Url : 

More information about the jtreg-use mailing list