From a51aeb29a1f53c4ddc95aebaf6dec6ed16c6e3ed Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Mon, 21 Aug 2017 11:33:44 +0100 Subject: [PATCH] [functionl-tests] allow multiple patterns on the run-test command line --- functional-tests/run-tests | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/functional-tests/run-tests b/functional-tests/run-tests index ebef166..55708b8 100755 --- a/functional-tests/run-tests +++ b/functional-tests/run-tests @@ -35,18 +35,32 @@ (list->string cs))) (split-list (string->list str) sep))) -(define (mk-filter pattern) +(define (mk-single-filter pattern) (let ((prefix (string->syms pattern #\/))) (lambda (keys) (begins-with prefix keys)))) +(define (mk-filter patterns) + (if (null? patterns) + ; accept everything if no patterns + (lambda (_) #t) + + ; Otherwise accept tests that pass a pattern + (let ((filters (map mk-single-filter patterns))) + (fold-left (lambda (fn-a fn-b) + (lambda (keys) + (or (fn-a keys) + (fn-b keys)))) + (car filters) + (cdr filters))))) + ;;------------------------------------------------ (register-thin-tests) (register-cache-tests) -(if (run-scenarios (filter (mk-filter (car (cdr (command-line)))) - (list-scenarios))) +(let ((pred (mk-filter (cdr (command-line))))) + (if (run-scenarios (filter pred (list-scenarios))) (exit) - (exit #f)) + (exit #f)))