Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
[Fixed JENKINS-9926]: Ignore ant task prefix when parsing warnings.
  • Loading branch information
uhafner committed Jul 27, 2011
1 parent 2047696 commit 8118ca3c3cafd4e6f30ad2260efd9dd6460fa8ad
@@ -1,5 +1,6 @@
#Wed Jun 22 15:16:44 CEST 2011
#Thu Jul 14 15:03:39 CEST 2011
eclipse.preferences.version=1
encoding//src/main/java=ISO-8859-1
encoding//src/main/resources=ISO-8859-1
encoding//src/test/java=ISO-8859-1
encoding//src/test/resources=ISO-8859-1
@@ -4,7 +4,7 @@
<parent>
<groupId>org.jvnet.hudson.plugins</groupId>
<artifactId>analysis-pom</artifactId>
<version>1.24</version>
<version>1.25-SNAPSHOT</version>
<relativePath>../analysis-pom/pom.xml</relativePath>
</parent>

@@ -15,7 +15,7 @@ public class Gcc4CompilerParser extends RegexpLineParser {
/** Warning type of this parser. */
static final String WARNING_TYPE = "gcc4";
/** Pattern of gcc 4 compiler warnings. */
private static final String GCC_WARNING_PATTERN = "^(.+?):(\\d+):(?:\\d+:)? (warning|error): (.*)$";
private static final String GCC_WARNING_PATTERN = "^(?:\\s*\\[.*\\]\\s*)?(.+?):(\\d+):(?:\\d+:)? (warning|error): (.*)$";

/**
* Creates a new instance of <code>Gcc4CompilerParser</code>.
@@ -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-Z0-9]+):\\s*(.*)|(.*)\\s*:.*error\\s*(LNK[0-9]+):\\s*(.*))$";

/**
* Creates a new instance of <code>MsBuildParser</code>.
@@ -23,6 +23,24 @@ public class Gcc4CompilerParserTest extends ParserTester {
/** The type. **/
private static final String WARNING_TYPE = Gcc4CompilerParser.WARNING_TYPE;

/**
* Parses a file with one warning that are started by ant.
*
* @throws IOException
* if the file could not be read
* @see <a href="http://issues.jenkins-ci.org/browse/JENKINS-9926">Issue 9926</a>
*/
@Test
public void issue9926() throws IOException {
Collection<FileAnnotation> warnings = new Gcc4CompilerParser().parse(openFile("issue9926.txt"));

assertEquals(WRONG_NUMBER_OF_WARNINGS_DETECTED, 1, warnings.size());
FileAnnotation annotation = warnings.iterator().next();
checkWarning(annotation, 52, "large integer implicitly truncated to unsigned type",
"src/test_simple_sgs_message.cxx",
WARNING_TYPE, WARNING_CATEGORY, Priority.NORMAL);
}

/**
* Parses a warning log with 1 warning.
*
@@ -21,6 +21,24 @@ public class GccParserTest extends ParserTester {
/** A warning. */
private static final String GCC_WARNING = "GCC warning";

/**
* Parses a file with one warning that are started by ant.
*
* @throws IOException
* if the file could not be read
* @see <a href="http://issues.jenkins-ci.org/browse/JENKINS-9926">Issue 9926</a>
*/
@Test
public void issue9926() throws IOException {
Collection<FileAnnotation> warnings = new GccParser().parse(openFile("issue9926.txt"));

assertEquals(WRONG_NUMBER_OF_WARNINGS_DETECTED, 1, warnings.size());
FileAnnotation annotation = warnings.iterator().next();
checkWarning(annotation, 52, "large integer implicitly truncated to unsigned type",
"src/test_simple_sgs_message.cxx",
GccParser.WARNING_TYPE, GCC_WARNING, Priority.NORMAL);
}

/**
* Parses a file with two GCC warnings.
*
@@ -69,6 +69,24 @@ public void issue6709() throws IOException {
MsBuildParser.WARNING_TYPE, "CS0168", Priority.NORMAL);
}

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

assertEquals(WRONG_NUMBER_OF_WARNINGS_DETECTED, 1, warnings.size());
FileAnnotation annotation = warnings.iterator().next();
checkWarning(annotation, 125, "assignment within conditional expression",
"c:/jci/jobs/external_nvtristrip/workspace/compiler/cl/config/debug/platform/win32/tfields/live/external/nvtristrip/nvtristrip.cpp",
MsBuildParser.WARNING_TYPE, "C4706", Priority.NORMAL);
}

/**
* Parses a file with warnings of the MS Build linker.
*
@@ -154,7 +154,7 @@ public void issue3866() throws IOException {
ParserRegistry parserRegistry = createRegistryUnderTest(FILE_NAME, "/tmp/clover*/**", StringUtils.EMPTY, new ArrayList<WarningsParser>());

Collection<FileAnnotation> annotations = parserRegistry.parse(DUMMY_FILE);
Assert.assertEquals(WRONG_NUMBER_OF_ANNOTATIONS_PARSED, 8, annotations.size());
Assert.assertEquals(WRONG_NUMBER_OF_ANNOTATIONS_PARSED, 16, annotations.size());
}

/**
@@ -0,0 +1,16 @@
14:57:50 [exec] Microsoft (R) Visual Studio Version 9.0.30729.1.
14:57:50 [exec] Copyright (C) Microsoft Corp. All rights reserved.
14:57:50 [exec] 1>------ Build started: Project: NvTriStrip, Configuration: Win32Debug Win32 ------
14:57:50 [exec] 1>Compiling...
14:57:50 [exec] 1>NvTriStripObjects.cpp
14:57:51 [exec] 1>NvTriStrip.cpp
14:57:52 [exec] 1>Generating Code...
14:57:52 [exec] 1>c:\jci\jobs\external_nvtristrip\workspace\compiler\cl\config\debug\platform\win32\tfields\live\external\nvtristrip\nvtristrip.cpp(125) : warning C4706: assignment within conditional expression
14:57:53 [exec] 1>Creating library...
14:57:53 [exec] 1>Build Time 0:02
14:57:53 [exec] 1>Build log was saved at "file://C:\JCI\jobs\External_NvTriStrip\workspace\COMPILER\CL\CONFIG\Debug\PLATFORM\Win32\tfields\Live\Lib\Intermediate\External\NvTriStrip\Win32Debug\BuildLog.htm"
14:57:53 [exec] 1>NvTriStrip - 0 error(s), 1 warning(s)


[exec] src/test_simple_sgs_message.cxx:52: warning: large integer implicitly truncated to unsigned type

0 comments on commit 8118ca3

Please sign in to comment.