aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2023-12-07 09:33:52 +0100
committerWojtek Kosior <koszko@koszko.org>2023-12-12 19:18:26 +0100
commitd307e7dd8ce4d16657f49a4d5e0629212e568386 (patch)
tree1827ae65e856479ff01ae49811edde4de3fef384
parent51e4c5266acb2730ad90e08a1379192321ea2797 (diff)
downloadmyra-test-utils-d307e7dd8ce4d16657f49a4d5e0629212e568386.tar.gz
myra-test-utils-d307e7dd8ce4d16657f49a4d5e0629212e568386.zip
Make "by-hand" execution of test-driver easier.
* src/guile/myra-test-utils/driver.scm (define-module): Import `%interactive-debugging`. (show-help): Display `--log-file` and `--trs-file` as non-mandatory options. (run-test-driver): For invokations without log file set cause REPL to be spawned on test expressions that errored-out. Configure readline support for the REPL if available.
-rwxr-xr-xsrc/guile/myra-test-utils/driver.scm41
1 files changed, 27 insertions, 14 deletions
diff --git a/src/guile/myra-test-utils/driver.scm b/src/guile/myra-test-utils/driver.scm
index bfb5a1f..0369fe1 100755
--- a/src/guile/myra-test-utils/driver.scm
+++ b/src/guile/myra-test-utils/driver.scm
@@ -35,13 +35,14 @@
#:use-module ((srfi srfi-19) #:prefix s19:)
#:use-module ((srfi srfi-26) #:select (cut))
#:use-module ((srfi srfi-64) #:prefix s64:)
+ #:use-module ((myra-test-utils) #:select (%interactive-debugging))
#:export (run-test-driver))
-(define script-version "2023-12-06.16") ;UTC
+(define script-version "2023-12-07.08") ;UTC
(define (show-help)
(display "Usage:
- test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
+ test-driver --test-name=NAME [--log-file=PATH] [--trs-file=PATH]
[--expect-failure={yes|no}] [--color-tests={yes|no}]
[--select=REGEXP] [--exclude=REGEXP] [--errors-only={yes|no}]
[--enable-hard-errors={yes|no}] [--brief={yes|no}}]
@@ -257,21 +258,33 @@ cases based on their names."
(color-tests (if (assoc 'color-tests opts)
(option->boolean opts 'color-tests)
#t)))
- (when log
+ (cond
+ (log
(redirect-port log (current-output-port))
(redirect-port log (current-warning-port))
(redirect-port log (current-error-port)))
- (s64:test-with-runner
- (test-runner-gnu test-name
- #:color? color-tests
- #:brief? (option->boolean opts 'brief)
- #:errors-only? (option->boolean opts 'errors-only)
- #:show-duration? (option->boolean
- opts 'show-duration)
- #:out-port out #:trs-port trs)
- (s64:test-apply test-specifier
- (lambda _
- (load-from-path test-name))))
+ ((false-if-exception (resolve-interface '(ice-9 readline)))
+ =>
+ (lambda (module)
+ ;; Enable completion and input history at the REPL.
+ ((module-ref module 'activate-readline))))
+ (else
+ (display "Consider installing the 'guile-readline' package for
+convenient interactive line editing and input history.\n\n"
+ out)))
+ (parameterize ((%interactive-debugging (not log)))
+ (s64:test-with-runner
+ (test-runner-gnu test-name
+ #:color? color-tests
+ #:brief? (option->boolean opts 'brief)
+ #:errors-only? (option->boolean
+ opts 'errors-only)
+ #:show-duration? (option->boolean
+ opts 'show-duration)
+ #:out-port out #:trs-port trs)
+ (s64:test-apply test-specifier
+ (lambda _
+ (load-from-path test-name)))))
(and=> log close-port)
(and=> trs close-port)
(close-port out))))