-
- Downloads
testsuite: generalize support for Python tests for SARIF output
In r15-2354-g4d1f71d49e396c I added the ability to use Python to write
tests of SARIF output via a new "run-sarif-pytest" based
on "run-gcov-pytest", with a sarif.py support script in
testsuite/gcc.dg/sarif-output.
This followup patch:
(a) removes the limitation of such tests needing to be in
testsuite/gcc.dg/sarif-output by moving sarif.py to testsuite/lib
and adding logic to add that directory to PYTHONPATH when invoking
pytest.
(b) uses this to replace fragile regexp-based tests in
gcc.dg/plugin/diagnostic-test-paths-multithreaded-sarif.c with
Python logic that verifies the structure within the generated JSON,
and to add test coverage for SARIF output relating to GCC plugins.
gcc/ChangeLog:
* diagnostic-format-sarif.cc: Add comments noting that we don't
yet capture any diagnostic_metadata::rules associated with a
diagnostic.
gcc/testsuite/ChangeLog:
* gcc.dg/plugin/diagnostic-test-metadata-sarif.c: New test,
based on diagnostic-test-metadata.c.
* gcc.dg/plugin/diagnostic-test-metadata-sarif.py: New script.
* gcc.dg/plugin/diagnostic-test-paths-multithreaded-sarif.c:
Replace scan-sarif-file directives with run-sarif-pytest, to
run...
* gcc.dg/plugin/diagnostic-test-paths-multithreaded-sarif.py:
...this new test.
* gcc.dg/plugin/plugin.exp (plugin_test_list): Add
diagnostic-test-metadata-sarif.c.
* gcc.dg/sarif-output/sarif.py: Move to...
* lib/sarif.py: ...here.
* lib/scansarif.exp (run-sarif-pytest): Prepend "lib" to
PYTHONPATH before running python scripts.
Signed-off-by:
David Malcolm <dmalcolm@redhat.com>
Showing
- gcc/diagnostic-format-sarif.cc 5 additions, 1 deletiongcc/diagnostic-format-sarif.cc
- gcc/testsuite/gcc.dg/plugin/diagnostic-test-metadata-sarif.c 17 additions, 0 deletionsgcc/testsuite/gcc.dg/plugin/diagnostic-test-metadata-sarif.c
- gcc/testsuite/gcc.dg/plugin/diagnostic-test-metadata-sarif.py 55 additions, 0 deletions...testsuite/gcc.dg/plugin/diagnostic-test-metadata-sarif.py
- gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-multithreaded-sarif.c 3 additions, 14 deletions...gcc.dg/plugin/diagnostic-test-paths-multithreaded-sarif.c
- gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-multithreaded-sarif.py 109 additions, 0 deletions...cc.dg/plugin/diagnostic-test-paths-multithreaded-sarif.py
- gcc/testsuite/gcc.dg/plugin/plugin.exp 3 additions, 1 deletiongcc/testsuite/gcc.dg/plugin/plugin.exp
- gcc/testsuite/lib/sarif.py 0 additions, 0 deletionsgcc/testsuite/lib/sarif.py
- gcc/testsuite/lib/scansarif.exp 16 additions, 0 deletionsgcc/testsuite/lib/scansarif.exp
Loading
Please register or sign in to comment