From dc2b10f2cc464b6d0003c3adc4541c3895eebbd5 Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Sat, 19 May 2012 17:09:12 +0300 Subject: [PATCH] robustify COUNT-FULL-CALLS in the test suite Move it to compiler-test-utils.lisp, while at it. --- tests/compiler-test-util.lisp | 14 ++++++++++++++ tests/compiler.impure.lisp | 27 ++++++++------------------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/tests/compiler-test-util.lisp b/tests/compiler-test-util.lisp index f0745d2..352db70 100644 --- a/tests/compiler-test-util.lisp +++ b/tests/compiler-test-util.lisp @@ -17,6 +17,7 @@ (:export #:assert-consing #:assert-no-consing #:compiler-derived-type + #:count-full-calls #:find-value-cell-values #:find-code-constants #:find-named-callees @@ -110,3 +111,16 @@ (values warn fail))) (ignore-errors (delete-file lisp)) (ignore-errors (delete-file fasl))))) + +;; Pretty horrible, but does the job +(defun count-full-calls (name function) + (let ((code (with-output-to-string (s) + (disassemble function :stream s))) + (n 0)) + (with-input-from-string (s code) + (loop for line = (read-line s nil nil) + while line + when (and (search name line) + (search "#