https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109360

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by David Malcolm <dmalc...@gcc.gnu.org>:

https://gcc.gnu.org/g:17967907102099806dc80c71ee7665ffb22ffa23

commit r15-1633-g17967907102099806dc80c71ee7665ffb22ffa23
Author: David Malcolm <dmalc...@redhat.com>
Date:   Tue Jun 25 20:26:21 2024 -0400

    testsuite: use check-jsonschema for validating .sarif files [PR109360]

    As reported here:
      https://gcc.gnu.org/pipermail/gcc-patches/2024-June/655434.html
    the schema validation I added for generated .sarif files in
    r15-1541-ga84fe222029ff2 used the "jsonschema" command line tool, which
    has been deprecated by more recent versions of the Python 3 "jsonschema"
    module.

    This patch updates the validation to use the more recent
    "check-jsonschema" command line tool, from the Python 3 "check-jsonschema"
    module, fixing the testsuite FAILs due to the deprecation message.

    As an added bonus, the output on validation failures is *much* nicer, e.g.
    if I undo r15-1540-g9f4fdc3acebcf6, the error messages begin like this:
    verify-sarif-file: res: Schema validation errors were encountered.
     
diagnostic-format-sarif-file-bad-utf8-pr109098-1.c.sarif::$.runs[0].results[0].locations[0].physicalLocation.region.startColumn:
0 is less than the minimum of 1
     
diagnostic-format-sarif-file-bad-utf8-pr109098-1.c.sarif::$.runs[0].results[0].relatedLocations[0].physicalLocation.region.startColumn:
0 is less than the minimum of 1
     
diagnostic-format-sarif-file-bad-utf8-pr109098-1.c.sarif::$.runs[0].results[0].relatedLocations[1].physicalLocation.region.startColumn:
0 is less than the minimum of 1
     
diagnostic-format-sarif-file-bad-utf8-pr109098-1.c.sarif::$.runs[0].results[0].relatedLocations[2].physicalLocation.region.startColumn:
0 is less than the minimum of 1
    child process exited abnormally
    FAIL: c-c++-common/diagnostic-format-sarif-file-bad-utf8-pr109098-1.c 
-Wc++-compat   (test .sarif output against SARIF schema)

    Tested with Python 3.8 with check_jsonschema 0.28.6

    gcc/ChangeLog:
            PR testsuite/109360
            * doc/install.texi (Python3 modules): Update SARIF validation
            requirement to use check-jsonschema rather than jsonschema.

    gcc/testsuite/ChangeLog:
            PR testsuite/109360
            * lib/scansarif.exp (verify-sarif-file): Use check-jsonschema
            rather than jsonschema, updating the invocation accordingly.
            * lib/target-supports.exp (check_effective_target_jsonschema):
Convert
            to...
            (check_effective_target_check_jsonschema): ...this.

    Signed-off-by: David Malcolm <dmalc...@redhat.com>

Reply via email to