Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Recoskie2009-06-02 14:38:25 +0000
committerChris Recoskie2009-06-02 14:38:25 +0000
commit5358c015a3c5ff21be42c8bed418dbf7f517c001 (patch)
tree9da9179141d46aff0c5627f87fa247ec65bb9d23 /xlc/org.eclipse.cdt.errorparsers.xlc.tests
parent61b9542da8ce9b104e64f2992ddf4a8ee31ac5af (diff)
downloadorg.eclipse.cdt-5358c015a3c5ff21be42c8bed418dbf7f517c001.tar.gz
org.eclipse.cdt-5358c015a3c5ff21be42c8bed418dbf7f517c001.tar.xz
org.eclipse.cdt-5358c015a3c5ff21be42c8bed418dbf7f517c001.zip
RESOLVED - bug 258385: xlC error parser should extend AbstractErrorParser (to disambiguate files with the same name)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=258385
Diffstat (limited to 'xlc/org.eclipse.cdt.errorparsers.xlc.tests')
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc.tests/META-INF/MANIFEST.MF2
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/AllXlcErrorParserTests.java8
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestCompatibility.java39
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestConditional.java8
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestFloatingPoint.java8
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestFuncArg.java8
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestLinkerDuplicateSymbol.java40
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestLinkerErrorWhileReading.java40
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestLinkerInfo.java40
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestLinkerSevereError.java40
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestLinkerUndefinedSymbol.java40
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestMacroRedefinition.java42
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestMissingArg.java8
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestNoFuncProto.java8
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestOperModi.java8
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestSyntaxError.java8
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestUndeclIdent.java8
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestUnrecoverableError.java40
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestsPlugin.java6
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/XlcErrorParserTester.java133
20 files changed, 500 insertions, 34 deletions
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/META-INF/MANIFEST.MF b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/META-INF/MANIFEST.MF
index 0713adeca1f..a0af1819a53 100644
--- a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/META-INF/MANIFEST.MF
+++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/META-INF/MANIFEST.MF
@@ -6,6 +6,8 @@ Bundle-Version: 1.0.0
Bundle-Activator: org.eclipse.cdt.errorparsers.xlc.tests.TestsPlugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.cdt.core,
org.eclipse.cdt.errorparsers.xlc,
org.junit
Bundle-ActivationPolicy: lazy
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/AllXlcErrorParserTests.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/AllXlcErrorParserTests.java
index 72bcdaa7f52..f4edce873be 100644
--- a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/AllXlcErrorParserTests.java
+++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/AllXlcErrorParserTests.java
@@ -30,6 +30,14 @@ public class AllXlcErrorParserTests {
suite.addTestSuite(TestConditional.class);
suite.addTestSuite(TestSyntaxError.class);
suite.addTestSuite(TestNoFuncProto.class);
+ suite.addTestSuite(TestCompatibility.class);
+ suite.addTestSuite(TestUnrecoverableError.class);
+ suite.addTestSuite(TestMacroRedefinition.class);
+ suite.addTestSuite(TestLinkerUndefinedSymbol.class);
+ suite.addTestSuite(TestLinkerDuplicateSymbol.class);
+ suite.addTestSuite(TestLinkerSevereError.class);
+ suite.addTestSuite(TestLinkerErrorWhileReading.class);
+ suite.addTestSuite(TestLinkerInfo.class);
//$JUnit-END$
return suite;
}
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestCompatibility.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestCompatibility.java
new file mode 100644
index 00000000000..8ede91fc8f7
--- /dev/null
+++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestCompatibility.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.errorparsers.xlc.tests;
+
+import junit.framework.TestCase;
+
+import org.eclipse.cdt.core.IMarkerGenerator;
+
+public class TestCompatibility extends TestCase {
+ String err_msg;
+ /**
+ * This function tests parseLine function of the
+ * XlcErrorParser class. Error message generated by
+ * xlC compiler without message number or quotes around file name
+ * which was OK in older version.
+ */
+ public void testparseLine()
+ {
+ XlcErrorParserTester aix = new XlcErrorParserTester();
+ aix.parseLine(err_msg);
+ assertEquals("temp1.c", aix.getFileName());
+ assertEquals(5, aix.getLineNumber());
+ assertEquals(IMarkerGenerator.SEVERITY_INFO, aix.getSeverity());
+ assertEquals(" Compatibility test",aix.getMessage());
+ }
+ public TestCompatibility( String name)
+ {
+ super(name);
+ err_msg = "temp1.c, line 5.1: (I) Compatibility test";
+ }
+}
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestConditional.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestConditional.java
index 0da09d25f3c..442d232e587 100644
--- a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestConditional.java
+++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestConditional.java
@@ -11,10 +11,10 @@
package org.eclipse.cdt.errorparsers.xlc.tests;
-import org.eclipse.cdt.errorparsers.xlc.XlcErrorParser;
-
import junit.framework.TestCase;
+import org.eclipse.cdt.core.IMarkerGenerator;
+
public class TestConditional extends TestCase {
String err_msg;
@@ -25,11 +25,11 @@ public class TestConditional extends TestCase {
*/
public void testparseLine()
{
- XlcErrorParser aix = new XlcErrorParser();
+ XlcErrorParserTester aix = new XlcErrorParserTester();
aix.parseLine(err_msg);
assertEquals("temp8.c", aix.getFileName());
assertEquals(12, aix.getLineNumber());
- assertEquals("I", aix.getSeverity());
+ assertEquals(IMarkerGenerator.SEVERITY_INFO, aix.getSeverity());
assertEquals(" The then branch of conditional is an empty statement.",aix.getMessage());
}
public TestConditional( String name)
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestFloatingPoint.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestFloatingPoint.java
index 0460d5e5789..811bd94f2a1 100644
--- a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestFloatingPoint.java
+++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestFloatingPoint.java
@@ -11,10 +11,10 @@
package org.eclipse.cdt.errorparsers.xlc.tests;
-import org.eclipse.cdt.errorparsers.xlc.XlcErrorParser;
-
import junit.framework.TestCase;
+import org.eclipse.cdt.core.IMarkerGenerator;
+
public class TestFloatingPoint extends TestCase {
String err_msg;
@@ -26,11 +26,11 @@ public class TestFloatingPoint extends TestCase {
*/
public void testparseLine()
{
- XlcErrorParser aix = new XlcErrorParser();
+ XlcErrorParserTester aix = new XlcErrorParserTester();
aix.parseLine(err_msg);
assertEquals("temp9.c", aix.getFileName());
assertEquals(11, aix.getLineNumber());
- assertEquals("S", aix.getSeverity());
+ assertEquals(IMarkerGenerator.SEVERITY_ERROR_RESOURCE, aix.getSeverity());
assertEquals(" Floating point constant 10.23.3 is not valid",
aix.getMessage());
}
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestFuncArg.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestFuncArg.java
index 96b42de2242..d8642a07418 100644
--- a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestFuncArg.java
+++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestFuncArg.java
@@ -11,10 +11,10 @@
package org.eclipse.cdt.errorparsers.xlc.tests;
-import org.eclipse.cdt.errorparsers.xlc.XlcErrorParser;
-
import junit.framework.TestCase;
+import org.eclipse.cdt.core.IMarkerGenerator;
+
public class TestFuncArg extends TestCase {
String err_msg;
/**
@@ -25,11 +25,11 @@ public class TestFuncArg extends TestCase {
*/
public void testparseLine()
{
- XlcErrorParser aix = new XlcErrorParser();
+ XlcErrorParserTester aix = new XlcErrorParserTester();
aix.parseLine(err_msg);
assertEquals("temp9.c", aix.getFileName());
assertEquals(12, aix.getLineNumber());
- assertEquals("S", aix.getSeverity());
+ assertEquals(IMarkerGenerator.SEVERITY_ERROR_RESOURCE, aix.getSeverity());
assertEquals(" Function argument assignment between types " +
"\"int\" and \"char*\" is not allowed.",
aix.getMessage());
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestLinkerDuplicateSymbol.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestLinkerDuplicateSymbol.java
new file mode 100644
index 00000000000..7003cd0cf99
--- /dev/null
+++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestLinkerDuplicateSymbol.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.cdt.errorparsers.xlc.tests;
+
+import junit.framework.TestCase;
+
+import org.eclipse.cdt.core.IMarkerGenerator;
+
+public class TestLinkerDuplicateSymbol extends TestCase {
+ String err_msg;
+ /**
+ * This function tests parseLine function of the
+ * XlcErrorParser class. Error message generated by
+ * xlc linker with "WARNING" level is given as
+ * input for testing.
+ */
+ public void testparseLine()
+ {
+ XlcErrorParserTester aix = new XlcErrorParserTester();
+ aix.parseLine(err_msg);
+ assertEquals("", aix.getFileName());
+ assertEquals(0, aix.getLineNumber());
+ assertEquals(IMarkerGenerator.SEVERITY_WARNING, aix.getSeverity());
+ assertEquals("Duplicate symbol: dupefun",aix.getMessage());
+ }
+ public TestLinkerDuplicateSymbol( String name)
+ {
+ super(name);
+ err_msg = "ld: 0711-224 WARNING: Duplicate symbol: dupefun";
+ }
+}
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestLinkerErrorWhileReading.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestLinkerErrorWhileReading.java
new file mode 100644
index 00000000000..9fdaa1d496c
--- /dev/null
+++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestLinkerErrorWhileReading.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.cdt.errorparsers.xlc.tests;
+
+import junit.framework.TestCase;
+
+import org.eclipse.cdt.core.IMarkerGenerator;
+
+public class TestLinkerErrorWhileReading extends TestCase {
+ String err_msg;
+ /**
+ * This function tests parseLine function of the
+ * XlcErrorParser class. Error message generated by
+ * xlc linker with "ERROR" level is given as
+ * input for testing.
+ */
+ public void testparseLine()
+ {
+ XlcErrorParserTester aix = new XlcErrorParserTester();
+ aix.parseLine(err_msg);
+ assertEquals("", aix.getFileName());
+ assertEquals(0, aix.getLineNumber());
+ assertEquals(IMarkerGenerator.SEVERITY_ERROR_RESOURCE, aix.getSeverity());
+ assertEquals("Error occurred while reading file",aix.getMessage());
+ }
+ public TestLinkerErrorWhileReading( String name)
+ {
+ super(name);
+ err_msg = "ld: 0711-987 Error occurred while reading file";
+ }
+}
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestLinkerInfo.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestLinkerInfo.java
new file mode 100644
index 00000000000..c3c81cd323f
--- /dev/null
+++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestLinkerInfo.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.cdt.errorparsers.xlc.tests;
+
+import junit.framework.TestCase;
+
+import org.eclipse.cdt.core.IMarkerGenerator;
+
+public class TestLinkerInfo extends TestCase {
+ String err_msg;
+ /**
+ * This function tests parseLine function of the
+ * XlcErrorParser class. Informational message generated by
+ * xlc linker is given as
+ * input for testing.
+ */
+ public void testparseLine()
+ {
+ XlcErrorParserTester aix = new XlcErrorParserTester();
+ aix.parseLine(err_msg);
+ assertEquals("", aix.getFileName());
+ assertEquals(0, aix.getLineNumber());
+ assertEquals(IMarkerGenerator.SEVERITY_INFO, aix.getSeverity());
+ assertEquals("Use the -bloadmap or -bnoquiet option to obtain more information.",aix.getMessage());
+ }
+ public TestLinkerInfo( String name)
+ {
+ super(name);
+ err_msg = "ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.";
+ }
+}
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestLinkerSevereError.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestLinkerSevereError.java
new file mode 100644
index 00000000000..0cac0ebec97
--- /dev/null
+++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestLinkerSevereError.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.cdt.errorparsers.xlc.tests;
+
+import junit.framework.TestCase;
+
+import org.eclipse.cdt.core.IMarkerGenerator;
+
+public class TestLinkerSevereError extends TestCase {
+ String err_msg;
+ /**
+ * This function tests parseLine function of the
+ * XlcErrorParser class. Error message generated by
+ * xlc linker with "SEVERE ERROR" level is given as
+ * input for testing.
+ */
+ public void testparseLine()
+ {
+ XlcErrorParserTester aix = new XlcErrorParserTester();
+ aix.parseLine(err_msg);
+ assertEquals("", aix.getFileName());
+ assertEquals(0, aix.getLineNumber());
+ assertEquals(IMarkerGenerator.SEVERITY_ERROR_RESOURCE, aix.getSeverity());
+ assertEquals("EXEC binder commands nested too deeply.",aix.getMessage());
+ }
+ public TestLinkerSevereError( String name)
+ {
+ super(name);
+ err_msg = "ld: 0711-634 SEVERE ERROR: EXEC binder commands nested too deeply.";
+ }
+}
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestLinkerUndefinedSymbol.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestLinkerUndefinedSymbol.java
new file mode 100644
index 00000000000..25fea59c611
--- /dev/null
+++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestLinkerUndefinedSymbol.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.cdt.errorparsers.xlc.tests;
+
+import junit.framework.TestCase;
+
+import org.eclipse.cdt.core.IMarkerGenerator;
+
+public class TestLinkerUndefinedSymbol extends TestCase {
+ String err_msg;
+ /**
+ * This function tests parseLine function of the
+ * XlcErrorParser class. Error message generated by
+ * xlc linker with "ERROR" level is given as
+ * input for testing.
+ */
+ public void testparseLine()
+ {
+ XlcErrorParserTester aix = new XlcErrorParserTester();
+ aix.parseLine(err_msg);
+ assertEquals("", aix.getFileName());
+ assertEquals(0, aix.getLineNumber());
+ assertEquals(IMarkerGenerator.SEVERITY_ERROR_RESOURCE, aix.getSeverity());
+ assertEquals("Undefined symbol: nofun()",aix.getMessage());
+ }
+ public TestLinkerUndefinedSymbol( String name)
+ {
+ super(name);
+ err_msg = "ld: 0711-317 ERROR: Undefined symbol: nofun()";
+ }
+}
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestMacroRedefinition.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestMacroRedefinition.java
new file mode 100644
index 00000000000..11df2657eec
--- /dev/null
+++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestMacroRedefinition.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.errorparsers.xlc.tests;
+
+import junit.framework.TestCase;
+
+import org.eclipse.cdt.core.IMarkerGenerator;
+
+public class TestMacroRedefinition extends TestCase {
+ String err_msg;
+ /**
+ * This function tests parseLine function of the
+ * XlcErrorParser class. The second message generated by
+ * xlc compiler for macro redefinition problem is given as
+ * input for testing.
+ */
+ public void testparseLine()
+ {
+ XlcErrorParserTester aix = new XlcErrorParserTester();
+ aix.parseLine(err_msg);
+ assertEquals("temp1.h", aix.getFileName());
+ assertEquals(3, aix.getLineNumber());
+ assertEquals(IMarkerGenerator.SEVERITY_WARNING, aix.getSeverity());
+ assertEquals(" Macro name TEMP_1 originally defined in file temp1.h",aix.getMessage());
+ }
+ public TestMacroRedefinition( String name)
+ {
+ super(name);
+ // Macro redefinition warning provides 2 lines. First line is captured as regular warning message.
+ // "temp1.c", line 5.9: 1506-236 (W) Macro name TEMP_1 has been redefined.
+ // Second line is re-parsed to stay close to the first one and point to file with original definition
+ err_msg = "\"temp1.c\", line 5.9: 1506-358 (I) \"TEMP_1\" is defined on line 3 of temp1.h.";
+ }
+} \ No newline at end of file
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestMissingArg.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestMissingArg.java
index bf2cb85eb1a..2983514e2a0 100644
--- a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestMissingArg.java
+++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestMissingArg.java
@@ -11,10 +11,10 @@
package org.eclipse.cdt.errorparsers.xlc.tests;
-import org.eclipse.cdt.errorparsers.xlc.XlcErrorParser;
-
import junit.framework.TestCase;
+import org.eclipse.cdt.core.IMarkerGenerator;
+
public class TestMissingArg extends TestCase {
String err_msg;
@@ -26,11 +26,11 @@ public class TestMissingArg extends TestCase {
*/
public void testparseLine()
{
- XlcErrorParser aix = new XlcErrorParser();
+ XlcErrorParserTester aix = new XlcErrorParserTester();
aix.parseLine(err_msg);
assertEquals("temp8.c", aix.getFileName());
assertEquals(9, aix.getLineNumber());
- assertEquals("E", aix.getSeverity());
+ assertEquals(IMarkerGenerator.SEVERITY_ERROR_RESOURCE, aix.getSeverity());
assertEquals(" Missing argument(s).",aix.getMessage());
}
public TestMissingArg( String name)
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestNoFuncProto.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestNoFuncProto.java
index c8e66ad653f..5a327681e3d 100644
--- a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestNoFuncProto.java
+++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestNoFuncProto.java
@@ -10,10 +10,10 @@
*******************************************************************************/
package org.eclipse.cdt.errorparsers.xlc.tests;
-import org.eclipse.cdt.errorparsers.xlc.XlcErrorParser;
-
import junit.framework.TestCase;
+import org.eclipse.cdt.core.IMarkerGenerator;
+
public class TestNoFuncProto extends TestCase {
String err_msg;
/**
@@ -23,11 +23,11 @@ public class TestNoFuncProto extends TestCase {
*/
public void testparseLine()
{
- XlcErrorParser aix = new XlcErrorParser();
+ XlcErrorParserTester aix = new XlcErrorParserTester();
aix.parseLine(err_msg);
assertEquals("temp1.c", aix.getFileName());
assertEquals(5, aix.getLineNumber());
- assertEquals("W", aix.getSeverity());
+ assertEquals(IMarkerGenerator.SEVERITY_WARNING, aix.getSeverity());
assertEquals(" No function prototype given for \"printf\".",aix.getMessage());
}
public TestNoFuncProto( String name)
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestOperModi.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestOperModi.java
index aac5e04c101..af301cfd7c6 100644
--- a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestOperModi.java
+++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestOperModi.java
@@ -10,10 +10,10 @@
*******************************************************************************/
package org.eclipse.cdt.errorparsers.xlc.tests;
-import org.eclipse.cdt.errorparsers.xlc.XlcErrorParser;
-
import junit.framework.TestCase;
+import org.eclipse.cdt.core.IMarkerGenerator;
+
public class TestOperModi extends TestCase {
String err_msg;
@@ -25,11 +25,11 @@ public class TestOperModi extends TestCase {
*/
public void testparseLine()
{
- XlcErrorParser aix = new XlcErrorParser();
+ XlcErrorParserTester aix = new XlcErrorParserTester();
aix.parseLine(err_msg);
assertEquals("temp9.c", aix.getFileName());
assertEquals(13, aix.getLineNumber());
- assertEquals("S", aix.getSeverity());
+ assertEquals(IMarkerGenerator.SEVERITY_ERROR_RESOURCE, aix.getSeverity());
assertEquals(" Operand must be a modifiable lvalue.",aix.getMessage());
}
public TestOperModi( String name)
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestSyntaxError.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestSyntaxError.java
index d71de9a2815..64a172b7ac5 100644
--- a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestSyntaxError.java
+++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestSyntaxError.java
@@ -10,10 +10,10 @@
*******************************************************************************/
package org.eclipse.cdt.errorparsers.xlc.tests;
-import org.eclipse.cdt.errorparsers.xlc.XlcErrorParser;
-
import junit.framework.TestCase;
+import org.eclipse.cdt.core.IMarkerGenerator;
+
public class TestSyntaxError extends TestCase {
String err_msg;
/**
@@ -24,11 +24,11 @@ public class TestSyntaxError extends TestCase {
*/
public void testparseLine()
{
- XlcErrorParser aix = new XlcErrorParser();
+ XlcErrorParserTester aix = new XlcErrorParserTester();
aix.parseLine(err_msg);
assertEquals("temp1.c", aix.getFileName());
assertEquals(5, aix.getLineNumber());
- assertEquals("S", aix.getSeverity());
+ assertEquals(IMarkerGenerator.SEVERITY_ERROR_RESOURCE, aix.getSeverity());
assertEquals(" Syntax error: possible missing ')'?",aix.getMessage());
}
public TestSyntaxError( String name)
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestUndeclIdent.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestUndeclIdent.java
index d9ddcb0b67b..2c2dc4468bd 100644
--- a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestUndeclIdent.java
+++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestUndeclIdent.java
@@ -11,10 +11,10 @@
package org.eclipse.cdt.errorparsers.xlc.tests;
-import org.eclipse.cdt.errorparsers.xlc.XlcErrorParser;
-
import junit.framework.TestCase;
+import org.eclipse.cdt.core.IMarkerGenerator;
+
public class TestUndeclIdent extends TestCase {
String err_msg;
/**
@@ -25,11 +25,11 @@ public class TestUndeclIdent extends TestCase {
*/
public void testparseLine()
{
- XlcErrorParser aix = new XlcErrorParser();
+ XlcErrorParserTester aix = new XlcErrorParserTester();
aix.parseLine(err_msg);
assertEquals("temp5.c", aix.getFileName());
assertEquals(5, aix.getLineNumber());
- assertEquals("S", aix.getSeverity());
+ assertEquals(IMarkerGenerator.SEVERITY_ERROR_RESOURCE, aix.getSeverity());
assertEquals(" Undeclared identifier y.",aix.getMessage());
}
public TestUndeclIdent( String name)
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestUnrecoverableError.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestUnrecoverableError.java
new file mode 100644
index 00000000000..5c3e26f0c0b
--- /dev/null
+++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestUnrecoverableError.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.errorparsers.xlc.tests;
+
+import junit.framework.TestCase;
+
+import org.eclipse.cdt.core.IMarkerGenerator;
+
+public class TestUnrecoverableError extends TestCase {
+ String err_msg;
+ /**
+ * This function tests parseLine function of the
+ * XlcErrorParser class. Error message generated by
+ * xlc compiler with unrecoverable severity (U) is given as
+ * input for testing.
+ */
+ public void testparseLine()
+ {
+ XlcErrorParserTester aix = new XlcErrorParserTester();
+ aix.parseLine(err_msg);
+ assertEquals("temp1.c", aix.getFileName());
+ assertEquals(5, aix.getLineNumber());
+ assertEquals(IMarkerGenerator.SEVERITY_ERROR_BUILD, aix.getSeverity());
+ assertEquals(" INTERNAL COMPILER ERROR",aix.getMessage());
+ }
+ public TestUnrecoverableError( String name)
+ {
+ super(name);
+ err_msg = "\"temp1.c\", line 5.1: 1506-001 (U) "
+ + "INTERNAL COMPILER ERROR";
+ }
+}
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestsPlugin.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestsPlugin.java
index f9d6b719eba..bccab9e8970 100644
--- a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestsPlugin.java
+++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestsPlugin.java
@@ -11,10 +11,12 @@
package org.eclipse.cdt.errorparsers.xlc.tests;
-import org.eclipse.ui.plugin.*;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
-import java.util.*;
/**
* The main plugin class to be used in the desktop.
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/XlcErrorParserTester.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/XlcErrorParserTester.java
new file mode 100644
index 00000000000..3cc193b8660
--- /dev/null
+++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/XlcErrorParserTester.java
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Andrew Gvozdev
+ *******************************************************************************/
+
+package org.eclipse.cdt.errorparsers.xlc.tests;
+
+import junit.framework.Assert;
+
+import org.eclipse.cdt.core.ErrorParserManager;
+import org.eclipse.cdt.core.IMarkerGenerator;
+import org.eclipse.cdt.core.ProblemMarkerInfo;
+import org.eclipse.cdt.errorparsers.xlc.XlcErrorParser;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+
+/*
+ * Helper tester class to be able to test XlcErrorParser which extends AbstractErrorParser.
+ */
+
+public class XlcErrorParserTester {
+ static private int counter=0;
+ IProject fTempProject = ResourcesPlugin.getWorkspace().getRoot().getProject("XlcErrorParserTester.temp." + counter++);
+
+ XlcErrorParserTester() {
+ try {
+ fTempProject.create(null);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ Assert.fail("Exception creating temporary project "+fTempProject.getName()+": "+e);
+ }
+ }
+
+ private String fileName;
+ private int lineNumber;
+ private int severity;
+ private String message;
+
+ /*
+ * Dummy class implementing IMarkerGenerator lets get through testing
+ * without NPE.
+ */
+ private class MockMarkerGenerator implements IMarkerGenerator {
+
+ public void addMarker(IResource file, int lineNumber, String errorDesc,
+ int severity, String errorVar) {
+ // dummy
+ }
+
+ public void addMarker(ProblemMarkerInfo problemMarkerInfo) {
+ // dummy
+ }
+
+ }
+
+ /*
+ * Class MockErrorParserManager replaces ErrorParserManager
+ * with the purpose to be able to inquire how the line was parsed.
+ * fileName, lineNumber, message and severity are populated
+ * to be accessed from the test cases.
+ * Relying on internal implementation of ErrorPattern.RecordError()
+ * to provide necessary data via generateExternalMarker() call
+ */
+ private class MockErrorParserManager extends ErrorParserManager {
+
+ private MockErrorParserManager() {
+ super(fTempProject, new MockMarkerGenerator());
+ }
+
+ /*
+ * A stub function just to return non-null IFile.
+ * Necessary to trick ErrorPattern.RecordError() to generate markers.
+ */
+ @Override
+ public IFile findFileName(String fileName) {
+ return fTempProject.getFile(fileName);
+ }
+
+ /**
+ * Called by ErrorPattern.RecordError() for external problem markers
+ */
+ @Override
+ public void generateExternalMarker(IResource file, int lineNumb, String desc, int sev, String varName, IPath externalPath) {
+ if (file!=null) {
+ fileName = file.getName();
+ } else {
+ fileName="";
+ }
+ lineNumber = lineNumb;
+ message = desc;
+ severity = sev;
+ }
+ }
+
+ /**
+ * Main method called by individual error parser tests.
+ * @param line one xlC error message
+ * @return
+ */
+ boolean parseLine(String line) {
+ XlcErrorParser errorParser = new XlcErrorParser();
+
+ MockErrorParserManager epManager = new MockErrorParserManager();
+ return errorParser.processLine(line, epManager);
+ }
+
+ String getFileName() {
+ return fileName;
+ }
+
+ int getLineNumber() {
+ return lineNumber;
+ }
+
+ int getSeverity() {
+ return severity;
+ }
+
+ String getMessage() {
+ return message;
+ }
+}

Back to the top