Use external classes in @run driver
Liu, Xin
xxinliu at amazon.com
Mon Jun 15 17:14:44 UTC 2020
Hi, Jonathan,
Thank you to look into it.
I am using " jtreg, version 5.1 dev 821". It's not 5.2. my bad.
I am working on jdk8u/hotspot + vmTestbase. You probably know that test directories are separated in jdk8u.
I'd like to reuse FileInstaller.java in ../../jdk/test/lib/jdk/test/lib. Otherwise, I need a clone of tes/lib/* in hotspot/test.
Do you think it's a reasonable use-case? if so, is it possible to access external classes in annotation @run?
The output was written by jtreg. Something weird happened. I think I need to put FileInstaller in its classpath first.
thanks,
--lx
On 6/15/20, 7:44 AM, "jtreg-use on behalf of Jonathan Gibbons" <jtreg-use-bounces at openjdk.java.net on behalf of jonathan.gibbons at oracle.com> wrote:
CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.
Hi,
There's at least a couple of things going on here.
1. external.lib.roots is only used for library code that is outside the
current test suite (i.e. outside the directory containing TEST.ROOT)
It provides root directories in which to resolve @library
directories that begin with '/'.
In other words, if you have
@library /my/lib
and you have
external.lib.roots=../A ../B
Then jtreg will look for library files in TESTROOTDIR/my/lib,
TESTROOTDIR/../A, TESTROOTDIR/../B
where TESTROOTDIR is the root directory of the test suite.
2. There's something weird the output you posted:
TIME: .lib.FileInstaller seconds
If that's what jtreg wrote, that is an unexpected error in jtreg
3. Minor: the current released version of jtreg is 5.1, as indicated by
the Mercurial tag jtreg5.1-b01
The default version of 5.2 in the tip changeset will be the version
of the next update.
-- Jon
On 6/14/20 1:18 AM, Liu, Xin wrote:
> Hi,
>
> I'd like to use some external classes in @run driver. Those classes are “external” in the sense of directory. They locate out of my current test directory.
> Eg. “@run driver jdk.test.lib.FileInstaller . .” and the class FileInstaller is here.
> $find ../../ -name FileInstaller.java
> ../../jdk/test/lib/jdk/test/lib/FileInstaller.java
>
> I am now using the latest jreg(5.2). Doc says that jtreg acts like adding an “@build classname” before @run driver.
> About how to discover the classes, quote the corresponding description in Action Types/build (https://openjdk.java.net/jtreg/tag-spec.html#ACTION_TYPES),
> "
> To locate a source file for a named class, the harness takes the first matching file found by looking in the test-source directory and then in each appropriate directory of the library path list.
> "
> quote end. I don't understand the definition of library path list here. Is it the same thing as @library? I try to tell jtreg that use these two external roots in TEST.ROOT.
> # depends on jdk/test
> external.lib.roots=../../jdk ../../jdk/test/lib
>
> and also, I see that the test does have the annotation @library.
> * @library /vmTestbase
> * /test/lib
> * @run driver jdk.test.lib.FileInstaller . .
>
> But it doesn’t work. I still get the error message as follows.
> ACTION: build -- Not run. Test running...
> REASON: Named class compiled on demand
> TIME: .lib.FileInstaller seconds
> messages:
> command: build jdk.test.lib.FileInstaller
> reason: Named class compiled on demand
>
> TEST RESULT: Error. can't find jdk.test.lib.FileInstaller in test directory or libraries
>
> Could you educate me the right usage?
> Thank you in advance.
> --lx
>
>
More information about the jtreg-use
mailing list