[all-commits] [llvm/llvm-project] 828783: Reland "[llvm-lit] Process ANSI color codes in tes...

Henrik G. Olsson via All-commits all-commits at lists.llvm.org
Wed Sep 11 16:39:49 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 828783177f71d95522763fba92ef1e42dc6101c7
      https://github.com/llvm/llvm-project/commit/828783177f71d95522763fba92ef1e42dc6101c7
  Author: Henrik G. Olsson <hnrklssn at gmail.com>
  Date:   2024-09-11 (Wed, 11 Sep 2024)

  Changed paths:
    M llvm/utils/lit/lit/TestRunner.py
    A llvm/utils/lit/tests/Inputs/escape-color/color-escaped.txt
    A llvm/utils/lit/tests/Inputs/escape-color/color.txt
    A llvm/utils/lit/tests/Inputs/escape-color/lit.cfg
    A llvm/utils/lit/tests/escape-color.py

  Log Message:
  -----------
  Reland "[llvm-lit] Process ANSI color codes in test output when forma… (#108107)

…tting" (#108104)"

This recommits 0f56ba13bff7ab72bfafcf7c5cf9e5b8bd16d895 (reverted by
6007ad79afeffb1288781b4a7241290386293aff). In the original patch
llvm/utils/lit/tests/escape-color.py failed on Windows because it diffed
llvm-lit output with a file containing '\n' newlines rather than '\r\n'.
This issue is avoided by calling 'diff --strip-trailing-cr'.

Original description below:
Test output that carried color across newlines previously resulted in
the formatting around the output also being colored. Detect the current
ANSI color and reset it when printing formatting, and then reapply it.
As an added bonus an unterminated color code is also detected,
preventing it from leaking out into the rest of the terminal.

Fixes #106633



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list