8038924: Test bit-instructions fails with unexpected exit value on sparc

Reviewed-by: kvn, iignatyev
This commit is contained in:
Filipp Zhinkin 2014-05-26 19:05:01 +04:00 committed by Igor Ignatyev
parent ee80d81323
commit e7419662ba
5 changed files with 129 additions and 72 deletions

View File

@ -25,6 +25,12 @@ import com.oracle.java.testlibrary.cli.*;
/**
* Base class for all X86 bit manipulation related command line options.
*
* Note that this test intended to verify that VM could be launched with
* specific options and that values of these options processed correctly.
* In order to do that test launch a new VM with tested options, the same
* flavor-specific flag as one that was used for parent VM (-client, -server,
* -minimal, -graal) and '-version'.
*/
public abstract class BMICommandLineOptionTestBase
extends CPUSpecificCommandLineOptionTest {
@ -58,10 +64,11 @@ public abstract class BMICommandLineOptionTestBase
String supportedCPUFeatures[],
String unsupportedCPUFeatures[]) {
super(".*", supportedCPUFeatures, unsupportedCPUFeatures);
this.optionName = optionName;
this.warningMessage = warningMessage;
this.errorMessage = CommandLineOptionTest.
UNRECOGNIZED_OPTION_ERROR_FORMAT.format(optionName);
this.optionName = optionName;
this.warningMessage = warningMessage;
this.errorMessage = String.format(
CommandLineOptionTest.UNRECOGNIZED_OPTION_ERROR_FORMAT,
optionName);
}
}

View File

@ -28,6 +28,12 @@ import com.oracle.java.testlibrary.cli.*;
* Test on bit manipulation related command line options,
* that should be executed on CPU that supports all required
* features.
*
* Note that this test intended to verify that VM could be launched with
* specific options and that values of these options processed correctly.
* In order to do that test launch a new VM with tested options, the same
* flavor-specific flag as one that was used for parent VM (-client, -server,
* -minimal, -graal) and '-version'.
*/
public class BMISupportedCPUTest extends BMICommandLineOptionTestBase {
@ -49,24 +55,38 @@ public class BMISupportedCPUTest extends BMICommandLineOptionTestBase {
@Override
public void runTestCases() throws Throwable {
// verify that VM will succesfully start up whithout warnings
CommandLineOptionTest.
verifyJVMStartup("-XX:+" + optionName,
null, new String[] { warningMessage },
ExitCode.OK);
/*
Verify that VM will successfully start up without warnings.
VM will be launched with following flags:
-XX:+<tested option> -version
*/
CommandLineOptionTest.verifySameJVMStartup(null,
new String[] { warningMessage }, ExitCode.OK,
CommandLineOptionTest.prepareBooleanFlag(optionName, true));
// verify that VM will succesfully start up whithout warnings
CommandLineOptionTest.
verifyJVMStartup("-XX:-" + optionName,
null, new String[] { warningMessage },
ExitCode.OK);
/*
Verify that VM will successfully start up without warnings.
VM will be launched with following flags:
-XX:-<tested option> -version
*/
CommandLineOptionTest.verifySameJVMStartup(null,
new String[] { warningMessage }, ExitCode.OK,
CommandLineOptionTest.prepareBooleanFlag(optionName, false));
// verify that on appropriate CPU option in on by default
CommandLineOptionTest.verifyOptionValue(optionName, "true");
/*
Verify that on appropriate CPU option in on by default.
VM will be launched with following flags:
-version
*/
CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "true");
// verify that option could be explicitly turned off
CommandLineOptionTest.verifyOptionValue(optionName, "false",
"-XX:-" + optionName);
/*
Verify that option could be explicitly turned off.
VM will be launched with following flags:
-XX:-<tested option> -version
*/
CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false",
CommandLineOptionTest.prepareBooleanFlag(optionName, false));
}
}

View File

@ -28,6 +28,12 @@ import com.oracle.java.testlibrary.cli.*;
* Test on bit manipulation related command line options,
* that should be executed on CPU that does not support
* required features.
*
* Note that this test intended to verify that VM could be launched with
* specific options and that values of these options processed correctly.
* In order to do that test launch a new VM with tested options, the same
* flavor-specific flag as one that was used for parent VM (-client, -server,
* -minimal, -graal) and '-version'.
*/
public class BMIUnsupportedCPUTest extends BMICommandLineOptionTestBase {
@ -64,28 +70,38 @@ public class BMIUnsupportedCPUTest extends BMICommandLineOptionTestBase {
*/
public void unsupportedX86CPUTestCases() throws Throwable {
// verify that VM will succesfully start up, but output will
// contain a warning
CommandLineOptionTest.
verifyJVMStartup("-XX:+" + optionName,
new String[] { warningMessage },
new String[] { errorMessage },
ExitCode.OK);
/*
Verify that VM will successfully start up, but output will contain a
warning. VM will be launched with following options:
-XX:+<tested option> -version
*/
CommandLineOptionTest.verifySameJVMStartup(
new String[] { warningMessage }, new String[] { errorMessage },
ExitCode.OK, CommandLineOptionTest.prepareBooleanFlag(
optionName, true));
// verify that VM will succesfully startup without any warnings
CommandLineOptionTest.
verifyJVMStartup("-XX:-" + optionName,
null,
new String[] { warningMessage, errorMessage },
ExitCode.OK);
/*
Verify that VM will successfully startup without any warnings.
VM will be launched with following options:
-XX:-<tested option> -version
*/
CommandLineOptionTest.verifySameJVMStartup(null,
new String[] { warningMessage, errorMessage }, ExitCode.OK,
CommandLineOptionTest.prepareBooleanFlag(optionName, false));
// verify that on unsupported CPUs option is off by default
CommandLineOptionTest.verifyOptionValue(optionName, "false");
/*
Verify that on unsupported CPUs option is off by default.
VM will be launched with following options: -version
*/
CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false");
// verify that on unsupported CPUs option will be off even if
// it was explicitly turned on by uset
CommandLineOptionTest.verifyOptionValue(optionName, "false",
"-XX:+" + optionName);
/*
Verify that on unsupported CPUs option will be off even if
it was explicitly turned on by user. VM will be launched with
following options: -XX:+<tested option> -version
*/
CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false",
CommandLineOptionTest.prepareBooleanFlag(optionName, true));
}
@ -97,18 +113,17 @@ public class BMIUnsupportedCPUTest extends BMICommandLineOptionTestBase {
*/
public void unsupportedNonX86CPUTestCases() throws Throwable {
// verify that VM known nothing about tested option
CommandLineOptionTest.
verifyJVMStartup("-XX:+" + optionName,
new String[] { errorMessage },
null,
ExitCode.FAIL);
/*
Verify that VM known nothing about tested option. VM will be launched
with following options: -XX:[+-]<tested option> -version
*/
CommandLineOptionTest.verifySameJVMStartup(
new String[] { errorMessage }, null, ExitCode.FAIL,
CommandLineOptionTest.prepareBooleanFlag(optionName, true));
CommandLineOptionTest.
verifyJVMStartup("-XX:-" + optionName,
new String[] { errorMessage },
null,
ExitCode.FAIL);
CommandLineOptionTest.verifySameJVMStartup(
new String[] { errorMessage }, null, ExitCode.FAIL,
CommandLineOptionTest.prepareBooleanFlag(optionName, false));
}
}

View File

@ -40,7 +40,8 @@ import com.oracle.java.testlibrary.*;
import com.oracle.java.testlibrary.cli.*;
public class TestUseCountTrailingZerosInstructionOnSupportedCPU
extends BMISupportedCPUTest {
extends BMISupportedCPUTest {
private static final String DISABLE_BMI = "-XX:-UseBMI1Instructions";
public TestUseCountTrailingZerosInstructionOnSupportedCPU() {
super("UseCountTrailingZerosInstruction", TZCNT_WARNING, "bmi1");
@ -51,18 +52,23 @@ public class TestUseCountTrailingZerosInstructionOnSupportedCPU
super.runTestCases();
// verify that option will be disabled if all BMI1 instuctions
// are explicitly disabled
CommandLineOptionTest.
verifyOptionValue("UseCountTrailingZerosInstruction", "false",
"-XX:-UseBMI1Instructions");
/*
Verify that option will be disabled if all BMI1 instructions
are explicitly disabled. VM will be launched with following options:
-XX:-UseBMI1Instructions -version
*/
CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false",
TestUseCountTrailingZerosInstructionOnSupportedCPU.DISABLE_BMI);
// verify that option could be turned on even if other BMI1
// instructions were turned off
CommandLineOptionTest.
verifyOptionValue("UseCountTrailingZerosInstruction", "true",
"-XX:-UseBMI1Instructions",
"-XX:+UseCountTrailingZerosInstruction");
/*
Verify that option could be turned on even if other BMI1
instructions were turned off. VM will be launched with following
options: -XX:-UseBMI1Instructions
-XX:+UseCountTrailingZerosInstruction -version
*/
CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "true",
TestUseCountTrailingZerosInstructionOnSupportedCPU.DISABLE_BMI,
CommandLineOptionTest.prepareBooleanFlag(optionName, true));
}
public static void main(String args[]) throws Throwable {

View File

@ -25,7 +25,7 @@
* @test
* @bug 8031321
* @summary Verify processing of UseCountTrailingZerosInstruction option
* on CPU without TZCNT instuction (BMI1 feature) support.
* on CPU without TZCNT instruction (BMI1 feature) support.
* @library /testlibrary /testlibrary/whitebox
* @build TestUseCountTrailingZerosInstructionOnUnsupportedCPU
* BMIUnsupportedCPUTest
@ -40,7 +40,8 @@ import com.oracle.java.testlibrary.*;
import com.oracle.java.testlibrary.cli.*;
public class TestUseCountTrailingZerosInstructionOnUnsupportedCPU
extends BMIUnsupportedCPUTest {
extends BMIUnsupportedCPUTest {
private static final String ENABLE_BMI = "-XX:+UseBMI1Instructions";
public TestUseCountTrailingZerosInstructionOnUnsupportedCPU() {
super("UseCountTrailingZerosInstruction", TZCNT_WARNING, "bmi1");
@ -51,16 +52,24 @@ public class TestUseCountTrailingZerosInstructionOnUnsupportedCPU
super.unsupportedX86CPUTestCases();
// verify that option will not be turned on during
// UseBMI1Instuctions processing
CommandLineOptionTest.
verifyOptionValue("UseCountTrailingZerosInstruction", "false",
"-XX:+UseBMI1Instructions");
/*
Verify that option will not be turned on during UseBMI1Instructions
processing. VM will be launched with following options:
-XX:+UseBMI1Instructions -version
*/
CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false",
TestUseCountTrailingZerosInstructionOnUnsupportedCPU.
ENABLE_BMI);
CommandLineOptionTest.
verifyOptionValue("UseCountTrailingZerosInstruction", "false",
"-XX:+UseCountTrailingZerosInstruction",
"-XX:+UseBMI1Instructions");
/*
VM will be launched with following options:
-XX:+UseCountTrailingZerosInstruction -XX:+UseBMI1Instructions
-version
*/
CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false",
CommandLineOptionTest.prepareBooleanFlag(optionName, true),
TestUseCountTrailingZerosInstructionOnUnsupportedCPU.
ENABLE_BMI);
}
public static void main(String args[]) throws Throwable {