Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Fixed Issue JENKINS-17075:
DiabCParser recognizes now a "fatal error".
  • Loading branch information
schlangguru committed May 14, 2013
1 parent 475666b commit 411af186120b2e4d5b04167121518e4c68ae5739
@@ -16,7 +16,6 @@
<classpathentry including="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="src" output="target/classes" path="target/generated-sources/localizer">
<attributes>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
@@ -1,9 +1,10 @@
package hudson.plugins.warnings.parser;

import java.util.regex.Matcher;

import hudson.Extension;
import hudson.plugins.analysis.util.model.Priority;

import java.util.regex.Matcher;
import hudson.plugins.analysis.util.model.Priority;

/**
* A parser for the Diab C++ compiler warnings.
@@ -14,7 +15,7 @@
public class DiabCParser extends RegexpLineParser {
private static final long serialVersionUID = -1251248150596418456L;

private static final String DIAB_CPP_WARNING_PATTERN = "^\\s*\"(.*)\"\\s*,\\s*line\\s*(\\d+)\\s*:\\s*(warning|error)\\s*\\(dcc:(\\d+)\\)\\s*:\\s*(.*)$";
private static final String DIAB_CPP_WARNING_PATTERN = "^\\s*\"(.*)\"\\s*,\\s*line\\s*(\\d+)\\s*:\\s*(warning|error|fatal\\s{1}error)\\s*\\(dcc:(\\d+)\\)\\s*:\\s*(.*)$";

/**
* Creates a new instance of <code>HpiCompileParser</code>.
@@ -1,15 +1,16 @@
package hudson.plugins.warnings.parser;

import static org.junit.Assert.*;
import hudson.plugins.analysis.util.model.FileAnnotation;
import hudson.plugins.analysis.util.model.Priority;

import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;

import org.junit.Test;

import hudson.plugins.analysis.util.model.FileAnnotation;
import hudson.plugins.analysis.util.model.Priority;

/**
* Tests the class {@link DiabCParser}.
*/
@@ -25,7 +26,7 @@ public class DiabCParserTest extends ParserTester {
public void parseDiabCpp() throws IOException {
Collection<FileAnnotation> warnings = new DiabCParser().parse(openFile());

assertEquals("Wrong number of warnings detected.", 5, warnings.size());
assertEquals("Wrong number of warnings detected.", 8, warnings.size());

Iterator<FileAnnotation> iterator = warnings.iterator();
FileAnnotation annotation = iterator.next();
@@ -58,6 +59,24 @@ public void parseDiabCpp() throws IOException {
"function f5 is not found",
"lint.c",
TYPE, "1378", Priority.HIGH);
annotation = iterator.next();
checkWarning(annotation,
5,
"division by zero",
"main.c",
TYPE, "1025", Priority.NORMAL);
annotation = iterator.next();
checkWarning(annotation,
5,
"division by zero",
"main.c",
TYPE, "1025", Priority.HIGH);
annotation = iterator.next();
checkWarning(annotation,
5,
"division by zero",
"main.c",
TYPE, "1025", Priority.HIGH);
}

@Override
@@ -3,4 +3,6 @@
"lint.c", line 28: warning (dcc:1243): constant out of range
"lint.c", line 4: warning (dcc:1517): function f4 is never used
"lint.c", line 11: error (dcc:1378): function f5 is not found

"main.c", line 5: warning (dcc:1025): division by zero
"main.c", line 5: error (dcc:1025): division by zero
"main.c", line 5: fatal error (dcc:1025): division by zero

0 comments on commit 411af18

Please sign in to comment.