From 33038927b7b70e088cf5830a0315ec8846b161aa Mon Sep 17 00:00:00 2001 From: Andrew Gvozdev Date: Sun, 11 Oct 2009 04:47:24 +0000 Subject: [PATCH] bug 212596: JUnit failures in cdt.managedbuilder.test.suite more heuristics --- .../testplugin/ManagedBuildTestHelper.java | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/ManagedBuildTestHelper.java b/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/ManagedBuildTestHelper.java index fb5e1e15854..feff7f55aef 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/ManagedBuildTestHelper.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/ManagedBuildTestHelper.java @@ -459,9 +459,10 @@ public class ManagedBuildTestHelper { * @return {@code true} if matches, {@code false} otherwise */ private static boolean compareMakefiles(IPath testFile, IPath benchmarkFile) { - final String ECHO_LINKER_PATTERN = " @echo 'Invoking: .* C\\+\\+ Linker'"; + final String ECHO_INVOKING_PATTERN = " @echo 'Invoking: .* C\\+\\+ .*'"; final String IFNEQ_PATTERN = "ifneq \\(\\$\\(strip \\$\\(.*\\)\\),\\)"; final String INCLUDE_PATTERN = "-include \\$\\(.*\\)"; + final String MACRO_PATTERN = "\\S* :=.*"; ArrayList testArray = getContents(testFile); ArrayList benchmarkArray = getContents(benchmarkFile); if (testArray.size()!=benchmarkArray.size()) { @@ -488,7 +489,7 @@ public class ManagedBuildTestHelper { return false; } } - } else if (testLine.matches(ECHO_LINKER_PATTERN) && benchmarkLine.matches(ECHO_LINKER_PATTERN)) { + } else if (testLine.matches(ECHO_INVOKING_PATTERN) && benchmarkLine.matches(ECHO_INVOKING_PATTERN)) { // accommodate for variable linker name (GCC vs. Cygwin) continue; } else if (testLine.matches(IFNEQ_PATTERN) && benchmarkLine.matches(IFNEQ_PATTERN)) { @@ -502,23 +503,30 @@ public class ManagedBuildTestHelper { // accommodate for variable order of different macro's blocks (see IFNEQ_PATTERN) testNotMatchingLines.add(testLine); benchNotMatchingLines.add(benchmarkLine); + } else if (testLine.matches(MACRO_PATTERN) && benchmarkLine.matches(MACRO_PATTERN)) { + // accommodate for variable order of macros + testNotMatchingLines.add(testLine); + benchNotMatchingLines.add(benchmarkLine); } else { - System.out.println("Following lines do not match:"); - System.out.println("actual : ["+testLine+"]"); - System.out.println("expected: ["+benchmarkLine+"]"); + System.out.println("Following lines do not match ("+testFile.lastSegment()+"):"); + System.out.println("actual : ["+testLine+"], file "+testFile); + System.out.println("expected: ["+benchmarkLine+"], file "+benchmarkFile); return false; } } } - // Check if all lines of ifneq blocks match (irrespective of order) + // Check if all collected lines match irrespective of order String[] testNotMatchingLinesArray = testNotMatchingLines.toArray(new String[0]); String[] benchNotMatchingLinesArray = benchNotMatchingLines.toArray(new String[0]); for (int i=0;i