1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

bug 380956: The CDT GCC Build Output Parser should not require 'make's recursion depth indicators

This commit is contained in:
Andrew Gvozdev 2012-05-29 17:36:32 -04:00
parent fe5f6d43f2
commit 1bcae4bb9b
2 changed files with 45 additions and 4 deletions

View file

@ -1205,6 +1205,36 @@ public class ErrorParserFileMatchingTest extends TestCase {
assertEquals("error",problemMarkerInfo.description); assertEquals("error",problemMarkerInfo.description);
} }
/**
* Checks if output of '-n'/'--just-print' or '-w'/'--print-directory' options of make can be recognized.
*
* @throws Exception...
*/
public void testPushPop_WithNoLevel() throws Exception {
String fileName = getName() + ".c";
ResourceHelper.createFolder(fProject, "Folder");
ResourceHelper.createFolder(fProject, "Folder/SubFolder");
ResourceHelper.createFile(fProject, fileName);
ResourceHelper.createFile(fProject, "Folder/"+fileName);
ResourceHelper.createFile(fProject, "Folder/SubFolder/"+fileName);
String lines = "make: Entering directory `Folder'\n"
+ "make: Entering directory `SubFolder'\n"
+ "make: Leaving directory `SubFolder'\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. * Checks if a file from error output can be found.
* *

View file

@ -53,7 +53,8 @@ public class CWDLocator extends AbstractErrorParser {
} }
return false; return false;
} }
}, new ErrorPattern("make\\[(.*)\\]: Entering directory `(.*)'", 0, 0) { //$NON-NLS-1$ },
new ErrorPattern("make\\[(.*)\\]: Entering directory `(.*)'", 0, 0) { //$NON-NLS-1$
@Override @Override
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) { protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
int level; int level;
@ -74,7 +75,17 @@ public class CWDLocator extends AbstractErrorParser {
eoParser.pushDirectory(new Path(dir)); eoParser.pushDirectory(new Path(dir));
return true; return true;
} }
}, new ErrorPattern("make\\[.*\\]: Leaving directory", 0, 0) { //$NON-NLS-1$ },
// This is emitted by GNU make using options -n, --just-print or -w, --print-directory.
new ErrorPattern("make: Entering directory `(.*)'", 0, 0) { //$NON-NLS-1$
@Override
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
String dir = matcher.group(1);
eoParser.pushDirectory(new Path(dir));
return true;
}
},
new ErrorPattern("make(\\[.*\\])?: Leaving directory", 0, 0) { //$NON-NLS-1$
@Override @Override
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) { protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
eoParser.popDirectoryURI(); eoParser.popDirectoryURI();