diff mbox series

[bug#45948,3/5] build: test-driver.scm: Enable colored test results by default.

Message ID 20210118062501.27022-3-maxim.cournoyer@gmail.com
State Accepted
Headers show
Series Improvements to the Automake SRFI 64 test driver. | expand

Commit Message

Maxim Cournoyer Jan. 18, 2021, 6:24 a.m. UTC
The Automake parallel test harness does its own smart detection of the
terminal color capability and always provides the --color-tests argument to
the driver.  This change defaults the --color-tests argument to true when the
test driver is run on its own (not via Automake).

* build-aux/test-driver.scm (main): Set the default value of the --color-tests
argument to true when it's not explicitly provided.
---
 build-aux/test-driver.scm | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Ludovic Courtès Jan. 30, 2021, 9:39 p.m. UTC | #1
Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:

> The Automake parallel test harness does its own smart detection of the
> terminal color capability and always provides the --color-tests argument to
> the driver.  This change defaults the --color-tests argument to true when the
> test driver is run on its own (not via Automake).
>
> * build-aux/test-driver.scm (main): Set the default value of the --color-tests
> argument to true when it's not explicitly provided.

It’s a small change to why not, but…

… the test driver is not meant to be used on its own though, it’s really
a test driver for Automake.

Plus, in most projects, part of the test environment is defined in
‘Makefile.am’; I wouldn’t want to process bug reports because people
thought they could try and run tests without “make check”.

Thoughts?

As a side note, this test driver is bundled in quite a few Guile
packages.  Longer-term, it would be nice to consider maintaining it as
part of Automake.  Now is maybe a good time since there’s on-going
maintenance work happening in Autoconf (and soon Automake and Libtool)
after a long hiatus.

Ludo’.
Maxim Cournoyer Feb. 1, 2021, 2:47 a.m. UTC | #2
Hi Ludo,

Ludovic Courtès <ludo@gnu.org> writes:

> Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
>
>> The Automake parallel test harness does its own smart detection of the
>> terminal color capability and always provides the --color-tests argument to
>> the driver.  This change defaults the --color-tests argument to true when the
>> test driver is run on its own (not via Automake).
>>
>> * build-aux/test-driver.scm (main): Set the default value of the --color-tests
>> argument to true when it's not explicitly provided.
>
> It’s a small change to why not, but…
>
> … the test driver is not meant to be used on its own though, it’s really
> a test driver for Automake.

The interface via make is not terribly convenient/discoverable; I find
having the test-driver produce useful output on its own handy for
hacking on the thing hands on.

> Plus, in most projects, part of the test environment is defined in
> ‘Makefile.am’; I wouldn’t want to process bug reports because people
> thought they could try and run tests without “make check”.

The use of the test driver without the Automake build system is
undocumented; I wouldn't be too worried about people suddenly stumbling
on it.

Thanks,

Maxim
diff mbox series

Patch

diff --git a/build-aux/test-driver.scm b/build-aux/test-driver.scm
index 5891631da6..767a9fb25d 100644
--- a/build-aux/test-driver.scm
+++ b/build-aux/test-driver.scm
@@ -163,14 +163,17 @@  void port, which means no TRS output is logged."
       (let ((log (and=> (option 'log-file #f) (cut open-file <> "w0")))
             (trs (and=> (option 'trs-file #f) (cut open-file <> "wl")))
             (out (duplicate-port (current-output-port) "wl"))
-            (test-name (option 'test-name #f)))
+            (test-name (option 'test-name #f))
+            (color-tests (if (assoc 'color-tests opts)
+                             (option->boolean opts 'color-tests)
+                             #t)))
         (when log
           (redirect-port log (current-output-port))
           (redirect-port log (current-warning-port))
           (redirect-port log (current-error-port)))
         (test-with-runner
             (test-runner-gnu test-name
-                             #:color? (option->boolean opts 'color-tests)
+                             #:color? color-tests
                              #:brief? (option->boolean opts 'brief)
                              #:out-port out #:trs-port trs)
           (load-from-path test-name))