Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Java port of jsDriver.pl for Rhino available

2 views
Skip to first unread message

David P. Caldwell

unread,
Sep 25, 2006, 11:14:42 PM9/25/06
to
Building on Attila's work on quality control and testing, I've
submitted a patch for Rhino (filed under bug #353501) that does
the following:

* Builds on Attila's JUnit test suite

* Fixes a bug in which scripts that have compile-time errors are
not reported as failures

* Makes it possible to configure the location of the test library
and the timeout interval

* Integrates it with the Ant build.xml file

* Provides a command-line Java port of jsDriver.pl which can run the
tests in the JavaScript Test Library,

* Produces an HTML output file that resembles the jsDriver.pl
output file

* Provides configuration options that are compatible with the
jsDriver.pl options, like the ability to include/exclude certain
tests and the ability to specify the location of the tests and the
output destination. Is command-line compatible with jsDriver.pl
(at least the options that are documented on the man page), but
ignores several command-line options (what Java to use, shell
path, etc.).

* Integrates the Java port of jsDriver.pl with the Ant build system

I am open to suggestions and feedback; I submit my patch humbly. :)
In order to finish the implementation, I made some choices that we
could revisit. Here are some I can think of:

* I made little effort to target any particular version of the JRE
and did no testing other than on my local setup. I did refrain from
using the JDK 1.5 language enhancements, so the code is uglier than
it need be in some places.

* I pretty blindly followed conventions from jsDriver.pl without
critically evaluating them. It's quite possible that there are
improvements that could be made.

* For example, the output HTML links to bug numbers (as jsDriver.pl
does), but these appear to be mostly SpiderMonkey bugs (at least
at a glance). It's possible that this check should be omitted, or
that Rhino bug numbers should be embedded in a properties file in
the mozilla/js/rhino part of the CVS tree (and then we could flag
test failures with no bug numbers?), or something.

* I'm not in love with the HTML page itself.

* One area where the Java port (as well as Attila's JUnit suite)
differs from the original is that it doesn't launch a separate
instance of the Java runtime for each test. This leads to a
substantial speed increase (about 1.5 seconds per test on my
workstation, which adds up fast). In theory, though, this could
cause differences between the results of jsDriver.pl and the Java
port (for example, if a script modified Java system properties).
Does anyone know whether there are any tests like this in practice?

Although I left the timeout at 60 seconds in deference to Attila's
original choice, I recommend running with a much lower timeout (e.g.,
1 second) because the tests then run in a manageable length of time,
and are more stable (some of the tests that eventually fail with
OutOfMemoryError, etc., won't use up so much if you don't give them
time). It would be better to allow per-test configuration of whether
to fork a new VM, and timeout, and things like that, but that's
another patch. :)

I couldn't get the patch exactly right for various reasons, so I
apologize -- the file StandardTests.java needs to be manually edited
after applying the patch, by deleting everything after the second
package statement (it'll be clear if you see it).

I'm happy to discuss thoughts.

-- David Caldwell
http://www.inonit.com/

0 new messages