aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2019-08-08 15:42:45 +0200
committerMichael Albinus2019-08-08 15:42:45 +0200
commit78ddf6ba96039920d9ac0086b8a87a8a068227ef (patch)
treeafd54021cd02fad1b7d54f4d9232ed3e8a4f411b
parent4084c16090d24e375d198c0f0e65b76afb6049a0 (diff)
downloademacs-78ddf6ba96039920d9ac0086b8a87a8a068227ef.tar.gz
emacs-78ddf6ba96039920d9ac0086b8a87a8a068227ef.zip
Improve time arithmetic in tramp--test-file-attributes-equal-p
* test/lisp/net/tramp-tests.el (tramp--test-file-attributes-equal-p): Improve time arithmetic.
-rw-r--r--test/lisp/net/tramp-tests.el17
1 files changed, 10 insertions, 7 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index bcc74cc3a2c..7a1ae5273e9 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -3089,9 +3089,11 @@ They might differ only in time attributes or directory size."
3089 (let ((attr1 (copy-sequence attr1)) 3089 (let ((attr1 (copy-sequence attr1))
3090 (attr2 (copy-sequence attr2)) 3090 (attr2 (copy-sequence attr2))
3091 (start-time 3091 (start-time
3092 (aref 3092 (floor
3093 (ert--stats-test-start-times ert--current-run-stats) 3093 (float-time
3094 (ert--stats-test-pos ert--current-run-stats (ert-running-test))))) 3094 (aref
3095 (ert--stats-test-start-times ert--current-run-stats)
3096 (ert--stats-test-pos ert--current-run-stats (ert-running-test)))))))
3095 ;; Access time. 3097 ;; Access time.
3096 (setcar (nthcdr 4 attr1) tramp-time-dont-know) 3098 (setcar (nthcdr 4 attr1) tramp-time-dont-know)
3097 (setcar (nthcdr 4 attr2) tramp-time-dont-know) 3099 (setcar (nthcdr 4 attr2) tramp-time-dont-know)
@@ -3104,24 +3106,25 @@ They might differ only in time attributes or directory size."
3104 (tramp-compat-time-equal-p (nth 5 attr2) tramp-time-dont-know)) 3106 (tramp-compat-time-equal-p (nth 5 attr2) tramp-time-dont-know))
3105 (setcar (nthcdr 5 attr1) tramp-time-dont-know) 3107 (setcar (nthcdr 5 attr1) tramp-time-dont-know)
3106 (setcar (nthcdr 5 attr2) tramp-time-dont-know)) 3108 (setcar (nthcdr 5 attr2) tramp-time-dont-know))
3107 (when (time-less-p start-time (nth 5 attr1)) 3109 (when (<= start-time (floor (float-time (nth 5 attr1))))
3108 (setcar (nthcdr 5 attr1) tramp-time-dont-know)) 3110 (setcar (nthcdr 5 attr1) tramp-time-dont-know))
3109 (when (time-less-p start-time (nth 5 attr2)) 3111 (when (<= start-time (floor (float-time (nth 5 attr2))))
3110 (setcar (nthcdr 5 attr2) tramp-time-dont-know)) 3112 (setcar (nthcdr 5 attr2) tramp-time-dont-know))
3111 ;; Status change time. Dito. 3113 ;; Status change time. Dito.
3112 (when (or (tramp-compat-time-equal-p (nth 6 attr1) tramp-time-dont-know) 3114 (when (or (tramp-compat-time-equal-p (nth 6 attr1) tramp-time-dont-know)
3113 (tramp-compat-time-equal-p (nth 6 attr2) tramp-time-dont-know)) 3115 (tramp-compat-time-equal-p (nth 6 attr2) tramp-time-dont-know))
3114 (setcar (nthcdr 6 attr1) tramp-time-dont-know) 3116 (setcar (nthcdr 6 attr1) tramp-time-dont-know)
3115 (setcar (nthcdr 6 attr2) tramp-time-dont-know)) 3117 (setcar (nthcdr 6 attr2) tramp-time-dont-know))
3116 (when (time-less-p start-time (nth 6 attr1)) 3118 (when (<= start-time (floor (float-time (nth 6 attr1))))
3117 (setcar (nthcdr 6 attr1) tramp-time-dont-know)) 3119 (setcar (nthcdr 6 attr1) tramp-time-dont-know))
3118 (when (time-less-p start-time (nth 6 attr2)) 3120 (when (<= start-time (floor (float-time (nth 6 attr2))))
3119 (setcar (nthcdr 6 attr2) tramp-time-dont-know)) 3121 (setcar (nthcdr 6 attr2) tramp-time-dont-know))
3120 ;; Size. Set it to 0 for directories, because it might have 3122 ;; Size. Set it to 0 for directories, because it might have
3121 ;; changed. For example the upper directory "../". 3123 ;; changed. For example the upper directory "../".
3122 (when (eq (car attr1) t) (setcar (nthcdr 7 attr1) 0)) 3124 (when (eq (car attr1) t) (setcar (nthcdr 7 attr1) 0))
3123 (when (eq (car attr2) t) (setcar (nthcdr 7 attr2) 0)) 3125 (when (eq (car attr2) t) (setcar (nthcdr 7 attr2) 0))
3124 ;; The check. 3126 ;; The check.
3127 (unless (equal attr1 attr2) (tramp--test-message "%S\n%S" attr1 attr2))
3125 (equal attr1 attr2))) 3128 (equal attr1 attr2)))
3126 3129
3127;; This isn't 100% correct, but better than no explainer at all. 3130;; This isn't 100% correct, but better than no explainer at all.