Skip to content

Commit 3cd1ec6

Browse files
authored
Merge pull request #198 from jenkinsci/59118-GHS-Multi
[JENKINS-59118] Add a test that shows that files are correctly parsed
2 parents 93f68fe + 086c764 commit 3cd1ec6

3 files changed

Lines changed: 54 additions & 2 deletions

File tree

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
<jenkins-test-harness.version>2.49</jenkins-test-harness.version>
2929

3030
<!-- Project Dependencies Configuration -->
31-
<analysis-model-api.version>6.0.1</analysis-model-api.version>
32-
<analysis-model.version>6.0.1</analysis-model.version>
31+
<analysis-model-api.version>6.0.2</analysis-model-api.version>
32+
<analysis-model.version>6.0.2</analysis-model.version>
3333
<forensics-api-plugin.version>0.4.1</forensics-api-plugin.version>
3434
<git-forensics-plugin.version>0.3.1</git-forensics-plugin.version>
3535

src/test/java/io/jenkins/plugins/analysis/warnings/StepsITest.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,37 @@ public void shouldFindAllClangIssuesIfConsoleIsAnnotatedWithTimeStamps() {
159159
.hasSeverity(Severity.WARNING_HIGH);
160160
}
161161

162+
/** Runs the Clang parser on an output file that contains 1 issue. */
163+
@Test
164+
public void shouldFindAllGhsIssuesIfConsoleIsAnnotatedWithTimeStamps() {
165+
WorkflowJob job = createPipelineWithWorkspaceFiles("issue59118.txt");
166+
job.setDefinition(asStage(
167+
createCatStep("*.txt"),
168+
"def issues = scanForIssues tool: ghsMulti()",
169+
PUBLISH_ISSUES_STEP));
170+
171+
AnalysisResult result = scheduleSuccessfulBuild(job);
172+
173+
assertThat(result).hasTotalSize(2);
174+
Report issues = result.getIssues();
175+
assertThat(issues.get(0))
176+
.hasLineStart(19)
177+
.hasMessage("operands of logical && or || must be primary expressions\n"
178+
+ "\n"
179+
+ " #if !defined(_STDARG_H) && !defined(_STDIO_H) && !defined(_GHS_WCHAR_H)")
180+
.hasFileName("C:/Path/To/bar.h")
181+
.hasCategory("#1729-D")
182+
.hasSeverity(Severity.WARNING_NORMAL);
183+
assertThat(issues.get(1))
184+
.hasLineStart(491)
185+
.hasMessage("operands of logical && or || must be primary expressions\n"
186+
+ "\n"
187+
+ " if(t_deltaInterval != t_u4Interval && t_deltaInterval != 0)")
188+
.hasFileName("../../../../Sources/Foo/Bar/Test.c")
189+
.hasCategory("#1729-D")
190+
.hasSeverity(Severity.WARNING_NORMAL);
191+
}
192+
162193
/**
163194
* Parses a colored console log that also contains console notes. Verifies that the console notes will be removed
164195
* before the color codes. Output is from ATH test case
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[2019-08-28T08:44:26.749Z] Output from Compiling Foo.c:
2+
[2019-08-28T08:44:26.749Z] "C:\Path\To\bar.h", line 19: warning #1729-D:
3+
4+
[2019-08-28T08:44:26.749Z] operands of logical && or || must be primary expressions
5+
6+
[2019-08-28T08:44:26.749Z] #if !defined(_STDARG_H) && !defined(_STDIO_H) && !defined(_GHS_WCHAR_H)
7+
8+
[2019-08-28T08:44:26.749Z] ^
9+
10+
[2019-08-28T08:44:26.749Z]
11+
12+
[2019-08-28T08:44:28.122Z] "..\..\..\..\Sources\Foo\Bar\Test.c", line 491: warning #1729-D:
13+
14+
[2019-08-28T08:44:28.122Z] operands of logical && or || must be primary expressions
15+
16+
[2019-08-28T08:44:28.122Z] if(t_deltaInterval != t_u4Interval && t_deltaInterval != 0)
17+
18+
[2019-08-28T08:44:28.122Z] ^
19+
20+
21+

0 commit comments

Comments
 (0)