Use external classes in @run driver

Liu, Xin xxinliu at amazon.com
Sun Jun 14 08:18:20 UTC 2020


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