mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-02 05:45:58 +02:00
bug 212596: JUnit failures in cdt.managedbuilder.test.suite
Ignoring empty macros during comparison
This commit is contained in:
parent
fe2cc5e4fd
commit
f2512325cc
1 changed files with 26 additions and 5 deletions
|
@ -463,16 +463,24 @@ public class ManagedBuildTestHelper {
|
||||||
final String IFNEQ_PATTERN = "ifneq \\(\\$\\(strip \\$\\(.*\\)\\),\\)";
|
final String IFNEQ_PATTERN = "ifneq \\(\\$\\(strip \\$\\(.*\\)\\),\\)";
|
||||||
final String INCLUDE_PATTERN = "-include \\$\\(.*\\)";
|
final String INCLUDE_PATTERN = "-include \\$\\(.*\\)";
|
||||||
final String MACRO_PATTERN = "\\S* :=.*";
|
final String MACRO_PATTERN = "\\S* :=.*";
|
||||||
|
final String EMPTY_MACRO_PATTERN = "\\S* :=";
|
||||||
ArrayList<String> testArray = getContents(testFile);
|
ArrayList<String> testArray = getContents(testFile);
|
||||||
ArrayList<String> benchmarkArray = getContents(benchmarkFile);
|
ArrayList<String> benchmarkArray = getContents(benchmarkFile);
|
||||||
if (testArray.size()!=benchmarkArray.size()) {
|
|
||||||
System.out.println("testArray.size="+testArray.size()+ " while benchmarkArray.size="+benchmarkArray.size());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Set<String> testNotMatchingLines = new TreeSet<String>();
|
Set<String> testNotMatchingLines = new TreeSet<String>();
|
||||||
Set<String> benchNotMatchingLines = new TreeSet<String>();
|
Set<String> benchNotMatchingLines = new TreeSet<String>();
|
||||||
for (int i=0;i<benchmarkArray.size();i++) {
|
Set<String> extraLines = new TreeSet<String>();
|
||||||
|
for (int i=0;i<benchmarkArray.size() || i<testArray.size();i++) {
|
||||||
|
if (!(i<benchmarkArray.size())) {
|
||||||
|
System.out.println(testFile.lastSegment()+": extra line =["+testArray.get(i)+ "] not in benchmark. File "+testFile);
|
||||||
|
extraLines.add(testArray.get(i));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!(i<testArray.size())) {
|
||||||
|
System.out.println(testFile.lastSegment()+": missing line =["+benchmarkArray.get(i)+ "] comparing to benchmark. File "+testFile);
|
||||||
|
extraLines.add(benchmarkArray.get(i));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
String testLine = testArray.get(i);
|
String testLine = testArray.get(i);
|
||||||
String benchmarkLine = benchmarkArray.get(i);
|
String benchmarkLine = benchmarkArray.get(i);
|
||||||
if (!testLine.equals(benchmarkLine)) {
|
if (!testLine.equals(benchmarkLine)) {
|
||||||
|
@ -515,6 +523,19 @@ public class ManagedBuildTestHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (testArray.size()!=benchmarkArray.size()) {
|
||||||
|
System.out.println("testArray.size="+testArray.size()+ " while benchmarkArray.size="+benchmarkArray.size());
|
||||||
|
// Ignore benign differences
|
||||||
|
for (String line : extraLines) {
|
||||||
|
if (line==null || line.length()==0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (line.matches(EMPTY_MACRO_PATTERN)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check if all collected lines match irrespective of order
|
// Check if all collected lines match irrespective of order
|
||||||
String[] testNotMatchingLinesArray = testNotMatchingLines.toArray(new String[0]);
|
String[] testNotMatchingLinesArray = testNotMatchingLines.toArray(new String[0]);
|
||||||
|
|
Loading…
Add table
Reference in a new issue