Skip to content

Instantly share code, notes, and snippets.

@meekrosoft
Created May 5, 2010 07:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meekrosoft/390488 to your computer and use it in GitHub Desktop.
Save meekrosoft/390488 to your computer and use it in GitHub Desktop.
Index: src/test/java/hudson/plugins/warnings/parser/CoolfluxChessccParserTest.java
===================================================================
--- src/test/java/hudson/plugins/warnings/parser/CoolfluxChessccParserTest.java (revision 0)
+++ src/test/java/hudson/plugins/warnings/parser/CoolfluxChessccParserTest.java (revision 0)
@@ -0,0 +1,49 @@
+package hudson.plugins.warnings.parser;
+
+import static junit.framework.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;
+
+/**
+ * Tests the class {@link CoolfluxChessccParserTest}.
+ */
+public class CoolfluxChessccParserTest extends ParserTester {
+ /** Error message. */
+ private static final String WRONG_NUMBER_OF_WARNINGS_DETECTED = "Wrong number of warnings detected.";
+
+ /**
+ * Parses a file with two Intel warnings.
+ *
+ * @throws IOException
+ * if the file could not be read
+ */
+ @Test
+ public void testWarningsParser() throws IOException {
+ Collection<FileAnnotation> warnings = new CoolfluxChessccParser().parse(openFile());
+
+ assertEquals(WRONG_NUMBER_OF_WARNINGS_DETECTED, 2, warnings.size());
+
+ Iterator<FileAnnotation> iterator = warnings.iterator();
+ FileAnnotation annotation = iterator.next();
+ checkWarning(annotation,
+ 150,
+ "function `unsigned configureRealCh(unsigned)' was declared static, but was not defined",
+ "/nfs/autofs/nett/nessie6/dailies/Monday/src/n6/heidrun/dsp/Modules/LocalChAdmin.c",
+ CoolfluxChessccParser.WARNING_TYPE, "Warning", Priority.HIGH);
+
+ }
+
+
+ /** {@inheritDoc} */
+ @Override
+ protected String getWarningsFile() {
+ return "coolfluxchesscc.txt";
+ }
+}
+
Index: src/test/resources/hudson/plugins/warnings/parser/coolfluxchesscc.txt
===================================================================
--- src/test/resources/hudson/plugins/warnings/parser/coolfluxchesscc.txt (revision 0)
+++ src/test/resources/hudson/plugins/warnings/parser/coolfluxchesscc.txt (revision 0)
@@ -0,0 +1,16 @@
+coolflux: n6/heidrun/dsp/Modules/FirOperator_slave.c->n6/heidrun/dsp/Modules/FirOperator_slave.o
+coolflux: n6/heidrun/dsp/Modules/FirOperator_trisor6.c->n6/heidrun/dsp/Modules/FirOperator_trisor6.o
+coolflux: n6/heidrun/dsp/Modules/GenericTuner.c->n6/heidrun/dsp/Modules/GenericTuner.o
+coolflux: n6/heidrun/dsp/Modules/GunOperator.c->n6/heidrun/dsp/Modules/GunOperator.o
+coolflux: n6/heidrun/dsp/Modules/GunOperator_trisor6.c->n6/heidrun/dsp/Modules/GunOperator_trisor6.o
+coolflux: n6/heidrun/dsp/Modules/GunTuner.c->n6/heidrun/dsp/Modules/GunTuner.o
+coolflux: n6/heidrun/dsp/Modules/GunTuner_trisor6.c->n6/heidrun/dsp/Modules/GunTuner_trisor6.o
+coolflux: n6/heidrun/dsp/Modules/LocalChAdmin.c->n6/heidrun/dsp/Modules/LocalChAdmin.o
+coolflux: $MYCC -c /nfs/autofs/nett/nessie6/dailies/Monday/src/n6/heidrun/dsp/Modules/LocalChAdmin.c -o n6/heidrun/dsp/Modules/LocalChAdmin.o -I/nfs/autofs/nett/nessie6/dailies/Monday/coolflux -I/nfs/autofs/nett/nessie6/dailies/Monday/src -I/nett/opt/OmniWorks/client/6.7C1220/linux_2.2_x86 -D__OMNIWORKS_BUILD_NUM=1220 -D__PERL -D__GCC_VER=4 -DOMNIWORKS -DOMNI62 -DOMNI65 -DOMNI66 -DOMNI67 -DUNIX -DX86 -D_X86_ -D_M_IX86 -DLINUX -DGCC -DUSE_PKG -DHAVE_CXX -DHEIDRUN_DSP_MASTER -DHEIDRUN_DSP -DCOOLFLUX_COMPILE_TARGET -DCS_MASTER -DCS_DSN -DDBG_PRINT_IBN -DDSP_ASSERT_ENABLE -DDSP_ASSERT_DEST_IBN -DERRORCODE_DEST_IBN -DDSP_MIB_DEST_IBN -D__NO_DG
+coolflux: Warning in "/nfs/autofs/nett/nessie6/dailies/Monday/src/n6/heidrun/dsp/Modules/LocalChAdmin.c", line 150, column 19: function `unsigned configureRealCh(unsigned)' was declared static, but was not defined
+coolflux: Compilation finished successfully
+coolflux: n6/heidrun/dsp/Modules/LocalChAdmin_slave.c->n6/heidrun/dsp/Modules/LocalChAdmin_slave.o
+coolflux: $MYCC -c /nfs/autofs/nett/nessie6/dailies/Monday/src/n6/heidrun/dsp/Modules/LocalChAdmin_slave.c -o n6/heidrun/dsp/Modules/LocalChAdmin_slave.o -I/nfs/autofs/nett/nessie6/dailies/Monday/coolflux -I/nfs/autofs/nett/nessie6/dailies/Monday/src -I/nett/opt/OmniWorks/client/6.7C1220/linux_2.2_x86 -D__OMNIWORKS_BUILD_NUM=1220 -D__PERL -D__GCC_VER=4 -DOMNIWORKS -DOMNI62 -DOMNI65 -DOMNI66 -DOMNI67 -DUNIX -DX86 -D_X86_ -D_M_IX86 -DLINUX -DGCC -DUSE_PKG -DHAVE_CXX -DHEIDRUN_DSP_MASTER -DHEIDRUN_DSP -DCOOLFLUX_COMPILE_TARGET -DCS_MASTER -DCS_DSN -DDBG_PRINT_IBN -DDSP_ASSERT_ENABLE -DDSP_ASSERT_DEST_IBN -DERRORCODE_DEST_IBN -DDSP_MIB_DEST_IBN -D__NO_DG
+coolflux: Warning in "/nfs/autofs/nett/nessie6/dailies/Monday/src/n6/heidrun/dsp/Modules/LocalChAdmin.c", line 150, column 19: function `unsigned configureRealCh(unsigned)' was declared static, but was not defined
+coolflux: Compilation finished successfully
+
Index: src/main/java/hudson/plugins/warnings/parser/CoolfluxChessccParser.java
===================================================================
--- src/main/java/hudson/plugins/warnings/parser/CoolfluxChessccParser.java (revision 0)
+++ src/main/java/hudson/plugins/warnings/parser/CoolfluxChessccParser.java (revision 0)
@@ -0,0 +1,33 @@
+package hudson.plugins.warnings.parser;
+
+import hudson.plugins.analysis.util.model.Priority;
+
+import java.util.regex.Matcher;
+
+/**
+ * A parser for the Inter C compiler warnings.
+ *
+ * @author Vangelis Livadiotis
+ */
+public class CoolfluxChessccParser extends RegexpLineParser {
+ /** Warning type of this parser. */
+ static final String WARNING_TYPE = "Coolflux DSP Compiler (chesscc)";
+ /** Pattern of Intel compiler warnings. */
+ private static final String CHESSCC_PATTERN = ".*?Warning in \"([^\"]+)\", line (\\d+),.*?:\\s*(.*)";
+
+ /**
+ * Creates a new instance of <code>InterCParser</code>.
+ */
+ public CoolfluxChessccParser() {
+ super(CHESSCC_PATTERN, "Coolflux DSP Compiler");
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected Warning createWarning(final Matcher matcher) {
+ return new Warning(matcher.group(1), getLineNumber(matcher.group(2)), WARNING_TYPE,
+ "Warning", matcher.group(3), Priority.HIGH);
+ }
+}
+
+
Index: src/main/java/hudson/plugins/warnings/parser/ParserRegistry.java
===================================================================
--- src/main/java/hudson/plugins/warnings/parser/ParserRegistry.java (revision 30641)
+++ src/main/java/hudson/plugins/warnings/parser/ParserRegistry.java (working copy)
@@ -75,6 +75,7 @@
parsers.add(new AcuCobolParser());
parsers.add(new FlexSDKParser());
parsers.add(new PhpParser());
+ parsers.add(new CoolfluxChessccParser());
return ImmutableList.copyOf(parsers);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment