]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
test-driver.scm: Don't guess script name from "--test-name"
authorMathieu Lirzin <mthl@gnu.org>
Sat, 24 Mar 2018 22:42:16 +0000 (23:42 +0100)
committerMathieu Lirzin <mthl@gnu.org>
Sat, 24 Mar 2018 22:42:16 +0000 (23:42 +0100)
'primitive-load' is used instead of 'load-from-path' since the script is
given as a relative file name.  For unknown reason, using 'load' fails
with GNU Mcron test suite when running 'make distcheck'.

* contrib/test-driver.scm: Get the actual script name directly from the
command line.  Handle the case where that argument is missing.

contrib/test-driver.scm

index c72f10ed0c5a78c9fd383f57713462033a5ee50a..5292c0a0e3f334920beca6f9572ec01a6a45aef5 100644 (file)
@@ -1,6 +1,6 @@
 ;;;; test-driver.scm - Guile test driver for Automake testsuite harness
 
-(define script-version "2018-03-24.19") ;UTC
+(define script-version "2018-03-24.22") ;UTC
 
 ;;; Copyright © 2015-2018 Free Software Foundation, Inc.
 ;;;
@@ -49,6 +49,7 @@
 ;;;; Code:
 
 (use-modules (ice-9 getopt-long)
+             (ice-9 match)
              (ice-9 pretty-print)
              (srfi srfi-26)
              (srfi srfi-64))
@@ -179,21 +180,26 @@ current output port is supposed to be redirected to a '.log' file."
    ((option 'help #f)    (show-help))
    ((option 'version #f) (format #t "test-driver.scm ~A" script-version))
    (else
-    (let ((log (open-file (option 'log-file "") "w0"))
-         (trs (open-file (option 'trs-file "") "wl"))
-         (out (duplicate-port (current-output-port) "wl")))
-      (redirect-port log (current-output-port))
-      (redirect-port log (current-warning-port))
-      (redirect-port log (current-error-port))
-      (test-with-runner
-         (test-runner-gnu (option 'test-name #f)
-                          #:color? (option->boolean opts 'color-tests)
-                          #:brief? (option->boolean opts 'brief)
-                          #:out-port out #:trs-port trs)
-       (load-from-path (option 'test-name #f)))
-      (close-port log)
-      (close-port trs)
-      (close-port out))))
+    (match (option '() '())
+      (()
+       (display "missing test script argument\n" (current-error-port))
+       (exit 1))
+      ((script . args)
+       (let ((log (open-file (option 'log-file "") "w0"))
+             (trs (open-file (option 'trs-file "") "wl"))
+             (out (duplicate-port (current-output-port) "wl")))
+         (redirect-port log (current-output-port))
+         (redirect-port log (current-warning-port))
+         (redirect-port log (current-error-port))
+         (test-with-runner
+             (test-runner-gnu (option 'test-name #f)
+                              #:color? (option->boolean opts 'color-tests)
+                              #:brief? (option->boolean opts 'brief)
+                              #:out-port out #:trs-port trs)
+           (primitive-load script))
+         (close-port log)
+         (close-port trs)
+         (close-port out))))))
   (exit 0))
 
 ;;; Local Variables: