emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 6038fdb: Make Tramp tests more robust


From: Michael Albinus
Subject: [Emacs-diffs] master 6038fdb: Make Tramp tests more robust
Date: Tue, 22 Jan 2019 09:23:03 -0500 (EST)

branch: master
commit 6038fdb2f9eac3225c0651fee18e1e75e63f2409
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    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.
---
 test/lisp/net/tramp-tests.el | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 2893506..d4db4e9 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',
       ;; We must clear `tramp-default-method'.  On hydra, it is "ftp",
       ;; which ruins the tests.
       (let ((non-essential n-e)
-           tramp-default-method)
+           (tramp-default-method
+            (file-remote-p tramp-test-temporary-file-directory 'method)))
        (dolist
            (file
             `(,(format
@@ -2964,6 +2965,13 @@ This tests also `file-readable-p', `file-regular-p' and
        (ignore-errors (delete-file tmp-name1))
        (ignore-errors (delete-file tmp-name2))))))
 
+(defsubst tramp--test-file-attributes-equal-p (attr1 attr2)
+  "Check, whether file attributes ATTR1 and ATTR2 are equal.
+They might differ only in access time."
+  (setcar (nthcdr 4 attr1) tramp-time-dont-know)
+  (setcar (nthcdr 4 attr2) tramp-time-dont-know)
+  (equal attr1 attr2))
+
 (ert-deftest tramp-test19-directory-files-and-attributes ()
   "Check `directory-files-and-attributes'."
   (skip-unless (tramp--test-enabled))
@@ -2995,14 +3003,16 @@ This tests also `file-readable-p', `file-regular-p' and
                    5 (file-attributes (expand-file-name (car elt) tmp-name2)))
                   tramp-time-dont-know)
                (should
-                (equal (file-attributes (expand-file-name (car elt) tmp-name2))
-                       (cdr elt)))))
+                (tramp--test-file-attributes-equal-p
+                 (file-attributes (expand-file-name (car elt) tmp-name2))
+                 (cdr elt)))))
            (setq attr (directory-files-and-attributes tmp-name2 'full))
            (dolist (elt attr)
              (unless (tramp-compat-time-equal-p
                       (nth 5 (file-attributes (car elt))) tramp-time-dont-know)
                (should
-                (equal (file-attributes (car elt)) (cdr elt)))))
+                (tramp--test-file-attributes-equal-p
+                 (file-attributes (car elt)) (cdr elt)))))
            (setq attr (directory-files-and-attributes tmp-name2 nil "^b"))
            (should (equal (mapcar 'car attr) '("bar" "boz"))))
 
@@ -5564,6 +5574,7 @@ Since it unloads Tramp, it shall be the last test to run."
 ;; * file-equal-p (partly done in `tramp-test21-file-links')
 ;; * file-in-directory-p
 ;; * file-name-case-insensitive-p
+;; * tramp-set-file-uid-gid
 
 ;; * Work on skipped tests.  Make a comment, when it is impossible.
 ;; * Revisit expensive tests, once problems in `tramp-error' are solved.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]