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.
*
* This code is free software; you can redistribute it and/or modify it
@ -22,7 +22,6 @@
*/
/*
* @ignore 8026154
* @test
* @bug 8005933
* @summary Test that -Xshare:auto uses CDS when explicitly specified with -server.
@ -50,21 +49,15 @@ public class XShareAuto {
pb = ProcessTools.createJavaProcessBuilder(
"-server", "-Xshare:auto", "-XX:+UnlockDiagnosticVMOptions",
"-XX:SharedArchiveFile=./sample.jsa", "-version");
"-XX:SharedArchiveFile=./sample.jsa", "-XX:+PrintSharedSpaces", "-version");
output = new OutputAnalyzer(pb.start());
try {
output.shouldContain("sharing");
output.shouldHaveExitValue(0);
} catch (RuntimeException e) {
// If this failed then check that it would also be unable
// to share even if -Xshare:on is specified. If so, then
// return a success status.
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);
// if sharing failed due to ASLR or similar reasons,
// check whether sharing was attempted at all (UseSharedSpaces)
output.shouldContain("UseSharedSpaces:");
}
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.
*
* This code is free software; you can redistribute it and/or modify it
@ -22,7 +22,6 @@
*/
/*
* @ignore 8025642
* @test CdsDifferentObjectAlignment
* @summary Testing CDS (class data sharing) using varying object alignment.
* Using different object alignment for each dump/load pair.
@ -84,7 +83,11 @@ public class CdsDifferentObjectAlignment {
createAlignment,
loadAlignment);
output.shouldContain(expectedErrorMsg);
try {
output.shouldContain(expectedErrorMsg);
} catch (RuntimeException e) {
output.shouldContain("Unable to use shared archive");
}
output.shouldHaveExitValue(1);
}
}

View File

@ -22,7 +22,6 @@
*/
/*
* @ignore 8032224
* @test DefaultUseWithClient
* @summary Test default behavior of sharing with -client
* @library /testlibrary
@ -57,10 +56,17 @@ public class DefaultUseWithClient {
"-XX:+UnlockDiagnosticVMOptions",
"-XX:SharedArchiveFile=./" + fileName,
"-client",
"-XX:+PrintSharedSpaces",
"-version");
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);
}
}