jtreg test case for failing VM option?

Aleksey Shipilev aleksey.shipilev at oracle.com
Wed Aug 21 11:37:13 PDT 2013


Hi,

I want to write the test for the failing VM option, i.e. write the test
for acceptable ranges for particular option. This is the test I have in
hand:

/*
 * @test
 * @bug     8006997
 * @summary ContendedPaddingWidth should be range-checked
 *
 * @run main/othervm/fail -XX:-RestrictContended
-XX:ContendedPaddingWidth=-1 Options
 */
public class Options {
    public static void main(String[] args) throws Exception {
        System.out.println("Test PASSES");
    }
}

I was tempted to think /fail will invert the behavior for the test, and
if VM exits with non-zero exit code, it counts the test as passed.
However, jtreg marks this test as failed, because:

----------System.err:(4/215)----------
ContendedPaddingWidth=-1 must be the between 0 and 8192
ContendedPaddingWidth=-1 must be the multiple of 8
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
result: Failed. Unexpected exit from test [exit code: 1]

Is there a proper way to make the test like this?

-Aleksey.


More information about the jtreg-use mailing list