Use external classes in @run driver

Jonathan Gibbons jonathan.gibbons at oracle.com
Mon Jun 15 14:42:41 UTC 2020


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