8026154: [TESTBUG] runtime/CDSCompressedKPtrs/XShareAuto.java failed due to exception

Added statements in the tests to handle failures in sharing

Reviewed-by: zgu, ctornqvi
This commit is contained in:
Mikhailo Seledtsov 2014-03-10 14:50:20 -04:00
parent eedf369513
commit ce25911489
3 changed files with 20 additions and 18 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -22,7 +22,6 @@
*/ */
/* /*
* @ignore 8026154
* @test * @test
* @bug 8005933 * @bug 8005933
* @summary Test that -Xshare:auto uses CDS when explicitly specified with -server. * @summary Test that -Xshare:auto uses CDS when explicitly specified with -server.
@ -50,21 +49,15 @@ public class XShareAuto {
pb = ProcessTools.createJavaProcessBuilder( pb = ProcessTools.createJavaProcessBuilder(
"-server", "-Xshare:auto", "-XX:+UnlockDiagnosticVMOptions", "-server", "-Xshare:auto", "-XX:+UnlockDiagnosticVMOptions",
"-XX:SharedArchiveFile=./sample.jsa", "-version"); "-XX:SharedArchiveFile=./sample.jsa", "-XX:+PrintSharedSpaces", "-version");
output = new OutputAnalyzer(pb.start()); output = new OutputAnalyzer(pb.start());
try { try {
output.shouldContain("sharing"); output.shouldContain("sharing");
output.shouldHaveExitValue(0);
} catch (RuntimeException e) { } catch (RuntimeException e) {
// If this failed then check that it would also be unable // if sharing failed due to ASLR or similar reasons,
// to share even if -Xshare:on is specified. If so, then // check whether sharing was attempted at all (UseSharedSpaces)
// return a success status. output.shouldContain("UseSharedSpaces:");
pb = ProcessTools.createJavaProcessBuilder(
"-server", "-Xshare:on", "-XX:+UnlockDiagnosticVMOptions",
"-XX:SharedArchiveFile=./sample.jsa", "-version");
output = new OutputAnalyzer(pb.start());
output.shouldContain("Unable to use shared archive");
output.shouldHaveExitValue(1);
} }
output.shouldHaveExitValue(0);
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -22,7 +22,6 @@
*/ */
/* /*
* @ignore 8025642
* @test CdsDifferentObjectAlignment * @test CdsDifferentObjectAlignment
* @summary Testing CDS (class data sharing) using varying object alignment. * @summary Testing CDS (class data sharing) using varying object alignment.
* Using different object alignment for each dump/load pair. * Using different object alignment for each dump/load pair.
@ -84,7 +83,11 @@ public class CdsDifferentObjectAlignment {
createAlignment, createAlignment,
loadAlignment); loadAlignment);
output.shouldContain(expectedErrorMsg); try {
output.shouldContain(expectedErrorMsg);
} catch (RuntimeException e) {
output.shouldContain("Unable to use shared archive");
}
output.shouldHaveExitValue(1); output.shouldHaveExitValue(1);
} }
} }

View File

@ -22,7 +22,6 @@
*/ */
/* /*
* @ignore 8032224
* @test DefaultUseWithClient * @test DefaultUseWithClient
* @summary Test default behavior of sharing with -client * @summary Test default behavior of sharing with -client
* @library /testlibrary * @library /testlibrary
@ -57,10 +56,17 @@ public class DefaultUseWithClient {
"-XX:+UnlockDiagnosticVMOptions", "-XX:+UnlockDiagnosticVMOptions",
"-XX:SharedArchiveFile=./" + fileName, "-XX:SharedArchiveFile=./" + fileName,
"-client", "-client",
"-XX:+PrintSharedSpaces",
"-version"); "-version");
output = new OutputAnalyzer(pb.start()); output = new OutputAnalyzer(pb.start());
output.shouldContain("sharing"); try {
output.shouldContain("sharing");
} catch (RuntimeException e) {
// if sharing failed due to ASLR or similar reasons,
// check whether sharing was attempted at all (UseSharedSpaces)
output.shouldContain("UseSharedSpaces:");
}
output.shouldHaveExitValue(0); output.shouldHaveExitValue(0);
} }
} }