diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/net/tramp-archive-tests.el | 102 |
1 files changed, 58 insertions, 44 deletions
diff --git a/test/lisp/net/tramp-archive-tests.el b/test/lisp/net/tramp-archive-tests.el index bebdf108c66..e4ae1217002 100644 --- a/test/lisp/net/tramp-archive-tests.el +++ b/test/lisp/net/tramp-archive-tests.el | |||
| @@ -86,12 +86,18 @@ Some semantics has been changed for there, w/o new functions or | |||
| 86 | variables, so we check the Emacs version directly." | 86 | variables, so we check the Emacs version directly." |
| 87 | (>= emacs-major-version 26)) | 87 | (>= emacs-major-version 26)) |
| 88 | 88 | ||
| 89 | (defun tramp-archive--test-emacs27-p () | ||
| 90 | "Check for Emacs version >= 27.1. | ||
| 91 | Some semantics has been changed for there, w/o new functions or | ||
| 92 | variables, so we check the Emacs version directly." | ||
| 93 | (>= emacs-major-version 27)) | ||
| 94 | |||
| 89 | (ert-deftest tramp-archive-test00-availability () | 95 | (ert-deftest tramp-archive-test00-availability () |
| 90 | "Test availability of Tramp functions." | 96 | "Test availability of archive file name functions." |
| 91 | :expected-result (if tramp-gvfs-enabled :passed :failed) | 97 | :expected-result (if tramp-archive-enabled :passed :failed) |
| 92 | (should | 98 | (should |
| 93 | (and | 99 | (and |
| 94 | tramp-gvfs-enabled | 100 | tramp-archive-enabled |
| 95 | (file-exists-p tramp-archive-test-file-archive) | 101 | (file-exists-p tramp-archive-test-file-archive) |
| 96 | (tramp-archive-file-name-p tramp-archive-test-archive)))) | 102 | (tramp-archive-file-name-p tramp-archive-test-archive)))) |
| 97 | 103 | ||
| @@ -147,7 +153,7 @@ variables, so we check the Emacs version directly." | |||
| 147 | 153 | ||
| 148 | (ert-deftest tramp-archive-test02-file-name-dissect () | 154 | (ert-deftest tramp-archive-test02-file-name-dissect () |
| 149 | "Check archive file name components." | 155 | "Check archive file name components." |
| 150 | (skip-unless tramp-gvfs-enabled) | 156 | (skip-unless tramp-archive-enabled) |
| 151 | 157 | ||
| 152 | (with-parsed-tramp-archive-file-name tramp-archive-test-archive nil | 158 | (with-parsed-tramp-archive-file-name tramp-archive-test-archive nil |
| 153 | (should (string-equal method tramp-archive-method)) | 159 | (should (string-equal method tramp-archive-method)) |
| @@ -266,7 +272,7 @@ They shall still be supported" | |||
| 266 | "Check `directory-file-name'. | 272 | "Check `directory-file-name'. |
| 267 | This checks also `file-name-as-directory', `file-name-directory', | 273 | This checks also `file-name-as-directory', `file-name-directory', |
| 268 | `file-name-nondirectory' and `unhandled-file-name-directory'." | 274 | `file-name-nondirectory' and `unhandled-file-name-directory'." |
| 269 | (skip-unless tramp-gvfs-enabled) | 275 | (skip-unless tramp-archive-enabled) |
| 270 | 276 | ||
| 271 | (should | 277 | (should |
| 272 | (string-equal | 278 | (string-equal |
| @@ -305,7 +311,7 @@ This checks also `file-name-as-directory', `file-name-directory', | |||
| 305 | 311 | ||
| 306 | (ert-deftest tramp-archive-test07-file-exists-p () | 312 | (ert-deftest tramp-archive-test07-file-exists-p () |
| 307 | "Check `file-exist-p', `write-region' and `delete-file'." | 313 | "Check `file-exist-p', `write-region' and `delete-file'." |
| 308 | (skip-unless tramp-gvfs-enabled) | 314 | (skip-unless tramp-archive-enabled) |
| 309 | 315 | ||
| 310 | (unwind-protect | 316 | (unwind-protect |
| 311 | (let ((default-directory tramp-archive-test-archive)) | 317 | (let ((default-directory tramp-archive-test-archive)) |
| @@ -327,7 +333,7 @@ This checks also `file-name-as-directory', `file-name-directory', | |||
| 327 | 333 | ||
| 328 | (ert-deftest tramp-archive-test08-file-local-copy () | 334 | (ert-deftest tramp-archive-test08-file-local-copy () |
| 329 | "Check `file-local-copy'." | 335 | "Check `file-local-copy'." |
| 330 | (skip-unless tramp-gvfs-enabled) | 336 | (skip-unless tramp-archive-enabled) |
| 331 | 337 | ||
| 332 | (let (tmp-name) | 338 | (let (tmp-name) |
| 333 | (unwind-protect | 339 | (unwind-protect |
| @@ -353,7 +359,7 @@ This checks also `file-name-as-directory', `file-name-directory', | |||
| 353 | 359 | ||
| 354 | (ert-deftest tramp-archive-test09-insert-file-contents () | 360 | (ert-deftest tramp-archive-test09-insert-file-contents () |
| 355 | "Check `insert-file-contents'." | 361 | "Check `insert-file-contents'." |
| 356 | (skip-unless tramp-gvfs-enabled) | 362 | (skip-unless tramp-archive-enabled) |
| 357 | 363 | ||
| 358 | (let ((tmp-name (expand-file-name "bar/bar" tramp-archive-test-archive))) | 364 | (let ((tmp-name (expand-file-name "bar/bar" tramp-archive-test-archive))) |
| 359 | (unwind-protect | 365 | (unwind-protect |
| @@ -379,7 +385,7 @@ This checks also `file-name-as-directory', `file-name-directory', | |||
| 379 | 385 | ||
| 380 | (ert-deftest tramp-archive-test11-copy-file () | 386 | (ert-deftest tramp-archive-test11-copy-file () |
| 381 | "Check `copy-file'." | 387 | "Check `copy-file'." |
| 382 | (skip-unless tramp-gvfs-enabled) | 388 | (skip-unless tramp-archive-enabled) |
| 383 | 389 | ||
| 384 | ;; Copy simple file. | 390 | ;; Copy simple file. |
| 385 | (let ((tmp-name1 (expand-file-name "bar/bar" tramp-archive-test-archive)) | 391 | (let ((tmp-name1 (expand-file-name "bar/bar" tramp-archive-test-archive)) |
| @@ -444,7 +450,7 @@ This checks also `file-name-as-directory', `file-name-directory', | |||
| 444 | 450 | ||
| 445 | (ert-deftest tramp-archive-test15-copy-directory () | 451 | (ert-deftest tramp-archive-test15-copy-directory () |
| 446 | "Check `copy-directory'." | 452 | "Check `copy-directory'." |
| 447 | (skip-unless tramp-gvfs-enabled) | 453 | (skip-unless tramp-archive-enabled) |
| 448 | 454 | ||
| 449 | (let* ((tmp-name1 (expand-file-name "bar" tramp-archive-test-archive)) | 455 | (let* ((tmp-name1 (expand-file-name "bar" tramp-archive-test-archive)) |
| 450 | (tmp-name2 (tramp-archive--test-make-temp-name)) | 456 | (tmp-name2 (tramp-archive--test-make-temp-name)) |
| @@ -498,7 +504,7 @@ This checks also `file-name-as-directory', `file-name-directory', | |||
| 498 | 504 | ||
| 499 | (ert-deftest tramp-archive-test16-directory-files () | 505 | (ert-deftest tramp-archive-test16-directory-files () |
| 500 | "Check `directory-files'." | 506 | "Check `directory-files'." |
| 501 | (skip-unless tramp-gvfs-enabled) | 507 | (skip-unless tramp-archive-enabled) |
| 502 | 508 | ||
| 503 | (let ((tmp-name tramp-archive-test-archive) | 509 | (let ((tmp-name tramp-archive-test-archive) |
| 504 | (files '("." ".." "bar" "baz.tar" "foo.hrd" "foo.lnk" "foo.txt"))) | 510 | (files '("." ".." "bar" "baz.tar" "foo.hrd" "foo.lnk" "foo.txt"))) |
| @@ -521,7 +527,7 @@ This checks also `file-name-as-directory', `file-name-directory', | |||
| 521 | 527 | ||
| 522 | (ert-deftest tramp-archive-test17-insert-directory () | 528 | (ert-deftest tramp-archive-test17-insert-directory () |
| 523 | "Check `insert-directory'." | 529 | "Check `insert-directory'." |
| 524 | (skip-unless tramp-gvfs-enabled) | 530 | (skip-unless tramp-archive-enabled) |
| 525 | 531 | ||
| 526 | (let (;; We test for the summary line. Keyword "total" could be localized. | 532 | (let (;; We test for the summary line. Keyword "total" could be localized. |
| 527 | (process-environment | 533 | (process-environment |
| @@ -563,7 +569,7 @@ This checks also `file-name-as-directory', `file-name-directory', | |||
| 563 | (ert-deftest tramp-archive-test18-file-attributes () | 569 | (ert-deftest tramp-archive-test18-file-attributes () |
| 564 | "Check `file-attributes'. | 570 | "Check `file-attributes'. |
| 565 | This tests also `file-readable-p' and `file-regular-p'." | 571 | This tests also `file-readable-p' and `file-regular-p'." |
| 566 | (skip-unless tramp-gvfs-enabled) | 572 | (skip-unless tramp-archive-enabled) |
| 567 | 573 | ||
| 568 | (let ((tmp-name1 (expand-file-name "foo.txt" tramp-archive-test-archive)) | 574 | (let ((tmp-name1 (expand-file-name "foo.txt" tramp-archive-test-archive)) |
| 569 | (tmp-name2 (expand-file-name "foo.lnk" tramp-archive-test-archive)) | 575 | (tmp-name2 (expand-file-name "foo.lnk" tramp-archive-test-archive)) |
| @@ -613,7 +619,7 @@ This tests also `file-readable-p' and `file-regular-p'." | |||
| 613 | 619 | ||
| 614 | (ert-deftest tramp-archive-test19-directory-files-and-attributes () | 620 | (ert-deftest tramp-archive-test19-directory-files-and-attributes () |
| 615 | "Check `directory-files-and-attributes'." | 621 | "Check `directory-files-and-attributes'." |
| 616 | (skip-unless tramp-gvfs-enabled) | 622 | (skip-unless tramp-archive-enabled) |
| 617 | 623 | ||
| 618 | (let ((tmp-name (expand-file-name "bar" tramp-archive-test-archive)) | 624 | (let ((tmp-name (expand-file-name "bar" tramp-archive-test-archive)) |
| 619 | attr) | 625 | attr) |
| @@ -638,7 +644,7 @@ This tests also `file-readable-p' and `file-regular-p'." | |||
| 638 | (ert-deftest tramp-archive-test20-file-modes () | 644 | (ert-deftest tramp-archive-test20-file-modes () |
| 639 | "Check `file-modes'. | 645 | "Check `file-modes'. |
| 640 | This tests also `file-executable-p', `file-writable-p' and `set-file-modes'." | 646 | This tests also `file-executable-p', `file-writable-p' and `set-file-modes'." |
| 641 | (skip-unless tramp-gvfs-enabled) | 647 | (skip-unless tramp-archive-enabled) |
| 642 | 648 | ||
| 643 | (let ((tmp-name1 (expand-file-name "foo.txt" tramp-archive-test-archive)) | 649 | (let ((tmp-name1 (expand-file-name "foo.txt" tramp-archive-test-archive)) |
| 644 | (tmp-name2 (expand-file-name "bar" tramp-archive-test-archive))) | 650 | (tmp-name2 (expand-file-name "bar" tramp-archive-test-archive))) |
| @@ -667,7 +673,7 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'." | |||
| 667 | 673 | ||
| 668 | (ert-deftest tramp-archive-test21-file-links () | 674 | (ert-deftest tramp-archive-test21-file-links () |
| 669 | "Check `file-symlink-p' and `file-truename'" | 675 | "Check `file-symlink-p' and `file-truename'" |
| 670 | (skip-unless tramp-gvfs-enabled) | 676 | (skip-unless tramp-archive-enabled) |
| 671 | 677 | ||
| 672 | ;; We must use `file-truename' for the file archive, because it | 678 | ;; We must use `file-truename' for the file archive, because it |
| 673 | ;; could be located on a symlinked directory. This would let the | 679 | ;; could be located on a symlinked directory. This would let the |
| @@ -705,7 +711,7 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'." | |||
| 705 | 711 | ||
| 706 | (ert-deftest tramp-archive-test26-file-name-completion () | 712 | (ert-deftest tramp-archive-test26-file-name-completion () |
| 707 | "Check `file-name-completion' and `file-name-all-completions'." | 713 | "Check `file-name-completion' and `file-name-all-completions'." |
| 708 | (skip-unless tramp-gvfs-enabled) | 714 | (skip-unless tramp-archive-enabled) |
| 709 | 715 | ||
| 710 | (let ((tmp-name tramp-archive-test-archive)) | 716 | (let ((tmp-name tramp-archive-test-archive)) |
| 711 | (unwind-protect | 717 | (unwind-protect |
| @@ -744,7 +750,7 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'." | |||
| 744 | ;; The functions were introduced in Emacs 26.1. | 750 | ;; The functions were introduced in Emacs 26.1. |
| 745 | (ert-deftest tramp-archive-test37-make-nearby-temp-file () | 751 | (ert-deftest tramp-archive-test37-make-nearby-temp-file () |
| 746 | "Check `make-nearby-temp-file' and `temporary-file-directory'." | 752 | "Check `make-nearby-temp-file' and `temporary-file-directory'." |
| 747 | (skip-unless tramp-gvfs-enabled) | 753 | (skip-unless tramp-archive-enabled) |
| 748 | ;; Since Emacs 26.1. | 754 | ;; Since Emacs 26.1. |
| 749 | (skip-unless | 755 | (skip-unless |
| 750 | (and (fboundp 'make-nearby-temp-file) (fboundp 'temporary-file-directory))) | 756 | (and (fboundp 'make-nearby-temp-file) (fboundp 'temporary-file-directory))) |
| @@ -781,7 +787,7 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'." | |||
| 781 | 787 | ||
| 782 | (ert-deftest tramp-archive-test40-file-system-info () | 788 | (ert-deftest tramp-archive-test40-file-system-info () |
| 783 | "Check that `file-system-info' returns proper values." | 789 | "Check that `file-system-info' returns proper values." |
| 784 | (skip-unless tramp-gvfs-enabled) | 790 | (skip-unless tramp-archive-enabled) |
| 785 | ;; Since Emacs 27.1. | 791 | ;; Since Emacs 27.1. |
| 786 | (skip-unless (fboundp 'file-system-info)) | 792 | (skip-unless (fboundp 'file-system-info)) |
| 787 | 793 | ||
| @@ -798,7 +804,9 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'." | |||
| 798 | 804 | ||
| 799 | (ert-deftest tramp-archive-test42-auto-load () | 805 | (ert-deftest tramp-archive-test42-auto-load () |
| 800 | "Check that `tramp-archive' autoloads properly." | 806 | "Check that `tramp-archive' autoloads properly." |
| 801 | (skip-unless tramp-gvfs-enabled) | 807 | (skip-unless tramp-archive-enabled) |
| 808 | ;; Autoloading tramp-archive works since Emacs 27.1. | ||
| 809 | (skip-unless (tramp-archive--test-emacs27-p)) | ||
| 802 | 810 | ||
| 803 | (let ((default-directory (expand-file-name temporary-file-directory)) | 811 | (let ((default-directory (expand-file-name temporary-file-directory)) |
| 804 | (code | 812 | (code |
| @@ -818,38 +826,44 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'." | |||
| 818 | 826 | ||
| 819 | (ert-deftest tramp-archive-test42-delay-load () | 827 | (ert-deftest tramp-archive-test42-delay-load () |
| 820 | "Check that `tramp-archive' is loaded lazily, only when needed." | 828 | "Check that `tramp-archive' is loaded lazily, only when needed." |
| 821 | (skip-unless tramp-gvfs-enabled) | 829 | (skip-unless tramp-archive-enabled) |
| 830 | ;; Autoloading tramp-archive works since Emacs 27.1. | ||
| 831 | (skip-unless (tramp-archive--test-emacs27-p)) | ||
| 822 | 832 | ||
| 823 | ;; Tramp is neither loaded at Emacs startup, nor when completing a | 833 | ;; tramp-archive is neither loaded at Emacs startup, nor when |
| 824 | ;; non archive file name like "/foo". Completing an archive file | 834 | ;; loading a file like "/foo.tar". It is loaded only when |
| 825 | ;; name like "/foo.tar/" autoloads Tramp, when `tramp-mode' is t. | 835 | ;; `tramp-archive-enabled' is t. |
| 826 | (let ((default-directory (expand-file-name temporary-file-directory)) | 836 | (let ((default-directory (expand-file-name temporary-file-directory)) |
| 827 | (code | 837 | (code |
| 838 | "(progn \ | ||
| 839 | (setq tramp-archive-enabled %s) \ | ||
| 840 | (message \"Tramp loaded: %%s\" (featurep 'tramp-archive)) \ | ||
| 841 | (find-file %S \"/\") \ | ||
| 842 | (message \"Tramp loaded: %%s\" (featurep 'tramp-archive)) \ | ||
| 843 | (file-attributes %S \"/\") \ | ||
| 844 | (message \"Tramp loaded: %%s\" (featurep 'tramp-archive)))")) | ||
| 845 | ;; tramp-archive doesn't load when `tramp-archive-enabled' is nil. | ||
| 846 | (dolist (tae '(t nil)) | ||
| 847 | (should | ||
| 848 | (string-match | ||
| 849 | (format | ||
| 850 | "Tramp loaded: nil[[:ascii:]]+Tramp loaded: nil[[:ascii:]]+Tramp loaded: %s" | ||
| 851 | tae) | ||
| 852 | (shell-command-to-string | ||
| 828 | (format | 853 | (format |
| 829 | "(progn \ | 854 | "%s -batch -Q -L %s --eval %s" |
| 830 | (message \"Tramp loaded: %%s\" (featurep 'tramp-archive)) \ | 855 | (shell-quote-argument |
| 831 | (file-name-all-completions %S \"/\") \ | 856 | (expand-file-name invocation-name invocation-directory)) |
| 832 | (message \"Tramp loaded: %%s\" (featurep 'tramp-archive)) \ | 857 | (mapconcat 'shell-quote-argument load-path " -L ") |
| 833 | (file-name-all-completions %S \"/\") \ | 858 | (shell-quote-argument |
| 834 | (message \"Tramp loaded: %%s\" (featurep 'tramp-archive)))" | 859 | (format |
| 835 | tramp-archive-test-file-archive | 860 | code tae tramp-archive-test-file-archive |
| 836 | tramp-archive-test-archive))) | 861 | (concat tramp-archive-test-archive "foo")))))))))) |
| 837 | ;; Tramp doesn't load when `tramp-mode' is nil. | ||
| 838 | (should | ||
| 839 | (string-match | ||
| 840 | "Tramp loaded: nil[\n\r]+Tramp loaded: nil[\n\r]+Tramp loaded: t[\n\r]+" | ||
| 841 | (shell-command-to-string | ||
| 842 | (format | ||
| 843 | "%s -batch -Q -L %s --eval %s" | ||
| 844 | (shell-quote-argument | ||
| 845 | (expand-file-name invocation-name invocation-directory)) | ||
| 846 | (mapconcat 'shell-quote-argument load-path " -L ") | ||
| 847 | (shell-quote-argument code))))))) | ||
| 848 | 862 | ||
| 849 | (ert-deftest tramp-archive-test99-libarchive-tests () | 863 | (ert-deftest tramp-archive-test99-libarchive-tests () |
| 850 | "Run tests of libarchive test files." | 864 | "Run tests of libarchive test files." |
| 851 | :tags '(:expensive-test) | 865 | :tags '(:expensive-test) |
| 852 | (skip-unless tramp-gvfs-enabled) | 866 | (skip-unless tramp-archive-enabled) |
| 853 | ;; We do not want to run unless chosen explicitly. This test makes | 867 | ;; We do not want to run unless chosen explicitly. This test makes |
| 854 | ;; sense only in my local environment. Michael Albinus. | 868 | ;; sense only in my local environment. Michael Albinus. |
| 855 | (skip-unless | 869 | (skip-unless |