Specifying @run action on command-line

Jonathan Gibbons jonathan.gibbons at oracle.com
Wed Jan 31 16:49:38 UTC 2018


Sorry, no, the contents of the `/* @test ...*/` is indivisible, and can 
only be run all-together. Think of it like a script ... you're asking to 
select/run one line of a script.

There is one technique, which may not be what you want, that is now 
better supported, and that is to put independent tests into separate `/* 
@test ...*/` blocks. You can select individual blocks to be run using a 
`<file>#id<N>` syntax on the command line. Think of it a URL fragment 

The other way to provide more flexible behavior is to avoid using 
multiple @run tags, but just use one, to nominate a class that can 
determine what to run, perhaps starting new VMs with a call to some 
suitable test library.

I realize both of these suggestions involve significant refactoring, so 
for a quick debug/test scenario, you're probably best with either 
commenting out lines or running the test directly.   Note that the .jtr 
file should contain a "rerun" section for each @run command, that you 
can extract into a shell script, to make rerunning that part of the test 
reasonably easy.

-- Jon

On 1/31/18 8:10 AM, Sean Mullan wrote:
> I have a test that has quite a few @run actions. Is there a way with 
> jtreg to run just one of those @run actions or specify my own @run 
> action? Otherwise I have to comment out all the ones that I don't want 
> to run or run the test directly with the VM without using jtreg.
> Thanks,
> Sean

More information about the jtreg-use mailing list