From 08d59a6d87648df7f71c8bad4238e43af7eeb783 Mon Sep 17 00:00:00 2001 From: "Robert P. Goldman" <rpgoldman@sift.net> Date: Mon, 12 Sep 2016 21:37:01 -0500 Subject: [PATCH] Simplify TOUCH-FILE. There was a very complex conditional in the middle controlling how it was implemented. I simplified the conditions to make it easier to understand how it works. I also modified it so that if you tell TOUCH-FILE to use the cache, and the cache hasn't been initialized, it will raise an error. --- test/script-support.lisp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/script-support.lisp b/test/script-support.lisp index c6bba03cf..0f3289576 100644 --- a/test/script-support.lisp +++ b/test/script-support.lisp @@ -316,17 +316,20 @@ Some constraints: (defun touch-file (file &key offset timestamp in-filesystem) (let* ((base (or timestamp (get-universal-time))) (stamp (if offset (+ base offset) base))) - (if (and (asymval :*asdf-cache*) (not in-filesystem)) - (acall :register-file-stamp file stamp) + (if in-filesystem (multiple-value-bind (sec min hr day month year) (decode-universal-time stamp) - (unless in-filesystem - (error "Y U NO use stamp cache?")) (acall :run-program `("touch" "-t" ,(format nil "~4,'0D~2,'0D~2,'0D~2,'0D~2,'0D.~2,'0D" year month day hr min sec) ,(acall :native-namestring file))) - (assert-equal (file-write-date file) stamp))))) + (assert-equal (file-write-date file) stamp)) + ;; else + (progn + (unless (asymval :*asdf-cache*) + (error "Trying to use *ASDF-CACHE* in TOUCH-FILE, but cache is not initialized.")) + (acall :register-file-stamp file stamp))))) + (defun mark-file-deleted (file) (unless (asymval :*asdf-cache*) (error "Y U NO use asdf cache?")) (acall :register-file-stamp (acall :normalize-namestring file) nil)) -- GitLab