# HG changeset patch # User Ed Swartz # Date 1259958775 21600 # Node ID e120fb809ed2ea72e250a1beac7fa6150c25298a # Parent 71e3840b8ecaded9132c855244e036ad751116de# Parent d94b9ba55bedc099e07649fb1db8182aa782b3dc Merge commit diff -r d94b9ba55bed -r e120fb809ed2 cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/ErrorParserTests.java --- a/cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/ErrorParserTests.java Wed Dec 02 18:27:49 2009 -0600 +++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/ErrorParserTests.java Fri Dec 04 14:32:55 2009 -0600 @@ -22,6 +22,7 @@ // Just add more test cases here as you create them for // each class being tested suite.addTest(GCCErrorParserTests.suite()); + suite.addTest(GLDErrorParserTests.suite()); suite.addTest(FileBasedErrorParserTests.suite()); suite.addTest(ErrorParserManagerTest.suite()); suite.addTest(ErrorParserFileMatchingTest.suite()); diff -r d94b9ba55bed -r e120fb809ed2 cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/GLDErrorParserTests.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/GLDErrorParserTests.java Fri Dec 04 14:32:55 2009 -0600 @@ -0,0 +1,79 @@ +/******************************************************************************* + * Copyright (c) 2009 Nokia 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: + * Nokia - initial API and implementation, based on GCCErrorParserTests + *******************************************************************************/ +package org.eclipse.cdt.core.internal.errorparsers.tests; + + +import java.io.IOException; + +import junit.framework.Test; +import junit.framework.TestSuite; + + +/** + * This test is designed to exercise the error parser capabilities for GNU ld. + */ +public class GLDErrorParserTests extends GenericErrorParserTests { + + // old style: no colons before sections + public static final String[] GLD_ERROR_STREAM0 = { + "make -k all", + "gcc -o hallo.o main.c libfoo.a", + "main.c(.text+0x14): undefined reference to `foo()'", + "main.o(.rodata+0x14): undefined reference to `something'", + "make: Target `all' not remade because of errors." }; + public static final int GLD_ERROR_STREAM0_WARNINGS = 0; + public static final int GLD_ERROR_STREAM0_ERRORS = 2; + public static final String[] GLD_ERROR_STREAM0_FILENAMES = {"main.c","main.o"}; + + // new style: colons before sections + public static final String[] GLD_ERROR_STREAM1 = { + "make -k all", + "gcc -o hallo.o main.c libfoo.a", + "main.c:(.text+0x14): undefined reference to `foo()'", + "main.o:(.rodata+0x14): undefined reference to `something'", + "make: Target `all' not remade because of errors." }; + public static final int GLD_ERROR_STREAM1_WARNINGS = 0; + public static final int GLD_ERROR_STREAM1_ERRORS = 2; + public static final String[] GLD_ERROR_STREAM1_FILENAMES = {"main.c","main.o"}; + + public static final String[] GLD_ERROR_STREAM2 = { + "make -k all", + "gcc -o hallo.o main.c libfoo.a", + "libfoo.a(foo.o): In function `foo':", + "foo.c:(.text+0x7): undefined reference to `bar'", + "make: Target `all' not remade because of errors." }; + public static final int GLD_ERROR_STREAM2_WARNINGS = 0; + public static final int GLD_ERROR_STREAM2_ERRORS = 1; + public static final String[] GLD_ERROR_STREAM2_FILENAMES = {"foo.c"}; + + + public GLDErrorParserTests() { + super(); + } + + public static Test suite() { + TestSuite suite = new TestSuite(GLDErrorParserTests.class); + return suite; + } + + public void testLinkerMessages0() throws IOException { + runParserTest(GLD_ERROR_STREAM0, GLD_ERROR_STREAM0_ERRORS, GLD_ERROR_STREAM0_WARNINGS, GLD_ERROR_STREAM0_FILENAMES, + null, new String[]{GLD_ERROR_PARSER_ID}); + } + public void testLinkerMessages1() throws IOException { + runParserTest(GLD_ERROR_STREAM1, GLD_ERROR_STREAM1_ERRORS, GLD_ERROR_STREAM1_WARNINGS, GLD_ERROR_STREAM1_FILENAMES, + null, new String[]{GLD_ERROR_PARSER_ID}); + } + public void testLinkerMessages2() throws IOException { + runParserTest(GLD_ERROR_STREAM2, GLD_ERROR_STREAM2_ERRORS, GLD_ERROR_STREAM2_WARNINGS, GLD_ERROR_STREAM2_FILENAMES, + null, new String[]{GLD_ERROR_PARSER_ID}); + } +} diff -r d94b9ba55bed -r e120fb809ed2 cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/GenericErrorParserTests.java --- a/cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/GenericErrorParserTests.java Wed Dec 02 18:27:49 2009 -0600 +++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/GenericErrorParserTests.java Fri Dec 04 14:32:55 2009 -0600 @@ -35,6 +35,7 @@ */ public class GenericErrorParserTests extends TestCase { public static final String GCC_ERROR_PARSER_ID = "org.eclipse.cdt.core.GCCErrorParser"; + public static final String GLD_ERROR_PARSER_ID = "org.eclipse.cdt.core.GLDErrorParser"; protected IProject fTempProject; diff -r d94b9ba55bed -r e120fb809ed2 cdt/cdt_6_0_x/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/messages.properties --- a/cdt/cdt_6_0_x/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/messages.properties Wed Dec 02 18:27:49 2009 -0600 +++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/messages.properties Fri Dec 04 14:32:55 2009 -0600 @@ -18,6 +18,6 @@ GCCErrorParser_sikp_instantiatedFromHere=instantiated from #GCCErrorParser_Warnings=(.*?):([0-9]+):([0-9]+:)?( (.*[Ww]arning:|WARNING:|[Ee]rror:))? (.*) GCCErrorParser_Warnings=(.*?):([0-9]+):([0-9]+:)?(.*?[([Ww]arning)(WARNING)([Ee]rror)]:)? (.*) -GLDErrorParser_error_text=(.*)\\(\\.text\\+.*\\): (.*) +GLDErrorParser_error_text=(.*?):?\\(\\.\\w+\\+.*\\): (.*) GLDErrorParser_warning_general=ld(\\.exe)?: [Ww]arning:? (.*) GLDErrorParser_error_general=ld(\\.exe)?: (.*)