[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] autotest: Respect NO_COLOR in test suites.
From: |
Nick Bowler |
Subject: |
[PATCH] autotest: Respect NO_COLOR in test suites. |
Date: |
Thu, 5 Dec 2024 22:45:45 -0500 |
This implements support for NO_COLOR in test suites using AT_COLOR_TESTS
to enable colour by default. NO_COLOR is an informal standard[1] way
for users to express their preference to not use colours by default.
If NO_COLOR is set in the environment to anything other than the empty
string, the default should be "no colour" (but the command-line --color
option is expected to work as usual).
[1] http://no-color.org
* lib/autotest/general.m4 (AT_INIT): Respect user NO_COLOR setting
to restrict enabling of ANSI colours by default.
---
lib/autotest/general.m4 | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4
index 6b4c3ae5..b5388da4 100644
--- a/lib/autotest/general.m4
+++ b/lib/autotest/general.m4
@@ -446,7 +446,9 @@ m4_define([_AT_FINISH],
m4_divert_text([DEFAULTS],
[
# Whether to enable colored test results.
-at_color=m4_ifdef([AT_color], [AT_color], [no])
+m4_ifdef([AT_color],
+ [AS_CASE([$NO_COLOR], [''], [at_color=auto], [at_color=no])],
+ [at_color=no])
# As many question marks as there are digits in the last test group number.
# Used to normalize the test group numbers so that 'ls' lists them in
# numerical order.
--
2.45.2
- [PATCH] autotest: Respect NO_COLOR in test suites.,
Nick Bowler <=