jtreg test case for failing VM option?
Jonathan Gibbons
jonathan.gibbons at oracle.com
Wed Aug 21 12:56:36 PDT 2013
Write a /samevm test to exec a VM and check for the desired failure mode.
-- Jon
On 08/21/2013 11:37 AM, Aleksey Shipilev wrote:
> 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