On Wed, Feb 11, 2026 at 11:05:00PM +0000, Joseph Myers wrote:
> The sanitizer tests have logic to set ASAN_OPTIONS and UBSAN_OPTIONS
> to color=never to avoid problems checking against output patterns, in
> test configurations where the output is otherwise coloured by default.
>
> This does not however cover all sanitizer tests with issues in such
> configurations. There is no corresponding logic to set TSAN_OPTIONS
> for tsan tests, and environment variable settings in
> dg-set-target-env-var override the globally set color=never.
>
> Add logic to set TSAN_OPTIONS similarly (following the UBSAN_OPTIONS
> logic, that saves and restores any previous setting or lack thereof,
> rather than the ASAN_OPTIONS logic, that just sets ASAN_OPTIONS in the
> environment so that it remains set for all the rest of the possibly
> unrelated tests included in the same runtest execution). Also add
> color=never to dg-set-target-env-var in two such tests where I've seen
> coloured output causing failures (but not for other tests where I
> haven't seen the default producing such fallures).
>
> Tested for x86_64-pc-linux-gnu, and with a cross to aarch64-linux
> (together with other testsuite fixes) in a configuration where I
> previously saw failures related to colour output from sanitizer tests.
>
> * lib/tsan-dg.exp (orig_tsan_options_saved, orig_tsan_options):
> New global variables.
> (tsan_init): Save TSAN_OPTIONS and set it to color=never.
> (tsan_finish): Restore TSAN_OPTIONS.
> * c-c++-common/asan/pr64820.c: Include color=never in
> ASAN_OPTIONS.
> * c-c++-common/asan/use-after-return-1.c: Likewise.
LGTM.
Jakub