Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
[FIXED JENKINS-10566] Improved MS Build warning detection.
  • Loading branch information
uhafner committed Aug 22, 2011
1 parent 8262443 commit abbe9d03928612e42f3660bc771ac9c7cd9a202f
@@ -15,7 +15,7 @@ public class MsBuildParser extends RegexpLineParser {
/** Warning type of this parser. */
static final String WARNING_TYPE = "MSBuild";
/** Pattern of MSBuild compiler warnings. */
private static final String MS_BUILD_WARNING_PATTERN = "^(?:.*\\[.*\\])?(?:\\s*\\d+>)?(?:(?:(?:(.*)\\((\\d*).*\\)|.*LINK)\\s*:|(.*):)\\s*([Nn]ote|[Ii]nfo|[Ww]arning|(?:fatal\\s*)?[Ee]rror)\\s*:?\\s*([A-Z0-9]+):\\s*(.*)|(.*)\\s*:.*error\\s*(LNK[0-9]+):\\s*(.*))$";
private static final String MS_BUILD_WARNING_PATTERN = "^(?:.*\\[.*\\])?(?:\\s*\\d+>)?(?:(?:(?:(.*)\\((\\d*).*\\)|.*LINK)\\s*:|(.*):)\\s*([Nn]ote|[Ii]nfo|[Ww]arning|(?:fatal\\s*)?[Ee]rror)\\s*:?\\s*([A-Za-z0-9]+):\\s*(.*)|(.*)\\s*:.*error\\s*(LNK[0-9]+):\\s*(.*))$";

/**
* Creates a new instance of <code>MsBuildParser</code>.
@@ -19,6 +19,24 @@ public class MsBuildParserTest extends ParserTester {
/** Error message. */
private static final String WRONG_NUMBER_OF_WARNINGS_DETECTED = "Wrong number of warnings detected.";

/**
* Parses a file with warnings of the MS Build tools.
*
* @throws IOException
* if the file could not be read
* @see <a href="http://issues.jenkins-ci.org/browse/JENKINS-10566">Issue 10566</a>
*/
@Test
public void issue10566() throws IOException {
Collection<FileAnnotation> warnings = new MsBuildParser().parse(openFile("issue10566.txt"));

assertEquals(WRONG_NUMBER_OF_WARNINGS_DETECTED, 1, warnings.size());
FileAnnotation annotation = warnings.iterator().next();
checkWarning(annotation,
54, "cannot open include file: 'Header.h': No such file or directory",
"..//..//..//xx_Source//file.c", MsBuildParser.WARNING_TYPE, "c1083", Priority.HIGH);
}

/**
* Parses a file with warnings of the MS Build tools.
*
@@ -0,0 +1,2 @@
..\\..\\..\\xx_Source\\file.c(54): fatal error c1083: cannot open include file: 'Header.h': No such file or directory

0 comments on commit abbe9d0

Please sign in to comment.