diff options
author | Michael Albinus <michael.albinus@gmx.de> | 2022-05-05 09:54:31 +0200 |
---|---|---|
committer | Michael Albinus <michael.albinus@gmx.de> | 2022-05-05 09:54:31 +0200 |
commit | c242a38b7d9d00d5441fc926b24193246bd63746 (patch) | |
tree | 7fb7271885d49e1f261afb213c68056717cd6c80 | |
parent | 8f391ae26eab6654360f621acaeb2bc0935e3d32 (diff) | |
download | emacs-c242a38b7d9d00d5441fc926b24193246bd63746.tar.gz |
Add Tramp test
* test/lisp/net/tramp-tests.el (tar-mode): Require.
(tramp-test10-write-region-other-file-name-handler): New test.
(tramp-test31-interrupt-process, tramp-test31-signal-process):
Tag them :unstable unconditionally.
* test/lisp/net/tramp-resources/foo.tar.gz: New resource file.
-rw-r--r-- | test/lisp/net/tramp-resources/foo.tar.gz | bin | 0 -> 274 bytes | |||
-rw-r--r-- | test/lisp/net/tramp-tests.el | 60 |
2 files changed, 50 insertions, 10 deletions
diff --git a/test/lisp/net/tramp-resources/foo.tar.gz b/test/lisp/net/tramp-resources/foo.tar.gz Binary files differnew file mode 100644 index 00000000000..0d2e9878dd7 --- /dev/null +++ b/test/lisp/net/tramp-resources/foo.tar.gz diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index d8709709457..2d2bef732e0 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -47,6 +47,7 @@ (require 'ert) (require 'ert-x) (require 'seq) ; For `seq-random-elt', autoloaded since Emacs 28.1 +(require 'tar-mode) (require 'trace) (require 'tramp) (require 'vc) @@ -2511,6 +2512,48 @@ This checks also `file-name-as-directory', `file-name-directory', (ignore-errors (advice-remove 'write-region advice)) (ignore-errors (delete-file tmp-name))))) +;; The following test is inspired by Bug#55166. +(ert-deftest tramp-test10-write-region-other-file-name-handler () + "Check that another file name handler in VISIT is acknowledged." + (skip-unless (tramp--test-enabled)) + (skip-unless (not (tramp--test-ange-ftp-p))) + (skip-unless (executable-find "gzip")) + + (let* ((default-directory tramp-test-temporary-file-directory) + (archive (ert-resource-file "foo.tar.gz")) + (tmp-file (expand-file-name (file-name-nondirectory archive))) + (require-final-newline t) + (inhibit-message t) + (backup-inhibited t) + create-lockfiles buffer1 buffer2) + (unwind-protect + (progn + (copy-file archive tmp-file 'ok) + ;; Read archive. Check contents of foo.txt, and modify it. Save. + (with-current-buffer (setq buffer1 (find-file-noselect tmp-file)) + (should (tar-goto-file "foo.txt")) + (save-current-buffer + (setq buffer2 (tar-extract)) + (should (string-equal (buffer-string) "foo\n")) + (goto-char (point-max)) + (insert "bar") + (should (null (save-buffer)))) + (should (null (save-buffer)))) + + (kill-buffer buffer1) + (kill-buffer buffer2) + ;; Read archive. Check contents of modified foo.txt. + (with-current-buffer (setq buffer1 (find-file-noselect tmp-file)) + (should (tar-goto-file "foo.txt")) + (save-current-buffer + (setq buffer2 (tar-extract)) + (should (string-equal (buffer-string) "foo\nbar\n"))))) + + ;; Cleanup. + (ignore-errors (kill-buffer buffer1)) + (ignore-errors (kill-buffer buffer2)) + (ignore-errors (delete-file tmp-file))))) + (ert-deftest tramp-test11-copy-file () "Check `copy-file'." (skip-unless (tramp--test-enabled)) @@ -4984,10 +5027,8 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'." (ert-deftest tramp-test31-interrupt-process () "Check `interrupt-process'." - :tags (append '(:expensive-test :tramp-asynchronous-processes) - ;; The final `process-live-p' check does not run sufficiently. - (and (or (getenv "EMACS_HYDRA_CI") (getenv "EMACS_EMBA_CI")) - '(:unstable))) + ;; The final `process-live-p' check does not run sufficiently. + :tags '(:expensive-test :tramp-asynchronous-processes :unstable) (skip-unless (tramp--test-enabled)) (skip-unless (tramp--test-sh-p)) (skip-unless (not (tramp--test-crypt-p))) @@ -5026,10 +5067,8 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'." (ert-deftest tramp-test31-signal-process () "Check `signal-process'." - :tags (append '(:expensive-test :tramp-asynchronous-processes) - ;; The final `process-live-p' check does not run sufficiently. - (and (or (getenv "EMACS_HYDRA_CI") (getenv "EMACS_EMBA_CI")) - '(:unstable))) + ;; The final `process-live-p' check does not run sufficiently. + :tags '(:expensive-test :tramp-asynchronous-processes :unstable) (skip-unless (tramp--test-enabled)) (skip-unless (tramp--test-sh-p)) (skip-unless (not (tramp--test-crypt-p))) @@ -7563,8 +7602,9 @@ If INTERACTIVE is non-nil, the tests are run interactively." ;; * Work on skipped tests. Make a comment, when it is impossible. ;; * Revisit expensive tests, once problems in `tramp-error' are solved. ;; * Fix `tramp-test06-directory-file-name' for "ftp". -;; * Implement `tramp-test31-interrupt-process' for "adb", "sshfs" and -;; for direct async processes. +;; * Implement `tramp-test31-interrupt-process' and +;; `tramp-test31-signal-process' for "adb", "sshfs" and for direct +;; async processes. Check, why they don't run stable. ;; * Check, why direct async processes do not work for ;; `tramp-test44-asynchronous-requests'. |