diff --git a/test-suite/lib.scm b/test-suite/lib.scm index 87ab54da8..bcf6bd400 100644 --- a/test-suite/lib.scm +++ b/test-suite/lib.scm @@ -16,7 +16,8 @@ ;;;; the Free Software Foundation, Inc., 59 Temple Place, Suite 330, ;;;; Boston, MA 02111-1307 USA -(define-module (test-suite lib)) +(define-module (test-suite lib) + #:use-module (test-suite paths)) (export @@ -38,7 +39,10 @@ make-log-reporter full-reporter user-reporter - format-test-name) + format-test-name + + ;; Finding test input files. + data-file) ;;;; If you're using Emacs's Scheme mode: @@ -402,3 +406,14 @@ (define (pass-if name condition) ((if condition pass fail) name)) + + +;;;; Helping test cases find their files + +;;; Returns FILENAME, relative to the directory the test suite data +;;; files were installed in, and makes sure the file exists. +(define (data-file filename) + (let ((f (in-vicinity datadir filename))) + (or (file-exists? f) + (error "Test suite data file does not exist: " f)) + f))