Skip to content
Snippets Groups Projects
Commit a84fe222 authored by David Malcolm's avatar David Malcolm
Browse files

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: default avatarDavid Malcolm <dmalcolm@redhat.com>
parent 9f4fdc3a
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment