8069035: compiler/oracle/CheckCompileCommandOption.java nightly failure
Fixed whitespace handling and added test cases Reviewed-by: kvn, anoll, zmajo
This commit is contained in:
parent
01ec695002
commit
a43e328b4a
@ -690,6 +690,13 @@ static MethodMatcher* scan_flag_and_value(const char* type, const char* line, in
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int skip_whitespace(char* line) {
|
||||||
|
// Skip any leading spaces
|
||||||
|
int whitespace_read = 0;
|
||||||
|
sscanf(line, "%*[ \t]%n", &whitespace_read);
|
||||||
|
return whitespace_read;
|
||||||
|
}
|
||||||
|
|
||||||
void CompilerOracle::parse_from_line(char* line) {
|
void CompilerOracle::parse_from_line(char* line) {
|
||||||
if (line[0] == '\0') return;
|
if (line[0] == '\0') return;
|
||||||
if (line[0] == '#') return;
|
if (line[0] == '#') return;
|
||||||
@ -756,15 +763,9 @@ void CompilerOracle::parse_from_line(char* line) {
|
|||||||
|
|
||||||
line += bytes_read;
|
line += bytes_read;
|
||||||
|
|
||||||
// Skip any leading spaces before signature
|
|
||||||
int whitespace_read = 0;
|
|
||||||
sscanf(line, "%*[ \t]%n", &whitespace_read);
|
|
||||||
if (whitespace_read > 0) {
|
|
||||||
line += whitespace_read;
|
|
||||||
}
|
|
||||||
|
|
||||||
// there might be a signature following the method.
|
// there might be a signature following the method.
|
||||||
// signatures always begin with ( so match that by hand
|
// signatures always begin with ( so match that by hand
|
||||||
|
line += skip_whitespace(line);
|
||||||
if (1 == sscanf(line, "(%254[[);/" RANGEBASE "]%n", sig + 1, &bytes_read)) {
|
if (1 == sscanf(line, "(%254[[);/" RANGEBASE "]%n", sig + 1, &bytes_read)) {
|
||||||
sig[0] = '(';
|
sig[0] = '(';
|
||||||
line += bytes_read;
|
line += bytes_read;
|
||||||
@ -787,7 +788,9 @@ void CompilerOracle::parse_from_line(char* line) {
|
|||||||
//
|
//
|
||||||
// For future extensions: extend scan_flag_and_value()
|
// For future extensions: extend scan_flag_and_value()
|
||||||
char option[256]; // stores flag for Type (1) and type of Type (2)
|
char option[256]; // stores flag for Type (1) and type of Type (2)
|
||||||
while (sscanf(line, "%*[ \t]%255[a-zA-Z0-9]%n", option, &bytes_read) == 1) {
|
|
||||||
|
line += skip_whitespace(line);
|
||||||
|
while (sscanf(line, "%255[a-zA-Z0-9]%n", option, &bytes_read) == 1) {
|
||||||
if (match != NULL && !_quiet) {
|
if (match != NULL && !_quiet) {
|
||||||
// Print out the last match added
|
// Print out the last match added
|
||||||
ttyLocker ttyl;
|
ttyLocker ttyl;
|
||||||
@ -817,6 +820,7 @@ void CompilerOracle::parse_from_line(char* line) {
|
|||||||
// Type (1) option
|
// Type (1) option
|
||||||
match = add_option_string(c_name, c_match, m_name, m_match, signature, option, true);
|
match = add_option_string(c_name, c_match, m_name, m_match, signature, option, true);
|
||||||
}
|
}
|
||||||
|
line += skip_whitespace(line);
|
||||||
} // while(
|
} // while(
|
||||||
} else {
|
} else {
|
||||||
match = add_predicate(command, c_name, c_match, m_name, m_match, signature);
|
match = add_predicate(command, c_name, c_match, m_name, m_match, signature);
|
||||||
|
@ -21,12 +21,15 @@
|
|||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
import com.oracle.java.testlibrary.*;
|
import com.oracle.java.testlibrary.*;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @test CheckCompileCommandOption
|
* @test CheckCompileCommandOption
|
||||||
* @bug 8055286 8056964 8059847
|
* @bug 8055286 8056964 8059847 8069035
|
||||||
* @summary "Checks parsing of -XX:+CompileCommand=option"
|
* @summary "Checks parsing of -XX:CompileCommand=option"
|
||||||
* @library /testlibrary
|
* @library /testlibrary
|
||||||
* @run main CheckCompileCommandOption
|
* @run main CheckCompileCommandOption
|
||||||
*/
|
*/
|
||||||
@ -45,38 +48,69 @@ public class CheckCompileCommandOption {
|
|||||||
// have the the following types: intx, uintx, bool, ccstr,
|
// have the the following types: intx, uintx, bool, ccstr,
|
||||||
// ccstrlist, and double.
|
// ccstrlist, and double.
|
||||||
|
|
||||||
|
private static final String[][] FILE_ARGUMENTS = {
|
||||||
|
{
|
||||||
|
"-XX:CompileCommandFile=" + new File(System.getProperty("test.src", "."), "command1.txt"),
|
||||||
|
"-version"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"-XX:CompileCommandFile=" + new File(System.getProperty("test.src", "."), "command2.txt"),
|
||||||
|
"-version"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private static final String[][] FILE_EXPECTED_OUTPUT = {
|
||||||
|
{
|
||||||
|
"CompileCommand: option com/oracle/Test.test bool MyBoolOption1 = true",
|
||||||
|
"CompileCommand: option com/oracle/Test.test bool MyBoolOption2 = true",
|
||||||
|
"CompileCommand: option com/oracle/Test.test bool MyBoolOption3 = true",
|
||||||
|
"CompileCommand: option com/oracle/Test.test bool MyBoolOption4 = true",
|
||||||
|
"CompileCommand: option com/oracle/Test.test bool MyBoolOption5 = true",
|
||||||
|
"CompileCommand: option com/oracle/Test.test bool MyBoolOption6 = true",
|
||||||
|
"CompileCommand: option com/oracle/Test.test bool MyBoolOption7 = true",
|
||||||
|
"CompileCommand: option com/oracle/Test.test bool MyBoolOption8 = true",
|
||||||
|
"CompileCommand: option com/oracle/Test.test(I) bool MyBoolOption9 = true",
|
||||||
|
"CompileCommand: option com/oracle/Test.test(I) bool MyBoolOption10 = true",
|
||||||
|
"CompileCommand: option com/oracle/Test.test(I) bool MyBoolOption11 = true",
|
||||||
|
"CompileCommand: option com/oracle/Test.test(I) bool MyBoolOption12 = true",
|
||||||
|
"CompileCommand: option com/oracle/Test.test(I) bool MyBoolOption13 = true",
|
||||||
|
"CompileCommand: option com/oracle/Test.test(I) bool MyBoolOption14 = true",
|
||||||
|
"CompileCommand: option com/oracle/Test.test(I) bool MyBoolOption15 = true",
|
||||||
|
"CompileCommand: option com/oracle/Test.test(I) bool MyBoolOption16 = true"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"CompileCommand: option Test.test const char* MyListOption = '_foo _bar'",
|
||||||
|
"CompileCommand: option Test.test const char* MyStrOption = '_foo'",
|
||||||
|
"CompileCommand: option Test.test bool MyBoolOption = false",
|
||||||
|
"CompileCommand: option Test.test intx MyIntxOption = -1",
|
||||||
|
"CompileCommand: option Test.test uintx MyUintxOption = 1",
|
||||||
|
"CompileCommand: option Test.test bool MyFlag = true",
|
||||||
|
"CompileCommand: option Test.test double MyDoubleOption = 1.123000"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
private static final String[][] TYPE_1_ARGUMENTS = {
|
private static final String[][] TYPE_1_ARGUMENTS = {
|
||||||
{
|
{
|
||||||
"-XX:CompileCommand=option,com/oracle/Test.test,MyBoolOption1",
|
"-XX:CompileCommand=option,com/oracle/Test.test,MyBoolOption1",
|
||||||
"-XX:CompileCommand=option,com/oracle/Test,test,MyBoolOption2",
|
"-XX:CompileCommand=option,com/oracle/Test,test,MyBoolOption2",
|
||||||
"-XX:CompileCommand=option,com.oracle.Test::test,MyBoolOption3",
|
"-XX:CompileCommand=option,com.oracle.Test::test,MyBoolOption3",
|
||||||
"-XX:CompileCommand=option,com/oracle/Test::test,MyBoolOption4",
|
"-XX:CompileCommand=option,com/oracle/Test::test,MyBoolOption4",
|
||||||
"-version"
|
"-XX:CompileCommand=option,com/oracle/Test.test,MyBoolOption5,MyBoolOption6",
|
||||||
},
|
"-XX:CompileCommand=option,com/oracle/Test,test,MyBoolOption7,MyBoolOption8",
|
||||||
{
|
|
||||||
"-XX:CompileCommand=option,com/oracle/Test.test,MyBoolOption1,MyBoolOption2",
|
|
||||||
"-version"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"-XX:CompileCommand=option,com/oracle/Test,test,MyBoolOption1,MyBoolOption2",
|
|
||||||
"-version"
|
"-version"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final String[][] TYPE_1_EXPECTED_OUTPUTS = {
|
private static final String[][] TYPE_1_EXPECTED_OUTPUTS = {
|
||||||
{
|
{
|
||||||
"CompilerOracle: option com/oracle/Test.test bool MyBoolOption1 = true",
|
"CompileCommand: option com/oracle/Test.test bool MyBoolOption1 = true",
|
||||||
"CompilerOracle: option com/oracle/Test.test bool MyBoolOption2 = true",
|
"CompileCommand: option com/oracle/Test.test bool MyBoolOption2 = true",
|
||||||
"CompilerOracle: option com/oracle/Test.test bool MyBoolOption3 = true",
|
"CompileCommand: option com/oracle/Test.test bool MyBoolOption3 = true",
|
||||||
"CompilerOracle: option com/oracle/Test.test bool MyBoolOption4 = true"
|
"CompileCommand: option com/oracle/Test.test bool MyBoolOption4 = true",
|
||||||
},
|
"CompileCommand: option com/oracle/Test.test bool MyBoolOption5 = true",
|
||||||
{
|
"CompileCommand: option com/oracle/Test.test bool MyBoolOption6 = true",
|
||||||
"CompilerOracle: option com/oracle/Test.test bool MyBoolOption1 = true",
|
"CompileCommand: option com/oracle/Test.test bool MyBoolOption7 = true",
|
||||||
"CompilerOracle: option com/oracle/Test.test bool MyBoolOption2 = true",
|
"CompileCommand: option com/oracle/Test.test bool MyBoolOption8 = true"
|
||||||
},
|
|
||||||
{
|
|
||||||
"CompilerOracle: option com/oracle/Test.test bool MyBoolOption1 = true",
|
|
||||||
"CompilerOracle: option com/oracle/Test.test bool MyBoolOption2 = true",
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -88,38 +122,28 @@ public class CheckCompileCommandOption {
|
|||||||
"-XX:CompileCommand=option,Test::test,intx,MyIntxOption,-1",
|
"-XX:CompileCommand=option,Test::test,intx,MyIntxOption,-1",
|
||||||
"-XX:CompileCommand=option,Test::test,uintx,MyUintxOption,1",
|
"-XX:CompileCommand=option,Test::test,uintx,MyUintxOption,1",
|
||||||
"-XX:CompileCommand=option,Test::test,MyFlag",
|
"-XX:CompileCommand=option,Test::test,MyFlag",
|
||||||
"-XX:CompileCommand=option,Test::test,double,MyDoubleOption,1.123",
|
"-XX:CompileCommand=option,Test::test,double,MyDoubleOption1,1.123",
|
||||||
"-version"
|
"-XX:CompileCommand=option,Test.test,double,MyDoubleOption2,1.123",
|
||||||
},
|
"-XX:CompileCommand=option,Test::test,bool,MyBoolOptionX,false,intx,MyIntxOptionX,-1,uintx,MyUintxOptionX,1,MyFlagX,double,MyDoubleOptionX,1.123",
|
||||||
{
|
|
||||||
"-XX:CompileCommand=option,Test.test,double,MyDoubleOption,1.123",
|
|
||||||
"-version"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"-XX:CompileCommand=option,Test::test,bool,MyBoolOption,false,intx,MyIntxOption,-1,uintx,MyUintxOption,1,MyFlag,double,MyDoubleOption,1.123",
|
|
||||||
"-version"
|
"-version"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final String[][] TYPE_2_EXPECTED_OUTPUTS = {
|
private static final String[][] TYPE_2_EXPECTED_OUTPUTS = {
|
||||||
{
|
{
|
||||||
"CompilerOracle: option Test.test const char* MyListOption = '_foo _bar'",
|
"CompileCommand: option Test.test const char* MyListOption = '_foo _bar'",
|
||||||
"CompilerOracle: option Test.test const char* MyStrOption = '_foo'",
|
"CompileCommand: option Test.test const char* MyStrOption = '_foo'",
|
||||||
"CompilerOracle: option Test.test bool MyBoolOption = false",
|
"CompileCommand: option Test.test bool MyBoolOption = false",
|
||||||
"CompilerOracle: option Test.test intx MyIntxOption = -1",
|
"CompileCommand: option Test.test intx MyIntxOption = -1",
|
||||||
"CompilerOracle: option Test.test uintx MyUintxOption = 1",
|
"CompileCommand: option Test.test uintx MyUintxOption = 1",
|
||||||
"CompilerOracle: option Test.test bool MyFlag = true",
|
"CompileCommand: option Test.test bool MyFlag = true",
|
||||||
"CompilerOracle: option Test.test double MyDoubleOption = 1.123000"
|
"CompileCommand: option Test.test double MyDoubleOption1 = 1.123000",
|
||||||
},
|
"CompileCommand: option Test.test double MyDoubleOption2 = 1.123000",
|
||||||
{
|
"CompileCommand: option Test.test bool MyBoolOptionX = false",
|
||||||
"CompilerOracle: option Test.test double MyDoubleOption = 1.123000"
|
"CompileCommand: option Test.test intx MyIntxOptionX = -1",
|
||||||
},
|
"CompileCommand: option Test.test uintx MyUintxOptionX = 1",
|
||||||
{
|
"CompileCommand: option Test.test bool MyFlagX = true",
|
||||||
"CompilerOracle: option Test.test bool MyBoolOption = false",
|
"CompileCommand: option Test.test double MyDoubleOptionX = 1.123000",
|
||||||
"CompilerOracle: option Test.test intx MyIntxOption = -1",
|
|
||||||
"CompilerOracle: option Test.test uintx MyUintxOption = 1",
|
|
||||||
"CompilerOracle: option Test.test bool MyFlag = true",
|
|
||||||
"CompilerOracle: option Test.test double MyDoubleOption = 1.123000",
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -172,7 +196,7 @@ public class CheckCompileCommandOption {
|
|||||||
out.shouldContain(expected_output);
|
out.shouldContain(expected_output);
|
||||||
}
|
}
|
||||||
|
|
||||||
out.shouldNotContain("CompileCommand: unrecognized line");
|
out.shouldNotContain("CompileCommand: An error occured during parsing");
|
||||||
out.shouldHaveExitValue(0);
|
out.shouldHaveExitValue(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,7 +207,7 @@ public class CheckCompileCommandOption {
|
|||||||
pb = ProcessTools.createJavaProcessBuilder(arguments);
|
pb = ProcessTools.createJavaProcessBuilder(arguments);
|
||||||
out = new OutputAnalyzer(pb.start());
|
out = new OutputAnalyzer(pb.start());
|
||||||
|
|
||||||
out.shouldContain("CompileCommand: unrecognized line");
|
out.shouldContain("CompileCommand: An error occured during parsing");
|
||||||
out.shouldHaveExitValue(0);
|
out.shouldHaveExitValue(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,5 +236,10 @@ public class CheckCompileCommandOption {
|
|||||||
for (String[] arguments: TYPE_2_INVALID_ARGUMENTS) {
|
for (String[] arguments: TYPE_2_INVALID_ARGUMENTS) {
|
||||||
verifyInvalidOption(arguments);
|
verifyInvalidOption(arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if commands in command file are parsed correctly
|
||||||
|
for (int i = 0; i < FILE_ARGUMENTS.length; i++) {
|
||||||
|
verifyValidOption(FILE_ARGUMENTS[i], FILE_EXPECTED_OUTPUT[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
12
hotspot/test/compiler/oracle/command1.txt
Normal file
12
hotspot/test/compiler/oracle/command1.txt
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
option,com/oracle/Test.test,MyBoolOption1
|
||||||
|
option,com/oracle/Test,test,MyBoolOption2
|
||||||
|
option,com.oracle.Test::test,MyBoolOption3
|
||||||
|
option,com/oracle/Test::test,MyBoolOption4
|
||||||
|
option,com/oracle/Test.test,MyBoolOption5,MyBoolOption6
|
||||||
|
option,com/oracle/Test,test,MyBoolOption7,MyBoolOption8
|
||||||
|
option,com/oracle/Test.test(I),MyBoolOption9
|
||||||
|
option,com/oracle/Test,test,(I),MyBoolOption10
|
||||||
|
option,com.oracle.Test::test(I),MyBoolOption11
|
||||||
|
option,com/oracle/Test::test(I),MyBoolOption12
|
||||||
|
option,com/oracle/Test.test(I),MyBoolOption13,MyBoolOption14
|
||||||
|
option,com/oracle/Test,test(I),MyBoolOption15,MyBoolOption16
|
7
hotspot/test/compiler/oracle/command2.txt
Normal file
7
hotspot/test/compiler/oracle/command2.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
option,Test::test,ccstrlist,MyListOption,_foo,_bar
|
||||||
|
option,Test::test,ccstr,MyStrOption,_foo
|
||||||
|
option,Test::test,bool,MyBoolOption,false
|
||||||
|
option,Test::test,intx,MyIntxOption,-1
|
||||||
|
option,Test::test,uintx,MyUintxOption,1
|
||||||
|
option,Test::test,MyFlag
|
||||||
|
option,Test::test,double,MyDoubleOption,1.123
|
Loading…
Reference in New Issue
Block a user