From e91c45955df083db3905a8d87cab1014f81c332f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kochma=C5=84ski?= Date: Tue, 17 May 2016 17:20:38 +0200 Subject: [PATCH] utility: add option to run test group or one test CLOS requires :depends-on (TODO) --- cl-bench.asd | 2 +- package.lisp | 4 +++- support.lisp | 12 ++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/cl-bench.asd b/cl-bench.asd index c56c043..e99982f 100644 --- a/cl-bench.asd +++ b/cl-bench.asd @@ -5,7 +5,7 @@ :author "Eric Marsden" :maintainer "Daniel 'jackdaniel' KochmaƄski" :license "Public Domain" - :depends-on (#:trivial-garbage) + :depends-on (#:alexandria #:trivial-garbage) :serial t :components ((:file "package") (:file "cl-bench") diff --git a/package.lisp b/package.lisp index 21d9fe2..cdb0cf9 100644 --- a/package.lisp +++ b/package.lisp @@ -2,5 +2,7 @@ (defpackage #:cl-bench (:use #:cl) - (:export #:bench-run + (:import-from #:alexandria #:ensure-list) + (:export #:bench-run-1 + #:bench-run #:defbench)) diff --git a/support.lisp b/support.lisp index 2e2adb8..250098c 100644 --- a/support.lisp +++ b/support.lisp @@ -96,6 +96,18 @@ (progn ,@body) (bench-report-footer)))) +(setf (fdefinition 'filter) #'remove-if-not) + +(defun bench-run-1 (&key names groups + &aux + (names (ensure-list names)) + (groups (ensure-list groups))) + (let ((*benchmarks* (union + (filter (lambda (%) (member % names)) *benchmarks* :key #'benchmark-name) + (filter (lambda (%) (member % groups)) *benchmarks* :key #'benchmark-group)))) + (when *benchmarks* + (print *benchmarks*) + (bench-run)))) (defun bench-run () (with-open-file (f (benchmark-report-file) -- GitLab