]> git.ipfire.org Git - thirdparty/gcc.git/commit
testsuite: check that generated .sarif files validate against the SARIF schema [PR109360]
authorDavid Malcolm <dmalcolm@redhat.com>
Fri, 21 Jun 2024 12:46:14 +0000 (08:46 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Wed, 20 Nov 2024 15:00:03 +0000 (10:00 -0500)
commitbf01dcd117ceabff839bb002b9eba4494656fd02
tree82c40dd996b74f1e75dafa1c8077eb771e8dd3b4
parent07485ccd31935b1f82d321f91c677840bd05247c
testsuite: check that generated .sarif files validate against the SARIF schema [PR109360]

This patch extends the dg directive verify-sarif-file so that if
the "jsonschema" tool is available, it will be used to validate the
generated .sarif file.

Tested with jsonschema 3.2 with Python 3.8

gcc/ChangeLog:
PR testsuite/109360
* doc/install.texi: Mention optional usage of "jsonschema" tool.

gcc/testsuite/ChangeLog:
PR testsuite/109360
* lib/sarif-schema-2.1.0.json: New file, downloaded from
https://docs.oasis-open.org/sarif/sarif/v2.1.0/os/schemas/sarif-schema-2.1.0.json
Licensing information can be seen at
https://github.com/oasis-tcs/sarif-spec/issues/583
which states "They are free to incorporate it into their
implementation. No need for special permission or paperwork from
OASIS."
* lib/scansarif.exp (verify-sarif-file): If "jsonschema" is
available, use it to verify that the .sarif file complies with the
SARIF schema.
* lib/target-supports.exp (check_effective_target_jsonschema):
New.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
(cherry picked from commit a84fe222029ff21903283cc8ee4bc760ebf80ec2)
gcc/doc/install.texi
gcc/testsuite/lib/sarif-schema-2.1.0.json [new file with mode: 0644]
gcc/testsuite/lib/scansarif.exp
gcc/testsuite/lib/target-supports.exp