From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH 0/5] Automake custom test driver using SRFI-64. Date: Fri, 01 Apr 2016 23:45:15 +0200 Message-ID: <87oa9tj95g.fsf@gnu.org> References: <1458776330-5005-1-git-send-email-mthl@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56572) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1am6sd-0002Iv-Lf for guix-devel@gnu.org; Fri, 01 Apr 2016 17:45:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1am6sY-0007jc-K3 for guix-devel@gnu.org; Fri, 01 Apr 2016 17:45:23 -0400 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:52442) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1am6sY-0007jY-Ge for guix-devel@gnu.org; Fri, 01 Apr 2016 17:45:18 -0400 In-Reply-To: <1458776330-5005-1-git-send-email-mthl@gnu.org> (Mathieu Lirzin's message of "Thu, 24 Mar 2016 00:38:45 +0100") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Mathieu Lirzin Cc: guix-devel@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mathieu Lirzin skribis: > Mathieu Lirzin (5): > tests: Silence %cpio-program. > build: Add a Guile custom test driver using SRFI-64. > tests: Silence guix-daemon. > tests: Silence %have-nix-hash?. > tests: Silence tar. On closer inspection, this is awesome. :-) I withdraw my comment about losing some of the =E2=80=9Cnoise=E2=80=9D sinc= e all we=E2=80=99re losing is pointless info, and we still have the =E2=80=9Cuseful noise=E2=80= =9D (like =E2=80=98pk=E2=80=99 output) in those nicely structured log files. So I=E2= =80=99m happy! =E2=80=98make recheck=E2=80=99 still works; it still reruns the whole file = (even if only one test within the file failed), which is surprising but OK and probably unavoidable given how SRFI-64 works. The only things I would change is the attached patch: the change to =E2=80=98test-env=E2=80=99 removes the =E2=80=9CTerminated=E2=80=9D message= s that Eric mentioned, the rest improves a docstring in =E2=80=98test-driver.scm=E2=80=99 and uses the= common convention for Boolean variables. If you can integrate something along these lines, then please merge! I hereby dub you Automake Wizard. Thank you! Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable diff --git a/build-aux/test-driver.scm b/build-aux/test-driver.scm index 4439b21..467741f 100644 --- a/build-aux/test-driver.scm +++ b/build-aux/test-driver.scm @@ -1,6 +1,6 @@ ;;;; test-driver.scm - SRFI-64 custom driver for GNU Automake test suites =20 -(define script-version "2016-03-28.13") ;UTC +(define script-version "2016-04-01.21") ;UTC =20 ;;; Copyright =C2=A9 2015, 2016 Mathieu Lirzin ;;; @@ -30,8 +30,7 @@ (srfi srfi-64)) =20 (define (show-help) - (display "Usage: - test-driver --test-name=3DNAME --log-file=3DPATH --trs-file=3DPATH + (display "Usage: test-driver --test-name=3DNAME --log-file=3DPATH --trs-= file=3DPATH [--expect-failure=3D{yes|no}] [--color-tests=3D{yes|no}] [--enable-hard-errors=3D{yes|no}] [--brief=3D{yes|no}}] [--] TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS] @@ -75,11 +74,11 @@ The '--test-name', '--log-file' and '--trs-file' option= s are mandatory.\n")) "[m") ;no color result))) =20 -(define* (test-runner-gnu test-name #:key color-tests brief out-port trs-p= ort) +(define* (test-runner-gnu test-name #:key color? brief? out-port trs-port) "Return an custom SRFI-64 test runner. TEST-NAME is a string specifying= the -file name of the current the test. COLOR-TESTS and BRIEF are booleans. -OUT-PORT and TRS-PORT must be output ports. The current output port is -supposed to be redirected to a '.log' file." +file name of the current the test. COLOR? specifies whether to use colors, +and BRIEF?, well, you know. OUT-PORT and TRS-PORT must be output ports. = The +current output port is supposed to be redirected to a '.log' file." =20 (define (test-on-test-begin-gnu runner) ;; Procedure called at the start of an individual test-case, before the @@ -97,10 +96,10 @@ supposed to be redirected to a '.log' file." (let* ((results (test-result-alist runner)) (result? (cut assq <> results)) (result (cut assq-ref results <>))) - (unless brief + (unless brief? ;; Display the result of each test case on the console. (test-display - (result->string (test-result-kind runner) #:colorize color-tests) + (result->string (test-result-kind runner) #:colorize color?) (string-append test-name " - " (test-runner-test-name runner)) out-port)) (when (result? 'expected-value) @@ -134,10 +133,10 @@ supposed to be redirected to a '.log' file." (test-display ":copy-in-global-log" (if (or fail skip) "yes" "no") trs-port) - (when brief + (when brief? ;; Display the global test group result on the console. (test-display (result->string (if fail 'fail (if skip 'skip 'pass)) - #:colorize color-tests) + #:colorize color?) test-name out-port)) #f)) @@ -167,8 +166,8 @@ supposed to be redirected to a '.log' file." (setvbuf out _IOLBF) (test-with-runner (test-runner-gnu (option 'test-name #f) - #:color-tests (option->boolean opts 'color-te= sts) - #:brief (option->boolean opts 'brief) + #:color? (option->boolean opts 'color-tests) + #:brief? (option->boolean opts 'brief) #:out-port out #:trs-port trs) (parameterize ((current-output-port log) (current-error-port log) diff --git a/test-env.in b/test-env.in index 040175a..2c71d58 100644 --- a/test-env.in +++ b/test-env.in @@ -32,6 +32,10 @@ unset CDPATH =20 if [ -x "@abs_top_builddir@/guix-daemon" ] then + # Silence the daemon's output, which is often useless, as well as that= of + # Bash (such as "Terminated" messages when 'guix-daemon' is killed.) + exec 2> /dev/null + NIX_STORE_DIR=3D"@GUIX_TEST_ROOT@/store" =20 # Do that because store.scm calls `canonicalize-path' on it. @@ -97,7 +101,7 @@ then # unavailable, for instance if we're not running as root. "@abs_top_builddir@/pre-inst-env" \ "@abs_top_builddir@/guix-daemon" --disable-chroot \ - --substitute-urls=3D"$GUIX_BINARY_SUBSTITUTE_URL" 2>/dev/null & + --substitute-urls=3D"$GUIX_BINARY_SUBSTITUTE_URL" & =20 daemon_pid=3D$! trap "kill $daemon_pid ; rm -rf $NIX_STATE_DIR" EXIT --=-=-=--