On Fri, Jun 21, 2024 at 08:55:36AM -0400, David Malcolm wrote:
> 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

Hi David,

The new testcase fails on my Fedora 40 with jsonschema 4.19.1 and Python
3.12.3:

```
Executing on host: jsonschema --version    (timeout = 300)
spawn -ignore SIGHUP jsonschema --version
/usr/bin/jsonschema:5: DeprecationWarning: The jsonschema CLI is deprecated and 
will be removed in a future version. Please use check-jsonschema instead, which 
can be installed from https://pypi.org/project/check-jsonschema/
  from jsonschema.cli import main
4.19.1
FAIL: c-c++-common/analyzer/malloc-sarif-1.c (test .sarif output against SARIF 
schema)
```

The deprecation warning output seems to confuse DejaGnu and it fails the test.

Regards,
Dimitar

> 
> With the previous patch, all files generated by the DejaGnu testsuite
> validate.
> 
> There were no validation failures in integration testing.
> 
> Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
> Successful run of analyzer integration tests on x86_64-pc-linux-gnu.
> Pushed to trunk as r15-1541-ga84fe222029ff2.
> 
> 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 <dmalc...@redhat.com>

Reply via email to