aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2019-12-16 02:04:57 +0530
committerArun Isaac2019-12-16 02:04:57 +0530
commit27b2f99772eebc1cf7bb5e0cc44c2b7046b35937 (patch)
treef17842cda1d2b78b65481867f18aca2166e163bb
parentd39a89d54fa7a41c34cdf6c3cf8107cc9545d720 (diff)
downloadguile-email-27b2f99772eebc1cf7bb5e0cc44c2b7046b35937.tar.gz
guile-email-27b2f99772eebc1cf7bb5e0cc44c2b7046b35937.tar.lz
guile-email-27b2f99772eebc1cf7bb5e0cc44c2b7046b35937.zip
tests: Implement custom test runner group begin and end functions.
* build-aux/test-driver.scm.in (my-gnu-runner): Add custom test-runner on-group-begin and on-group-end functions. Accept log file port as an argument.
-rw-r--r--build-aux/test-driver.scm.in28
1 files changed, 19 insertions, 9 deletions
diff --git a/build-aux/test-driver.scm.in b/build-aux/test-driver.scm.in
index 71aa042..89b9b68 100644
--- a/build-aux/test-driver.scm.in
+++ b/build-aux/test-driver.scm.in
@@ -1,5 +1,5 @@
;;; guile-email --- Guile email parser
-;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2018, 2019 Arun Isaac <arunisaac@systemreboot.net>
;;;
;;; This file is part of guile-email.
;;;
@@ -31,8 +31,17 @@
(expect-failure (value #t))
(enable-hard-errors (value #t))))
-(define (my-gnu-runner trs-port)
+(define (my-gnu-runner log-port trs-port)
(let ((runner (test-runner-simple)))
+ (test-runner-on-group-begin! runner
+ (lambda (runner suite-name count)
+ (format #t "%%%% Starting test ~a~%" suite-name)
+ (format log-port "%%%% Starting test ~a~%" suite-name)
+ ;; Set log-port in the aux-value field for use by other parts
+ ;; of test-runner-simple
+ (test-runner-aux-value! runner log-port)
+ (format #t " (Writing full log to \"~a\")~%" (port-filename log-port))))
+ (test-runner-on-group-end! runner (const #f))
(test-runner-on-test-end! runner
(lambda (runner)
(format trs-port ":test-result: ~A ~A~%"
@@ -43,10 +52,11 @@
runner))
(let ((opts (getopt-long (command-line) %options)))
- (set! test-log-to-file (string-append "@abs_top_builddir@/"
- (option-ref opts 'log-file #f)))
- (call-with-output-file (option-ref opts 'trs-file #f)
- (lambda (trs-port)
- (chdir "@abs_top_srcdir@")
- (test-with-runner (my-gnu-runner trs-port)
- (load-from-path (option-ref opts 'test-name #f))))))
+ (call-with-output-file (string-append "@abs_top_builddir@/"
+ (option-ref opts 'log-file #f))
+ (lambda (log-port)
+ (call-with-output-file (option-ref opts 'trs-file #f)
+ (lambda (trs-port)
+ (chdir "@abs_top_srcdir@")
+ (test-with-runner (my-gnu-runner log-port trs-port)
+ (load-from-path (option-ref opts 'test-name #f))))))))