From 2e988477718a8e97a648732da3d6f08e06915e59 Mon Sep 17 00:00:00 2001 From: Marc-Andre Laperle Date: Thu, 12 Mar 2015 15:06:34 -0700 Subject: [PATCH] Bug 462036 - Make error parsers do not handle 'entering directory' correctly in make 4.0 Change-Id: Ifdd5794c7d692dc275a9b6010ee84441f817313b Signed-off-by: Marc-Andre Laperle --- .../tests/ErrorParserFileMatchingTest.java | 28 ++++++++++++++++++- .../cdt/internal/errorparsers/CWDLocator.java | 7 +++-- .../errorparsers/MakeErrorParser.java | 5 ++-- 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/ErrorParserFileMatchingTest.java b/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/ErrorParserFileMatchingTest.java index 75c7b5f5995..a7a148e4b11 100644 --- a/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/ErrorParserFileMatchingTest.java +++ b/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/ErrorParserFileMatchingTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 Andrew Gvozdev and others. + * Copyright (c) 2009, 2015 Andrew Gvozdev 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 @@ -7,6 +7,7 @@ * * Contributors: * Andrew Gvozdev - Initial API and implementation + * Marc-Andre Laperle (Ericsson) - Bug 462036 *******************************************************************************/ package org.eclipse.cdt.core.internal.errorparsers.tests; @@ -1152,6 +1153,31 @@ public class ErrorParserFileMatchingTest extends TestCase { assertEquals("error",problemMarkerInfo.description); } + /** + * Checks if a file from error output can be found. Using new single quote + * in Gnu Make 4.0. + * + * @throws Exception... + */ + public void testPushDirectorySingleQuote() throws Exception { + String fileName = "testPushDirectory.c"; + ResourceHelper.createFolder(fProject, "Folder"); + ResourceHelper.createFile(fProject, fileName); + ResourceHelper.createFile(fProject, "Folder/"+fileName); + + String lines = "make[0]: Entering directory 'Folder'\n" + + fileName+":1:error\n"; + + String[] errorParsers = {CWD_LOCATOR_ID, mockErrorParserId }; + parseOutput(fProject, fProject.getLocation(), errorParsers, lines); + assertEquals(1, errorList.size()); + + ProblemMarkerInfo problemMarkerInfo = errorList.get(0); + assertEquals("L/FindMatchingFilesTest/Folder/"+fileName,problemMarkerInfo.file.toString()); + assertEquals(1,problemMarkerInfo.lineNumber); + assertEquals("error",problemMarkerInfo.description); + } + /** * Checks if a file from error output can be found. * diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/CWDLocator.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/CWDLocator.java index 62d0618a71b..b244d075d06 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/CWDLocator.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/CWDLocator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 2015 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 @@ -7,6 +7,7 @@ * * Contributors: * Andrew Gvozdev (Quoin Inc.) - initial API and implementation adapted from MakeErrorParser + * Marc-Andre Laperle (Ericsson) - Bug 462036 *******************************************************************************/ package org.eclipse.cdt.internal.errorparsers; @@ -54,7 +55,7 @@ public class CWDLocator extends AbstractErrorParser { return false; } }, - new ErrorPattern("make\\[(.*)\\]: Entering directory `(.*)'", 0, 0) { //$NON-NLS-1$ + new ErrorPattern("make\\[(.*)\\]: Entering directory [`'](.*)'", 0, 0) { //$NON-NLS-1$ @Override protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) { int level; @@ -77,7 +78,7 @@ public class CWDLocator extends AbstractErrorParser { } }, // This is emitted by GNU make using options -w or --print-directory. - new ErrorPattern("make: Entering directory `(.*)'", 0, 0) { //$NON-NLS-1$ + new ErrorPattern("make: Entering directory [`'](.*)'", 0, 0) { //$NON-NLS-1$ @Override protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) { String dir = matcher.group(1); diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/MakeErrorParser.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/MakeErrorParser.java index 1abbf20c5d8..4c860bfed16 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/MakeErrorParser.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/MakeErrorParser.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 2015 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 @@ -8,6 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation * Norbert Ploett (Siemens AG) - externalized strings + * Marc-Andre Laperle (Ericsson) - Bug 462036 *******************************************************************************/ package org.eclipse.cdt.internal.errorparsers; @@ -27,7 +28,7 @@ import org.eclipse.core.runtime.Path; @Deprecated public class MakeErrorParser extends AbstractErrorParser { private static final ErrorPattern[] patterns = { - new ErrorPattern("make\\[(.*)\\]: Entering directory `(.*)'", 0, 0) { //$NON-NLS-1$ + new ErrorPattern("make\\[(.*)\\]: Entering directory [`'](.*)'", 0, 0) { //$NON-NLS-1$ @Override protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) { int level;