From c67407e7520a97a92737200bf559c48a927db470 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Wed, 25 Jul 2018 13:18:46 +0200 Subject: [PATCH] Instrument shadowfile{-tests} for error hunting on hydra. * lisp/shadowfile.el (shadow-make-fullname): Use changed `tramp-make-tramp-file-name' from Tramp 2.4. * test/lisp/shadowfile-tests.el (shadow-test08-shadow-todo): Instrument test. Suppress errors in cleanup. (shadow-test09-shadow-copy-files): Suppress errors in cleanup. --- lisp/shadowfile.el | 9 +-------- test/lisp/shadowfile-tests.el | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/lisp/shadowfile.el b/lisp/shadowfile.el index 27d934d9fce..180d5026b6e 100644 --- a/lisp/shadowfile.el +++ b/lisp/shadowfile.el @@ -307,14 +307,7 @@ Replace HOST, and NAME when non-nil." (if (null (tramp-file-name-method hup)) (format "/%s:%s" (tramp-file-name-host hup) (tramp-file-name-localname hup)) - (tramp-make-tramp-file-name - (tramp-file-name-method hup) - (tramp-file-name-user hup) - (tramp-file-name-domain hup) - (tramp-file-name-host hup) - (tramp-file-name-port hup) - (tramp-file-name-localname hup) - (tramp-file-name-hop hup))))) + (tramp-make-tramp-file-name hup)))) (defun shadow-replace-name-component (fullname newname) "Return FULLNAME with the name component changed to NEWNAME." diff --git a/test/lisp/shadowfile-tests.el b/test/lisp/shadowfile-tests.el index 200fb4c58c6..c38d49e61f2 100644 --- a/test/lisp/shadowfile-tests.el +++ b/test/lisp/shadowfile-tests.el @@ -696,6 +696,7 @@ guaranteed by the originator of a cluster definition." shadow-files-to-copy cluster1 cluster2 primary regexp file) (unwind-protect + (condition-case err (progn ;; Cleanup. (when (file-exists-p shadow-info-file) @@ -773,16 +774,19 @@ guaranteed by the originator of a cluster definition." (concat (shadow-site-primary cluster2) file) (shadow-contract-file-name (concat "/cluster1:" file))) shadow-files-to-copy))) + (error (message "Error: %s" err) (signal (car err) (cdr err)))) ;; Cleanup. (when (file-exists-p shadow-info-file) (delete-file shadow-info-file)) (when (file-exists-p shadow-todo-file) (delete-file shadow-todo-file)) - (when (file-exists-p file) - (delete-file file)) - (when (file-exists-p (concat (shadow-site-primary cluster2) file)) - (delete-file (concat (shadow-site-primary cluster2) file)))))) + (ignore-errors + (when (file-exists-p file) + (delete-file file))) + (ignore-errors + (when (file-exists-p (concat (shadow-site-primary cluster2) file)) + (delete-file (concat (shadow-site-primary cluster2) file))))))) (ert-deftest shadow-test09-shadow-copy-files () "Check that needed shadow files are copied." @@ -864,10 +868,12 @@ guaranteed by the originator of a cluster definition." (delete-file shadow-info-file)) (when (file-exists-p shadow-todo-file) (delete-file shadow-todo-file)) - (when (file-exists-p file) - (delete-file file)) - (when (file-exists-p (concat (shadow-site-primary cluster2) file)) - (delete-file (concat (shadow-site-primary cluster2) file)))))) + (ignore-errors + (when (file-exists-p file) + (delete-file file))) + (ignore-errors + (when (file-exists-p (concat (shadow-site-primary cluster2) file)) + (delete-file (concat (shadow-site-primary cluster2) file))))))) (defun shadowfile-test-all (&optional interactive) "Run all tests for \\[shadowfile]." -- 2.39.2