From fe907bbd57fd9f45c70d76c719c37615c3207e43 Mon Sep 17 00:00:00 2001 From: "Robert P. Goldman" <rpgoldman@gmail.com> Date: Wed, 9 Jul 2014 23:08:40 -0500 Subject: [PATCH] Cleaned up a bunch of debugging cruft. Test still doesn't work, but that seems to be because the testing code itself establishes an ASDF cache, making the restart I want inaccessible from test code. --- test/test-try-refinding.script | 61 +++++++++++++++++----------------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/test/test-try-refinding.script b/test/test-try-refinding.script index 94ce1b4f..330ea0af 100644 --- a/test/test-try-refinding.script +++ b/test/test-try-refinding.script @@ -17,37 +17,38 @@ (DBG "Clearing the caches and finding.") (clear-caches-and-search) (assert (not (asdf:find-system "test-asdf/force1" nil))) -(let (tried-once) - (handler-bind - ((asdf:missing-dependency-of-version - (lambda (c) - ;; Nothing Quicklisp can do to recover from this, so - ;; just resignal - (error c))) - (asdf:missing-dependency - (lambda (c) - (if (not tried-once) - (let ((missing (asdf::missing-requires c))) - (assert (equal missing "test-asdf/force1")) - (setf tried-once t) - (DBG "Trying to reset the central registry and retry.") - (setf asdf:*central-registry* *old-registry*) - (asdf:find-system missing)) - ;; avoid infinite looping - (error c))))) - (asdf:find-system "test-asdf/force1"))) +(DBG "Correctly failed to find system.") +(assert + (let (tried-once) + (handler-bind + ((asdf:missing-component + #'(lambda (c) + (DBG "Caught MISSING-COMPONENT condition.") + (if (not tried-once) + (let ((missing (asdf::missing-requires c))) + (assert (equal missing "test-asdf/force1")) + (setf tried-once t) + (setf asdf:*central-registry* *old-registry*) + (invoke-restart 'asdf:reinitialize-source-registry-and-retry) + ) + ;; avoid infinite looping + (error c))))) + (asdf:find-system "test-asdf/force1" t)))) (DBG "Refinding test successful.") (DBG "Now trying LOAD-SYSTEM with refinding.") (clear-caches-and-search) -(trace find-system) -(trace find-component) -(trace asdf::component-find-path) -(trace operate) +(def-test-system test-missing-dependency + :depends-on ("test-asdf/force1") + :components ((:file "file2"))) +;; (trace find-system) +;; (trace find-component) +;; (trace asdf::component-find-path) +;; (trace operate) (let (tried-once) (flet ((handle-missing (c) - (if (not tried-once) + (if (not tried-once) (let ((missing (asdf::missing-requires c))) (assert (equal missing "test-asdf/force1")) (setf tried-once t) @@ -55,25 +56,25 @@ (setf asdf:*central-registry* *old-registry*) (unless (find-restart 'asdf:reinitialize-source-registry-and-retry) (error "Expected REINITIALIZE-SOURCE-REGISTRY-AND-RETRY restart not found.")) - (DBG "Before invoking restart, CENTRAL-REGISTRY is:~%~T~S" + (DBG "Before invoking restart, CENTRAL-REGISTRY is:" asdf:*central-registry*) (invoke-restart 'asdf:reinitialize-source-registry-and-retry) - (DBG "After invoking restart, CENTRAL-REGISTRY is:~%~T~S" + (DBG "After invoking restart, CENTRAL-REGISTRY is:" asdf:*central-registry*)) ;; avoid infinite looping (error c)))) (handler-bind ((asdf:missing-dependency-of-version - (lambda (c) + #'(lambda (c) ;; Nothing Quicklisp can do to recover from this, so ;; just resignal (error c))) (asdf:missing-dependency - (lambda (c) + #'(lambda (c) (DBG "Catching MISSING-DEPENDENCY condition:" tried-once) (handle-missing c))) (asdf:missing-component - (lambda (c) + #'(lambda (c) (DBG "Catching MISSING-COMPONENT condition:" tried-once) (handle-missing c)))) - (asdf:load-system "test-asdf/force1")))) + (asdf:load-system "test-missing-dependency")))) -- GitLab