aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2019-01-22 15:22:52 +0100
committerMichael Albinus2019-01-22 15:22:52 +0100
commit6038fdb2f9eac3225c0651fee18e1e75e63f2409 (patch)
treed610dd2760d53126ff19d0ae01728ff2c4b36489
parentc580081578edf8663e80cd86a1b4de377be58dc1 (diff)
downloademacs-6038fdb2f9eac3225c0651fee18e1e75e63f2409.tar.gz
emacs-6038fdb2f9eac3225c0651fee18e1e75e63f2409.zip
Make Tramp tests more robust
* test/lisp/net/tramp-tests.el (tramp-test06-directory-file-name): Bind `tramp-default-method'. (tramp--test-file-attributes-equal-p): New defsubst. (tramp-test19-directory-files-and-attributes): Use it.
-rw-r--r--test/lisp/net/tramp-tests.el19
1 files changed, 15 insertions, 4 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 28935062864..d4db4e9f642 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -2067,7 +2067,8 @@ This checks also `file-name-as-directory', `file-name-directory',
2067 ;; We must clear `tramp-default-method'. On hydra, it is "ftp", 2067 ;; We must clear `tramp-default-method'. On hydra, it is "ftp",
2068 ;; which ruins the tests. 2068 ;; which ruins the tests.
2069 (let ((non-essential n-e) 2069 (let ((non-essential n-e)
2070 tramp-default-method) 2070 (tramp-default-method
2071 (file-remote-p tramp-test-temporary-file-directory 'method)))
2071 (dolist 2072 (dolist
2072 (file 2073 (file
2073 `(,(format 2074 `(,(format
@@ -2964,6 +2965,13 @@ This tests also `file-readable-p', `file-regular-p' and
2964 (ignore-errors (delete-file tmp-name1)) 2965 (ignore-errors (delete-file tmp-name1))
2965 (ignore-errors (delete-file tmp-name2)))))) 2966 (ignore-errors (delete-file tmp-name2))))))
2966 2967
2968(defsubst tramp--test-file-attributes-equal-p (attr1 attr2)
2969 "Check, whether file attributes ATTR1 and ATTR2 are equal.
2970They might differ only in access time."
2971 (setcar (nthcdr 4 attr1) tramp-time-dont-know)
2972 (setcar (nthcdr 4 attr2) tramp-time-dont-know)
2973 (equal attr1 attr2))
2974
2967(ert-deftest tramp-test19-directory-files-and-attributes () 2975(ert-deftest tramp-test19-directory-files-and-attributes ()
2968 "Check `directory-files-and-attributes'." 2976 "Check `directory-files-and-attributes'."
2969 (skip-unless (tramp--test-enabled)) 2977 (skip-unless (tramp--test-enabled))
@@ -2995,14 +3003,16 @@ This tests also `file-readable-p', `file-regular-p' and
2995 5 (file-attributes (expand-file-name (car elt) tmp-name2))) 3003 5 (file-attributes (expand-file-name (car elt) tmp-name2)))
2996 tramp-time-dont-know) 3004 tramp-time-dont-know)
2997 (should 3005 (should
2998 (equal (file-attributes (expand-file-name (car elt) tmp-name2)) 3006 (tramp--test-file-attributes-equal-p
2999 (cdr elt))))) 3007 (file-attributes (expand-file-name (car elt) tmp-name2))
3008 (cdr elt)))))
3000 (setq attr (directory-files-and-attributes tmp-name2 'full)) 3009 (setq attr (directory-files-and-attributes tmp-name2 'full))
3001 (dolist (elt attr) 3010 (dolist (elt attr)
3002 (unless (tramp-compat-time-equal-p 3011 (unless (tramp-compat-time-equal-p
3003 (nth 5 (file-attributes (car elt))) tramp-time-dont-know) 3012 (nth 5 (file-attributes (car elt))) tramp-time-dont-know)
3004 (should 3013 (should
3005 (equal (file-attributes (car elt)) (cdr elt))))) 3014 (tramp--test-file-attributes-equal-p
3015 (file-attributes (car elt)) (cdr elt)))))
3006 (setq attr (directory-files-and-attributes tmp-name2 nil "^b")) 3016 (setq attr (directory-files-and-attributes tmp-name2 nil "^b"))
3007 (should (equal (mapcar 'car attr) '("bar" "boz")))) 3017 (should (equal (mapcar 'car attr) '("bar" "boz"))))
3008 3018
@@ -5564,6 +5574,7 @@ Since it unloads Tramp, it shall be the last test to run."
5564;; * file-equal-p (partly done in `tramp-test21-file-links') 5574;; * file-equal-p (partly done in `tramp-test21-file-links')
5565;; * file-in-directory-p 5575;; * file-in-directory-p
5566;; * file-name-case-insensitive-p 5576;; * file-name-case-insensitive-p
5577;; * tramp-set-file-uid-gid
5567 5578
5568;; * Work on skipped tests. Make a comment, when it is impossible. 5579;; * Work on skipped tests. Make a comment, when it is impossible.
5569;; * Revisit expensive tests, once problems in `tramp-error' are solved. 5580;; * Revisit expensive tests, once problems in `tramp-error' are solved.