# HG changeset patch # User Ed Swartz # Date 1259959094 21600 # Node ID 4a8b1092f0a4cddcb2ec4edb1db62613be3f0b53 # Parent 675796977d5c0b49efa39c3f790063d02d1c1607 Fix some error parser unit tests. A trailing colon was being included in several source files. Part of the fix is in CDT fix and Austin/MCL/sftools/dev/eclipseenv/eclipse 123:71e3840b8eca diff -r 675796977d5c -r 4a8b1092f0a4 builder/com.nokia.carbide.cdt.builder.test/data/errorpatterns/abstractgcce.regression.xml --- a/builder/com.nokia.carbide.cdt.builder.test/data/errorpatterns/abstractgcce.regression.xml Fri Dec 04 13:53:51 2009 -0600 +++ b/builder/com.nokia.carbide.cdt.builder.test/data/errorpatterns/abstractgcce.regression.xml Fri Dec 04 14:38:14 2009 -0600 @@ -1,7 +1,7 @@ - + diff -r 675796977d5c -r 4a8b1092f0a4 builder/com.nokia.carbide.cdt.builder.test/data/errorpatterns/bugzilla/2969.gcce.regression.xml --- a/builder/com.nokia.carbide.cdt.builder.test/data/errorpatterns/bugzilla/2969.gcce.regression.xml Fri Dec 04 13:53:51 2009 -0600 +++ b/builder/com.nokia.carbide.cdt.builder.test/data/errorpatterns/bugzilla/2969.gcce.regression.xml Fri Dec 04 14:38:14 2009 -0600 @@ -3,7 +3,7 @@ - + - + diff -r 675796977d5c -r 4a8b1092f0a4 builder/com.nokia.carbide.cdt.builder.test/data/errorpatterns/bugzilla/4541.gcce.regression.xml --- a/builder/com.nokia.carbide.cdt.builder.test/data/errorpatterns/bugzilla/4541.gcce.regression.xml Fri Dec 04 13:53:51 2009 -0600 +++ b/builder/com.nokia.carbide.cdt.builder.test/data/errorpatterns/bugzilla/4541.gcce.regression.xml Fri Dec 04 14:38:14 2009 -0600 @@ -1,6 +1,6 @@ - + diff -r 675796977d5c -r 4a8b1092f0a4 builder/com.nokia.carbide.cdt.builder.test/data/errorpatterns/bugzilla/5824.gcce.regression.xml --- a/builder/com.nokia.carbide.cdt.builder.test/data/errorpatterns/bugzilla/5824.gcce.regression.xml Fri Dec 04 13:53:51 2009 -0600 +++ b/builder/com.nokia.carbide.cdt.builder.test/data/errorpatterns/bugzilla/5824.gcce.regression.xml Fri Dec 04 14:38:14 2009 -0600 @@ -1,25 +1,25 @@ - + - + - + - + diff -r 675796977d5c -r 4a8b1092f0a4 builder/com.nokia.carbide.cdt.builder.test/data/errorpatterns/bugzilla/6417.gcce.regression.xml --- a/builder/com.nokia.carbide.cdt.builder.test/data/errorpatterns/bugzilla/6417.gcce.regression.xml Fri Dec 04 13:53:51 2009 -0600 +++ b/builder/com.nokia.carbide.cdt.builder.test/data/errorpatterns/bugzilla/6417.gcce.regression.xml Fri Dec 04 14:38:14 2009 -0600 @@ -1,165 +1,165 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -169,69 +169,69 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff -r 675796977d5c -r 4a8b1092f0a4 builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/CarbideErrorParserTestHarness.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/CarbideErrorParserTestHarness.java Fri Dec 04 13:53:51 2009 -0600 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/CarbideErrorParserTestHarness.java Fri Dec 04 14:38:14 2009 -0600 @@ -23,7 +23,6 @@ import java.io.FileInputStream; import java.io.FileNotFoundException; -import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.PrintStream; @@ -53,6 +52,7 @@ import com.nokia.carbide.cdt.builder.builder.CarbideCommandLauncher; import com.nokia.carbide.cdt.builder.test.TestPlugin; import com.nokia.cpp.internal.api.utils.core.FileUtils; +import com.nokia.cpp.internal.api.utils.core.HostOS; public class CarbideErrorParserTestHarness extends CarbideCommandLauncher { static final String EMPTY = "^EMPTY^"; @@ -85,23 +85,12 @@ } private String readFile(java.io.File consoleOutput) { - FileReader consoleReader; - StringBuffer sb = new StringBuffer(); try { - consoleReader = new FileReader(consoleOutput); - char[] buf = new char[1024]; - int len; - while ((len = consoleReader.read(buf)) > 0) { - sb.append(buf, 0, len); - } - consoleReader.close(); - - } catch (FileNotFoundException e) { - Assert.fail(); - } catch (IOException e) { - Assert.fail(); + return new String(FileUtils.readFileContents(consoleOutput, null)); + } catch (CoreException e) { + Assert.fail(e.toString()); + return null; } - return sb.toString(); } public void writeFileContentsToStdout(java.io.File consoleOutput) { @@ -110,18 +99,16 @@ // Drive the whole parsing mechanism, stdout is output normally came from console outout public void writeStringToStdout(String consoleOutput) { - // pick out the stdout stream directly, where CDT error parser sniff - // for error messages from build console try { + // pick out the stdout stream directly, where CDT error parser sniff + // for error messages from build console stdoutStream.getProject().deleteMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, true, IResource.DEPTH_INFINITE); // clear UI list before we start stdoutStream.clearScratchBuffer(); // some error parser do multiple lines consoleOutput += "\n"; // force the input file to flush all lines stdoutStream.write(consoleOutput.getBytes()); stdoutStream.flush(); - } catch (IOException e) { - Assert.fail(); - } catch (CoreException e) { - Assert.fail(); + } catch (Exception e) { + Assert.fail(e.toString()); } } @@ -151,7 +138,7 @@ try { return parseStringAndTestAgainstXML(readFile(consoleOutput), new FileInputStream(controlXml)); } catch (FileNotFoundException e) { - Assert.fail(); + Assert.fail(e.toString()); } return false; } @@ -163,6 +150,9 @@ * @return */ public boolean parseStringAndTestAgainstXML (String consoleOutput, InputStream xmlInputStream) { + // make slashes match what the tool would really generate + if (HostOS.IS_UNIX) + consoleOutput = consoleOutput.replaceAll("\\\\(?!\r|\n)", "/"); writeStringToStdout(consoleOutput); return testIdeMarkerAgainstXML (xmlInputStream); } @@ -253,9 +243,14 @@ } } else { if (result.externalPath.equals(expected.externalPath) == false) { - Assert.fail("External path string from IDE marker is " + result.externalPath + - ", expected value is " + expected.externalPath); - return false; + // note: for some reason, on Unix, relative paths become full paths + if (HostOS.IS_UNIX && result.externalPath.makeRelative().equals(expected.externalPath.makeRelative())) { + // fine + } else { + Assert.fail("External path string from IDE marker is " + result.externalPath + + ", expected value is " + expected.externalPath); + return false; + } } } return true; @@ -293,6 +288,10 @@ Attribute messageNode = markerInfo.getAttribute(MESSAGE); description = messageNode.getValue(); + // make slashes match what the tool would really generate + if (HostOS.IS_UNIX) { + description = description.replaceAll("\\\\(?!\r|\n)", "/"); + } Attribute severityNode = markerInfo.getAttribute(SEVERITY); severity = Integer.parseInt(severityNode.getValue()); @@ -301,7 +300,7 @@ variableName = variableNameNode.getValue(); Attribute externalPathStringNode = markerInfo.getAttribute(EXTERNAL_PATH_STRING); - externalPath = new org.eclipse.core.runtime.Path(externalPathStringNode.getValue()); + externalPath = HostOS.createPathFromString(externalPathStringNode.getValue()); ProblemMarkerInfo details = new ProblemMarkerInfo(file, lineNumber, description, severity, variableName, externalPath); xmlFilePromblemMarkerInfoList.add(details); @@ -361,7 +360,7 @@ if (marker.externalPath == null || marker.externalPath.equals("")) { externalPathString = EMPTY; } else { - externalPathString = marker.externalPath.toString(); + externalPathString = marker.externalPath.toPortableString(); } child.setAttribute(EXTERNAL_PATH_STRING, externalPathString); diff -r 675796977d5c -r 4a8b1092f0a4 builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/ErrorParserRegressionGenerator.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/ErrorParserRegressionGenerator.java Fri Dec 04 13:53:51 2009 -0600 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/ErrorParserRegressionGenerator.java Fri Dec 04 14:38:14 2009 -0600 @@ -42,7 +42,7 @@ // TODO Auto-generated constructor stub } - private static final String PROJECT_NAME = "TestErrorParser"; + //private static final String PROJECT_NAME = "TestErrorParser"; // Platform matters, set this before you build private static final String PLATFORM_STRING = ISymbianBuildContext.GCCE_PLATFORM; diff -r 675796977d5c -r 4a8b1092f0a4 builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/TestGcceErrorParser.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/TestGcceErrorParser.java Fri Dec 04 13:53:51 2009 -0600 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/TestGcceErrorParser.java Fri Dec 04 14:38:14 2009 -0600 @@ -20,10 +20,11 @@ import java.util.ArrayList; import java.util.List; +import junit.framework.TestCase; + import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.NullProgressMonitor; -import com.nokia.carbide.automation.utils.UITestCase; import com.nokia.carbide.automation.utils.debugger.DebuggerTestCaseParameters; import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; import com.nokia.carbide.cdt.builder.builder.CarbideCPPBuilder; @@ -36,7 +37,7 @@ import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; import com.nokia.cpp.internal.api.utils.core.FileUtils; -public class TestGcceErrorParser extends UITestCase implements DebuggerTestCaseParameters { +public class TestGcceErrorParser extends TestCase implements DebuggerTestCaseParameters { public TestGcceErrorParser(String name) { super(name); diff -r 675796977d5c -r 4a8b1092f0a4 builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/TestMakeErrorParser.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/TestMakeErrorParser.java Fri Dec 04 13:53:51 2009 -0600 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/TestMakeErrorParser.java Fri Dec 04 14:38:14 2009 -0600 @@ -20,10 +20,11 @@ import java.util.ArrayList; import java.util.List; +import junit.framework.TestCase; + import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.NullProgressMonitor; -import com.nokia.carbide.automation.utils.UITestCase; import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; import com.nokia.carbide.cdt.builder.builder.CarbideCPPBuilder; import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; @@ -35,7 +36,7 @@ import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; import com.nokia.cpp.internal.api.utils.core.FileUtils; -public class TestMakeErrorParser extends UITestCase { +public class TestMakeErrorParser extends TestCase { public TestMakeErrorParser(String name) { super(name); diff -r 675796977d5c -r 4a8b1092f0a4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/error/parsers/AbstractGCCEErrorParser.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/error/parsers/AbstractGCCEErrorParser.java Fri Dec 04 13:53:51 2009 -0600 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/error/parsers/AbstractGCCEErrorParser.java Fri Dec 04 14:38:14 2009 -0600 @@ -39,7 +39,7 @@ * int severity */ // arm-none-symbianelf-g++: \test\test.cpp: No such file or directory - new ErrorPattern("(.*):\\s*(.*:)\\s*(.*(?:[Nn]o such file:\\s*)?[Nn]o such file or directory)", 2, 0, 3, 0, IMarkerGenerator.SEVERITY_ERROR_RESOURCE), //$NON-NLS-1$ + new ErrorPattern("(.*):\\s*(.*):\\s*(.*(?:[Nn]o such file:\\s*)?[Nn]o such file or directory)", 2, 0, 3, 0, IMarkerGenerator.SEVERITY_ERROR_RESOURCE), //$NON-NLS-1$ // arm-none-symbianelf-g++: no input files new ErrorPattern("(.*):\\s*(.*[Nn]o input files)", 0, 0, 2, 0, IMarkerGenerator.SEVERITY_ERROR_RESOURCE), //$NON-NLS-1$ //arm-none-symbianelf-g++: warning: `-x c++' after last input file has no effect