Skip to content

Commit

Permalink
Merge pull request #102 from DaMutz/iar_arm
Browse files Browse the repository at this point in the history
[JENKINS-55750] Added test cases and fix warnings which could not been find
  • Loading branch information
uhafner authored Feb 28, 2019
2 parents 7710b78 + 0167c67 commit 5f8b680
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main/java/edu/hm/hafner/analysis/parser/IarParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
public class IarParser extends RegexpLineParser {
private static final long serialVersionUID = 7695540852439013425L;

private static final String IAR_WARNING_PATTERN = ANT_TASK
+ "(?:\"?(.*?)\"?[\\(,](\\d+)\\)?\\s+:?\\s+)?(Error|Remark|Warning|Fatal [Ee]rror)\\[(\\w+)\\]: (.*)$";
private static final String IAR_WARNING_PATTERN = ANT_TASK
+ "(?:\"?(.*?)\"?[\\(,](\\d+)\\)?\\s+(?::\\s)?)?(Error|Remark|Warning|Fatal [Ee]rror)\\[(\\w+)\\]: (.*)$";

/**
* Creates a new instance of {@link IarParser}.
Expand Down
50 changes: 48 additions & 2 deletions src/test/java/edu/hm/hafner/analysis/parser/IarParserTest.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package edu.hm.hafner.analysis.parser;

import org.junit.jupiter.api.Test;

import edu.hm.hafner.analysis.AbstractParserTest;
import edu.hm.hafner.analysis.Report;
import edu.hm.hafner.analysis.Severity;
import static edu.hm.hafner.analysis.assertj.IssuesAssert.*;
import edu.hm.hafner.analysis.assertj.SoftAssertions;

import static edu.hm.hafner.analysis.assertj.Assertions.*;
import static edu.hm.hafner.analysis.assertj.SoftAssertions.*;

/**
* Tests the class {@link IarParser}.
*
Expand Down Expand Up @@ -69,4 +73,46 @@ protected void assertThatIssuesArePresent(final Report report, final SoftAsserti
.hasMessage("function \"FlashErase\" was declared but never referenced")
.hasFileName("d:/jenkins/workspace/Nightly/src/flash/flashdrv.c");
}
}

/**
* Parses a warning log with IAR ARM warnings.
*
* @see <a href="http://issues.jenkins-ci.org/browse/JENKINS-55750">Issue 55750</a>
*/
@Test
void issue55750() {
Report warnings = parse("issue55750.txt");
assertThat(warnings).hasSize(4);

assertSoftly(softly -> {
softly.assertThat(warnings.get(0))
.hasSeverity(Severity.WARNING_NORMAL)
.hasCategory("Pe852")
.hasLineStart(432)
.hasLineEnd(432)
.hasMessage("expression must be a pointer to a complete object type")
.hasFileName("c:/external/specific/cpp/iar_cxxabi.cpp");
softly.assertThat(warnings.get(1))
.hasSeverity(Severity.WARNING_NORMAL)
.hasCategory("Pe549")
.hasLineStart(81)
.hasLineEnd(81)
.hasMessage("variable \"result\" is used before its value is set")
.hasFileName("external/specific/wiced/WICED/security/BESL/host/WICED/wiced_p2p.c");
softly.assertThat(warnings.get(2))
.hasSeverity(Severity.WARNING_NORMAL)
.hasCategory("Pe223")
.hasLineStart(412)
.hasLineEnd(412)
.hasMessage("function \"memcpy\" declared implicitly")
.hasFileName("external/specific/wiced/WICED/platform/MCU/RTOS_STM32F4xx/platform_dct_external.c");
softly.assertThat(warnings.get(3))
.hasSeverity(Severity.WARNING_HIGH)
.hasCategory("Pe018")
.hasLineStart(633)
.hasLineEnd(633)
.hasMessage("expected a \")\"")
.hasFileName("source/dal/InterMcu/InterMcuTransport.cpp");
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"c:\external\specific\cpp\iar_cxxabi.cpp",432 Warning[Pe852]: expression must be a pointer to a complete object type
"external/specific/wiced/WICED/security/BESL/host/WICED/wiced_p2p.c",81 Warning[Pe549]: variable "result" is used before its value is set
"external/specific/wiced/WICED/platform/MCU/RTOS_STM32F4xx/platform_dct_external.c",412 Warning[Pe223]: function "memcpy" declared implicitly
"source/dal/InterMcu/InterMcuTransport.cpp",633 Error[Pe018]: expected a ")"

0 comments on commit 5f8b680

Please sign in to comment.