Fix error parser tests. We were using deprecated APIs. Also, fix some buggy extraction of filenames from linker errors.
authorEd Swartz <ed.swartz@nokia.com>
Fri, 09 Apr 2010 09:33:24 -0500
changeset 1193 3229f07471de
parent 1190 e0412d845ffb
child 1197 214c435e2d15
Fix error parser tests. We were using deprecated APIs. Also, fix some buggy extraction of filenames from linker errors.
builder/com.nokia.carbide.cdt.builder.test/data/errorpatterns/bugzilla/2969.gcce.regression.xml
builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/CarbideErrorParserTestHarness.java
builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/ErrorParserRegressionGenerator.java
builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/error/parsers/AbstractGCCEErrorParser.java
--- a/builder/com.nokia.carbide.cdt.builder.test/data/errorpatterns/bugzilla/2969.gcce.regression.xml	Fri Apr 09 07:51:50 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder.test/data/errorpatterns/bugzilla/2969.gcce.regression.xml	Fri Apr 09 09:33:24 2010 -0500
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <root>
   <!--Error Marker at index 0-->
-  <marker_info file="^EMPTY^" line_number="0" message="\S60\devices\S60_3rd_FP2_SDK_v1.1\epoc32\release\ARMV5\LIB\foo.dso: No such file: No such file or directory" severity="2" variable_name="^EMPTY^" external_path_string="^EMPTY^" />
+  <marker_info file="^EMPTY^" line_number="0" message="No such file: No such file or directory" severity="2" variable_name="^EMPTY^" external_path_string="/S60/devices/S60_3rd_FP2_SDK_v1.1/epoc32/release/ARMV5/LIB/foo.dso" />
   <!--Error Marker at index 1-->
   <marker_info file="^EMPTY^" line_number="0" message="No such file or directory" severity="2" variable_name="^EMPTY^" external_path_string="test/test.cpp" />
   <!--Error Marker at index 2-->
--- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/CarbideErrorParserTestHarness.java	Fri Apr 09 07:51:50 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/CarbideErrorParserTestHarness.java	Fri Apr 09 09:33:24 2010 -0500
@@ -103,6 +103,7 @@
 		try {
 			// pick out the stdout stream directly, where CDT error parser sniff
 			// for error messages from build console
+			ideProblemMarkerInfoList.clear();
 			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
@@ -117,18 +118,15 @@
 	// need to intercept and keep track ourself
 	// reportProblems() calls this from base class
 	public void addMarker(ProblemMarkerInfo problemMarkerInfo) {
+		if (problemMarkerInfo.variableName == null || problemMarkerInfo.variableName.length() == 0)
+			problemMarkerInfo.variableName = EMPTY;
+		if (problemMarkerInfo.description == null || problemMarkerInfo.description.length() == 0)
+			problemMarkerInfo.description = EMPTY;
+			
 		ideProblemMarkerInfoList.add(problemMarkerInfo);
 		super.addMarker(problemMarkerInfo);
 	}
 	
-	// Read in error markers from IDE to this test harness and set up internal marker list
-	public void getMarkersFromIde() {
-		// flush out markers into project, that's the only way to tap into 
-		// markers reported by error parsers in current API
-		ideProblemMarkerInfoList.clear();
-		stdoutStream.reportProblems();
-	}
-	
 	/**
 	 * Do the comparison of the parsed results from the console and the expected results (control file)
 	 * @param consoleOutput - The output from the real build
@@ -163,7 +161,6 @@
 	 */ 
 	public boolean testIdeMarkerAgainstXML(InputStream xmlInputStream) {
 		// load data from IDE and control file
-		getMarkersFromIde();
 		readControlXML(xmlInputStream);
 		
 		if (ideProblemMarkerInfoList.size() != xmlFilePromblemMarkerInfoList.size()) {
--- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/ErrorParserRegressionGenerator.java	Fri Apr 09 07:51:50 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/ErrorParserRegressionGenerator.java	Fri Apr 09 09:33:24 2010 -0500
@@ -123,7 +123,6 @@
 		// This is how we capture a control case
 		try {
 			harness.writeFileContentsToStdout(FileUtils.pluginRelativeFile(TestPlugin.getDefault(), "data/errorpatterns/regression_capture/your.input.errorparser.txt"));
-			harness.getMarkersFromIde();
 			java.io.File file = FileUtils.pluginRelativeFile(TestPlugin.getDefault(), "data/errorpatterns/regression_capture/regression.capture.xml");
 			if (!file.exists()) {
 				file.createNewFile();
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/error/parsers/AbstractGCCEErrorParser.java	Fri Apr 09 07:51:50 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/error/parsers/AbstractGCCEErrorParser.java	Fri Apr 09 09:33:24 2010 -0500
@@ -39,7 +39,8 @@
 		 *	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$
+			// arm-none-symbianelf-ld: \S60\devices\S60_3rd_FP2_SDK_v1.1\epoc32\release\ARMV5\LIB\foo.dso: No such file: 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$
 			// 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