Debian Codegraph @

gcc/testsuite/c-c++-common/diagnostic-format-sarif-file-no-results.c

raw
1 /* Verify behavior of SARIF output for the "no diagnostics" case. */
2
3 /* { dg-do compile } */
4 /* { dg-options "-fdiagnostics-format=sarif-file" } */
5
6 int non_empty;
7
8 /* Verify that some JSON was written to a file with the expected name. */
9 /* { dg-final { verify-sarif-file } } */
10
11 /* We expect various properties.
12 The indentation here reflects the expected hierarchy, though these tests
13 don't check for that, merely the string fragments we expect.
14 { dg-final { scan-sarif-file "\"version\": \"2.1.0\"" } }
15 { dg-final { scan-sarif-file "\"runs\": \\\[" } }
16 { dg-final { scan-sarif-file "\"artifacts\": \\\[" } }
17 { dg-final { scan-sarif-file "\"location\": " } }
18 { dg-final { scan-sarif-file "\"uri\": " } }
19
20 { dg-final { scan-sarif-file "\"sourceLanguage\": \"c\"" { target c } } }
21 { dg-final { scan-sarif-file "\"sourceLanguage\": \"cplusplus\"" { target c++ } } }
22
23 We expect the contents of the file to *not* be quoted if
24 there are no results.
25 { dg-final { scan-sarif-file-not "\"contents\": " } }
26 { dg-final { scan-sarif-file-not "\"text\": " } }
27
28 Verify that this file's "role" is "analysisTarget", as per
29 "NOTE 3" in SARIF v2.1.0 section 3.24.6.
30 { dg-final { scan-sarif-file "\"roles\": \\\[\"analysisTarget\"\\\]" } }
31
32 { dg-final { scan-sarif-file "\"tool\": " } }
33 { dg-final { scan-sarif-file "\"driver\": " } }
34 { dg-final { scan-sarif-file "\"name\": \"GNU C" } }
35 { dg-final { scan-sarif-file "\"fullName\": \"GNU C" } }
36 { dg-final { scan-sarif-file "\"informationUri\": \"" } }
37
38 { dg-final { scan-sarif-file "\"invocations\": \\\[" } }
39 { dg-final { scan-sarif-file "\"toolExecutionNotifications\": \\\[\\\]" } }
40 { dg-final { scan-sarif-file "\"executionSuccessful\": true" } }
41
42 We expect an empty list for "results"
43 { dg-final { scan-sarif-file "\"results\": \\\[\\\]" } } */
44