From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id F0D34385B52C; Wed, 22 Mar 2023 20:50:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F0D34385B52C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679518220; bh=PYr9txhDoSDdTaFt3EmVu9bH1o6uVl2fPflv89IOfoY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=kyJZmakM019U2HuW2Oobduo4CoZhK7jtjubhPWrsmUc6tYIjH7bWnGuNiyaZu6TyP vibbpsU6Z/Mo7hxLFRAKKyqgLR33Tqt78hwDDrOYxD6lBTEC/XG5Tia4TuUMefzjff P+cTAFHkz+pXDoTHUMqqJTzlLrNEdoBaJZ7f7HTE= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug testsuite/105959] new test case c-c++-common/diagnostic-format-sarif-file-4.c from r13-967-g6cf276ddf22066 fails Date: Wed, 22 Mar 2023 20:50:19 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: testsuite X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: patch X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: WAITING X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105959 --- Comment #16 from CVS Commits --- The master branch has been updated by David Malcolm : https://gcc.gnu.org/g:6b2740946d26ffde7e1318f24bae00443ece387d commit r13-6815-g6b2740946d26ffde7e1318f24bae00443ece387d Author: David Malcolm Date: Wed Mar 22 16:48:27 2023 -0400 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=3DC, 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=3DC. 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 =