diff options
author | David Malcolm <dmalcolm@redhat.com> | 2023-03-22 16:48:27 -0400 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2023-03-22 16:48:40 -0400 |
commit | 6b2740946d26ffde7e1318f24bae00443ece387d (patch) | |
tree | 43375f753ef75417a89df2d0b924049e2f220dbc /gcc/gimple-range-path.cc | |
parent | e3af2b64ab9e3d16b3b8d30b9e2e4b9755b807f9 (diff) | |
download | gcc-6b2740946d26ffde7e1318f24bae00443ece387d.zip gcc-6b2740946d26ffde7e1318f24bae00443ece387d.tar.gz gcc-6b2740946d26ffde7e1318f24bae00443ece387d.tar.bz2 |
testsuite: always use UTF-8 in scan-sarif-file[-not] [PR105959]
c-c++-common/diagnostic-format-sarif-file-4.c is a test case for
quoting non-ASCII source code in a SARIF diagnostic log.
The SARIF standard mandates that .sarif files are UTF-8 encoded.
PR testsuite/105959 notes that the test case fails when the system
encoding is not UTF-8, such as when the "make" invocation is prefixed
with LC_ALL=C, whereas it works with in a UTF-8-locale.
The root cause is that dg-scan opens the file for reading using the
"system" encoding; I believe it is falling back to treating all files as
effectively ISO 8859-1 in a non-UTF-8 locale.
This patch fixes things by adding a mechanism to dg-scan to allow
callers to (optionally) specify an encoding to use when reading the
file, and updating scan-sarif-file (and the -not variant) to always
use UTF-8 when calling dg-scan, fixing the test case with LC_ALL=C.
gcc/testsuite/ChangeLog:
PR testsuite/105959
* gcc.dg-selftests/dg-final.exp
(dg_final_directive_check_num_args): Update expected maximum
number of args for the various directives using dg-scan.
* lib/scanasm.exp (append_encoding_arg): New procedure.
(dg-scan): Add optional 3rd argument: the encoding to use when
reading from the file.
* lib/scansarif.exp (scan-sarif-file): Treat the file as UTF-8
encoded when reading it.
(scan-sarif-file-not): Likewise.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Diffstat (limited to 'gcc/gimple-range-path.cc')
0 files changed, 0 insertions, 0 deletions