diff options
| author | Michael Albinus | 2019-08-10 11:34:13 +0200 |
|---|---|---|
| committer | Michael Albinus | 2019-08-10 11:34:13 +0200 |
| commit | 2c5dd680180e978303662d3d32cc9aa5121b4d29 (patch) | |
| tree | 42fb085b4d73b7b2cfccaa76353d37115a40b5b6 | |
| parent | 7ff96f95d7d67fc1489fca9fd3ab4a99328a5b8a (diff) | |
| download | emacs-2c5dd680180e978303662d3d32cc9aa5121b4d29.tar.gz emacs-2c5dd680180e978303662d3d32cc9aa5121b4d29.zip | |
Use a time offset when comparing times of local and remote machines
* test/lisp/net/tramp-tests.el (tramp--test-file-attributes-equal-p):
Use a time offset in order to compensate different times on local
and remote machines.
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 7a1ae5273e9..095c145e69b 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -3089,11 +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 | (floor | 3092 | (- (float-time |
| 3093 | (float-time | 3093 | (aref |
| 3094 | (aref | 3094 | (ert--stats-test-start-times ert--current-run-stats) |
| 3095 | (ert--stats-test-start-times ert--current-run-stats) | 3095 | (ert--stats-test-pos ert--current-run-stats (ert-running-test)))) |
| 3096 | (ert--stats-test-pos ert--current-run-stats (ert-running-test))))))) | 3096 | 60))) |
| 3097 | ;; Access time. | 3097 | ;; Access time. |
| 3098 | (setcar (nthcdr 4 attr1) tramp-time-dont-know) | 3098 | (setcar (nthcdr 4 attr1) tramp-time-dont-know) |
| 3099 | (setcar (nthcdr 4 attr2) tramp-time-dont-know) | 3099 | (setcar (nthcdr 4 attr2) tramp-time-dont-know) |
| @@ -3101,23 +3101,25 @@ They might differ only in time attributes or directory size." | |||
| 3101 | ;; we cannot compare, and we normalize the time stamps. If the | 3101 | ;; we cannot compare, and we normalize the time stamps. If the |
| 3102 | ;; time value is newer than the test start time, normalize it, | 3102 | ;; time value is newer than the test start time, normalize it, |
| 3103 | ;; because due to caching the time stamps could differ slightly (a | 3103 | ;; because due to caching the time stamps could differ slightly (a |
| 3104 | ;; few seconds). | 3104 | ;; few seconds). We use a test start time minus 60 seconds, in |
| 3105 | ;; order to compensate a possible time offset on local and remote | ||
| 3106 | ;; machines. | ||
| 3105 | (when (or (tramp-compat-time-equal-p (nth 5 attr1) tramp-time-dont-know) | 3107 | (when (or (tramp-compat-time-equal-p (nth 5 attr1) tramp-time-dont-know) |
| 3106 | (tramp-compat-time-equal-p (nth 5 attr2) tramp-time-dont-know)) | 3108 | (tramp-compat-time-equal-p (nth 5 attr2) tramp-time-dont-know)) |
| 3107 | (setcar (nthcdr 5 attr1) tramp-time-dont-know) | 3109 | (setcar (nthcdr 5 attr1) tramp-time-dont-know) |
| 3108 | (setcar (nthcdr 5 attr2) tramp-time-dont-know)) | 3110 | (setcar (nthcdr 5 attr2) tramp-time-dont-know)) |
| 3109 | (when (<= start-time (floor (float-time (nth 5 attr1)))) | 3111 | (when (< start-time (float-time (nth 5 attr1))) |
| 3110 | (setcar (nthcdr 5 attr1) tramp-time-dont-know)) | 3112 | (setcar (nthcdr 5 attr1) tramp-time-dont-know)) |
| 3111 | (when (<= start-time (floor (float-time (nth 5 attr2)))) | 3113 | (when (< start-time (float-time (nth 5 attr2))) |
| 3112 | (setcar (nthcdr 5 attr2) tramp-time-dont-know)) | 3114 | (setcar (nthcdr 5 attr2) tramp-time-dont-know)) |
| 3113 | ;; Status change time. Dito. | 3115 | ;; Status change time. Dito. |
| 3114 | (when (or (tramp-compat-time-equal-p (nth 6 attr1) tramp-time-dont-know) | 3116 | (when (or (tramp-compat-time-equal-p (nth 6 attr1) tramp-time-dont-know) |
| 3115 | (tramp-compat-time-equal-p (nth 6 attr2) tramp-time-dont-know)) | 3117 | (tramp-compat-time-equal-p (nth 6 attr2) tramp-time-dont-know)) |
| 3116 | (setcar (nthcdr 6 attr1) tramp-time-dont-know) | 3118 | (setcar (nthcdr 6 attr1) tramp-time-dont-know) |
| 3117 | (setcar (nthcdr 6 attr2) tramp-time-dont-know)) | 3119 | (setcar (nthcdr 6 attr2) tramp-time-dont-know)) |
| 3118 | (when (<= start-time (floor (float-time (nth 6 attr1)))) | 3120 | (when (< start-time (float-time (nth 6 attr1))) |
| 3119 | (setcar (nthcdr 6 attr1) tramp-time-dont-know)) | 3121 | (setcar (nthcdr 6 attr1) tramp-time-dont-know)) |
| 3120 | (when (<= start-time (floor (float-time (nth 6 attr2)))) | 3122 | (when (< start-time (float-time (nth 6 attr2))) |
| 3121 | (setcar (nthcdr 6 attr2) tramp-time-dont-know)) | 3123 | (setcar (nthcdr 6 attr2) tramp-time-dont-know)) |
| 3122 | ;; Size. Set it to 0 for directories, because it might have | 3124 | ;; Size. Set it to 0 for directories, because it might have |
| 3123 | ;; changed. For example the upper directory "../". | 3125 | ;; changed. For example the upper directory "../". |