diff options
| author | Michael Albinus | 2019-01-07 17:07:19 +0100 |
|---|---|---|
| committer | Michael Albinus | 2019-01-07 17:07:19 +0100 |
| commit | 13b586d7a7020ad3d28ccd980663586dfb8552b1 (patch) | |
| tree | b3800795156e20fc8ede47a17ac0f7334bc50cfb /test | |
| parent | d8525ae41d07f9ea629d610de791064180423b6a (diff) | |
| download | emacs-13b586d7a7020ad3d28ccd980663586dfb8552b1.tar.gz emacs-13b586d7a7020ad3d28ccd980663586dfb8552b1.zip | |
Adapt filenotify-tests for emba
* .gitlab-ci.yml (test): Add EMACS_EMBA_CI variable.
* test/lisp/filenotify-tests.el (file-notify-test03-events)
(file-notify-test05-file-validity)
(file-notify-test06-dir-validity)
(file-notify-test07-many-events)
(file-notify-test09-watched-file-in-watched-dir): Adapt tests for emba.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/filenotify-tests.el | 123 |
1 files changed, 74 insertions, 49 deletions
diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el index 341c5afd6d5..4e1a46285c6 100644 --- a/test/lisp/filenotify-tests.el +++ b/test/lisp/filenotify-tests.el | |||
| @@ -649,6 +649,10 @@ delivered." | |||
| 649 | '(created deleted stopped)) | 649 | '(created deleted stopped)) |
| 650 | ((string-equal (file-notify--test-library) "kqueue") | 650 | ((string-equal (file-notify--test-library) "kqueue") |
| 651 | '(created changed deleted stopped)) | 651 | '(created changed deleted stopped)) |
| 652 | ;; On emba, `deleted' and `stopped' events of the | ||
| 653 | ;; directory are not detected. | ||
| 654 | ((getenv "EMACS_EMBA_CI") | ||
| 655 | '(created changed deleted)) | ||
| 652 | (t '(created changed deleted deleted stopped))) | 656 | (t '(created changed deleted deleted stopped))) |
| 653 | (write-region | 657 | (write-region |
| 654 | "any text" nil file-notify--test-tmpfile nil 'no-message) | 658 | "any text" nil file-notify--test-tmpfile nil 'no-message) |
| @@ -687,6 +691,10 @@ delivered." | |||
| 687 | '(created created changed changed deleted stopped)) | 691 | '(created created changed changed deleted stopped)) |
| 688 | ((string-equal (file-notify--test-library) "kqueue") | 692 | ((string-equal (file-notify--test-library) "kqueue") |
| 689 | '(created changed created changed deleted stopped)) | 693 | '(created changed created changed deleted stopped)) |
| 694 | ;; On emba, `deleted' and `stopped' events of the | ||
| 695 | ;; directory are not detected. | ||
| 696 | ((getenv "EMACS_EMBA_CI") | ||
| 697 | '(created changed created changed deleted deleted)) | ||
| 690 | (t '(created changed created changed | 698 | (t '(created changed created changed |
| 691 | deleted deleted deleted stopped))) | 699 | deleted deleted deleted stopped))) |
| 692 | (write-region | 700 | (write-region |
| @@ -732,6 +740,10 @@ delivered." | |||
| 732 | '(created created deleted deleted stopped)) | 740 | '(created created deleted deleted stopped)) |
| 733 | ((string-equal (file-notify--test-library) "kqueue") | 741 | ((string-equal (file-notify--test-library) "kqueue") |
| 734 | '(created changed renamed deleted stopped)) | 742 | '(created changed renamed deleted stopped)) |
| 743 | ;; On emba, `deleted' and `stopped' events of the | ||
| 744 | ;; directory are not detected. | ||
| 745 | ((getenv "EMACS_EMBA_CI") | ||
| 746 | '(created changed renamed deleted)) | ||
| 735 | (t '(created changed renamed deleted deleted stopped))) | 747 | (t '(created changed renamed deleted deleted stopped))) |
| 736 | (write-region | 748 | (write-region |
| 737 | "any text" nil file-notify--test-tmpfile nil 'no-message) | 749 | "any text" nil file-notify--test-tmpfile nil 'no-message) |
| @@ -940,51 +952,55 @@ delivered." | |||
| 940 | (file-notify--test-cleanup)) | 952 | (file-notify--test-cleanup)) |
| 941 | 953 | ||
| 942 | (unwind-protect | 954 | (unwind-protect |
| 943 | (let ((file-notify--test-tmpdir | 955 | ;; On emba, `deleted' and `stopped' events of the directory are |
| 944 | (make-temp-file "file-notify-test-parent" t))) | 956 | ;; not detected. |
| 945 | (should | 957 | (unless (getenv "EMACS_EMBA_CI") |
| 946 | (setq file-notify--test-tmpfile (file-notify--test-make-temp-name) | 958 | (let ((file-notify--test-tmpdir |
| 947 | file-notify--test-desc | 959 | (make-temp-file "file-notify-test-parent" t))) |
| 948 | (file-notify-add-watch | 960 | (should |
| 949 | file-notify--test-tmpdir | 961 | (setq file-notify--test-tmpfile (file-notify--test-make-temp-name) |
| 950 | '(change) #'file-notify--test-event-handler))) | 962 | file-notify--test-desc |
| 951 | (should (file-notify-valid-p file-notify--test-desc)) | 963 | (file-notify-add-watch |
| 952 | (file-notify--test-with-events | 964 | file-notify--test-tmpdir |
| 953 | (cond | 965 | '(change) #'file-notify--test-event-handler))) |
| 954 | ;; w32notify does not raise `deleted' and `stopped' events | 966 | (should (file-notify-valid-p file-notify--test-desc)) |
| 955 | ;; for the watched directory. | 967 | (file-notify--test-with-events |
| 956 | ((string-equal (file-notify--test-library) "w32notify") | 968 | (cond |
| 957 | '(created changed deleted)) | 969 | ;; w32notify does not raise `deleted' and `stopped' |
| 958 | ;; gvfs-monitor-dir on cygwin does not detect the `created' | 970 | ;; events for the watched directory. |
| 959 | ;; event reliably. | 971 | ((string-equal (file-notify--test-library) "w32notify") |
| 960 | ((string-equal (file-notify--test-library) "gvfs-monitor-dir.exe") | 972 | '(created changed deleted)) |
| 961 | '((deleted stopped) | 973 | ;; gvfs-monitor-dir on cygwin does not detect the |
| 962 | (created deleted stopped))) | 974 | ;; `created' event reliably. |
| 963 | ;; There are two `deleted' events, for the file and for the | 975 | ((string-equal |
| 964 | ;; directory. Except for cygwin and kqueue. And cygwin | 976 | (file-notify--test-library) "gvfs-monitor-dir.exe") |
| 965 | ;; does not raise a `changed' event. | 977 | '((deleted stopped) |
| 966 | ((eq system-type 'cygwin) | 978 | (created deleted stopped))) |
| 967 | '(created deleted stopped)) | 979 | ;; There are two `deleted' events, for the file and for |
| 968 | ((string-equal (file-notify--test-library) "kqueue") | 980 | ;; the directory. Except for cygwin and kqueue. And |
| 969 | '(created changed deleted stopped)) | 981 | ;; cygwin does not raise a `changed' event. |
| 970 | (t '(created changed deleted deleted stopped))) | 982 | ((eq system-type 'cygwin) |
| 971 | (write-region | 983 | '(created deleted stopped)) |
| 972 | "any text" nil file-notify--test-tmpfile nil 'no-message) | 984 | ((string-equal (file-notify--test-library) "kqueue") |
| 973 | (file-notify--test-read-event) | 985 | '(created changed deleted stopped)) |
| 974 | (delete-directory file-notify--test-tmpdir 'recursive)) | 986 | (t '(created changed deleted deleted stopped))) |
| 975 | ;; After deleting the parent directory, the descriptor must | 987 | (write-region |
| 976 | ;; not be valid anymore. | 988 | "any text" nil file-notify--test-tmpfile nil 'no-message) |
| 977 | (should-not (file-notify-valid-p file-notify--test-desc)) | 989 | (file-notify--test-read-event) |
| 978 | ;; w32notify doesn't generate `stopped' events when the parent | 990 | (delete-directory file-notify--test-tmpdir 'recursive)) |
| 979 | ;; directory is deleted, which doesn't provide a chance for | 991 | ;; After deleting the parent directory, the descriptor must |
| 980 | ;; filenotify.el to remove the descriptor from the internal | 992 | ;; not be valid anymore. |
| 981 | ;; hash table it maintains. So we must remove the descriptor | 993 | (should-not (file-notify-valid-p file-notify--test-desc)) |
| 982 | ;; manually. | 994 | ;; w32notify doesn't generate `stopped' events when the |
| 983 | (if (string-equal (file-notify--test-library) "w32notify") | 995 | ;; parent directory is deleted, which doesn't provide a |
| 984 | (file-notify--rm-descriptor file-notify--test-desc)) | 996 | ;; chance for filenotify.el to remove the descriptor from |
| 997 | ;; the internal hash table it maintains. So we must remove | ||
| 998 | ;; the descriptor manually. | ||
| 999 | (if (string-equal (file-notify--test-library) "w32notify") | ||
| 1000 | (file-notify--rm-descriptor file-notify--test-desc)) | ||
| 985 | 1001 | ||
| 986 | ;; The environment shall be cleaned up. | 1002 | ;; The environment shall be cleaned up. |
| 987 | (file-notify--test-cleanup-p)) | 1003 | (file-notify--test-cleanup-p))) |
| 988 | 1004 | ||
| 989 | ;; Cleanup. | 1005 | ;; Cleanup. |
| 990 | (file-notify--test-cleanup))) | 1006 | (file-notify--test-cleanup))) |
| @@ -1022,7 +1038,9 @@ delivered." | |||
| 1022 | (file-notify--test-cleanup)) | 1038 | (file-notify--test-cleanup)) |
| 1023 | 1039 | ||
| 1024 | (unwind-protect | 1040 | (unwind-protect |
| 1025 | (progn | 1041 | ;; On emba, `deleted' and `stopped' events of the directory are |
| 1042 | ;; not detected. | ||
| 1043 | (unless (getenv "EMACS_EMBA_CI") | ||
| 1026 | (should | 1044 | (should |
| 1027 | (setq file-notify--test-tmpfile | 1045 | (setq file-notify--test-tmpfile |
| 1028 | (make-temp-file "file-notify-test-parent" t))) | 1046 | (make-temp-file "file-notify-test-parent" t))) |
| @@ -1109,7 +1127,8 @@ delivered." | |||
| 1109 | (file-notify--test-read-event) | 1127 | (file-notify--test-read-event) |
| 1110 | (delete-file file))) | 1128 | (delete-file file))) |
| 1111 | (delete-directory file-notify--test-tmpfile) | 1129 | (delete-directory file-notify--test-tmpfile) |
| 1112 | (if (string-equal (file-notify--test-library) "w32notify") | 1130 | (if (or (string-equal (file-notify--test-library) "w32notify") |
| 1131 | (getenv "EMACS_EMBA_CI")) | ||
| 1113 | (file-notify--rm-descriptor file-notify--test-desc)) | 1132 | (file-notify--rm-descriptor file-notify--test-desc)) |
| 1114 | 1133 | ||
| 1115 | ;; The environment shall be cleaned up. | 1134 | ;; The environment shall be cleaned up. |
| @@ -1316,11 +1335,17 @@ the file watch." | |||
| 1316 | ;; w32notify does not raise `deleted' and `stopped' | 1335 | ;; w32notify does not raise `deleted' and `stopped' |
| 1317 | ;; events for the watched directory. | 1336 | ;; events for the watched directory. |
| 1318 | ((string-equal (file-notify--test-library) "w32notify") '()) | 1337 | ((string-equal (file-notify--test-library) "w32notify") '()) |
| 1338 | ;; On emba, `deleted' and `stopped' events of the | ||
| 1339 | ;; directory are not detected. | ||
| 1340 | ((getenv "EMACS_EMBA_CI") | ||
| 1341 | '()) | ||
| 1319 | (t '(deleted stopped)))))) | 1342 | (t '(deleted stopped)))))) |
| 1320 | (delete-directory file-notify--test-tmpfile 'recursive)) | 1343 | (delete-directory file-notify--test-tmpfile 'recursive)) |
| 1321 | (should-not (file-notify-valid-p file-notify--test-desc1)) | 1344 | (unless (getenv "EMACS_EMBA_CI") |
| 1322 | (should-not (file-notify-valid-p file-notify--test-desc2)) | 1345 | (should-not (file-notify-valid-p file-notify--test-desc1)) |
| 1323 | (when (string-equal (file-notify--test-library) "w32notify") | 1346 | (should-not (file-notify-valid-p file-notify--test-desc2))) |
| 1347 | (when (or (string-equal (file-notify--test-library) "w32notify") | ||
| 1348 | (getenv "EMACS_EMBA_CI")) | ||
| 1324 | (file-notify--rm-descriptor file-notify--test-desc1) | 1349 | (file-notify--rm-descriptor file-notify--test-desc1) |
| 1325 | (file-notify--rm-descriptor file-notify--test-desc2)) | 1350 | (file-notify--rm-descriptor file-notify--test-desc2)) |
| 1326 | 1351 | ||