emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-26 13b586d: Adapt filenotify-tests for emba


From: Michael Albinus
Subject: [Emacs-diffs] emacs-26 13b586d: Adapt filenotify-tests for emba
Date: Mon, 7 Jan 2019 11:07:38 -0500 (EST)

branch: emacs-26
commit 13b586d7a7020ad3d28ccd980663586dfb8552b1
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    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.
---
 .gitlab-ci.yml                |   2 +
 test/lisp/filenotify-tests.el | 123 +++++++++++++++++++++++++-----------------
 2 files changed, 76 insertions(+), 49 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index af573af..ff51c20 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -35,6 +35,8 @@ stages:
 
 test:
   stage: test
+  variables:
+    EMACS_EMBA_CI: 1
   script:
     - ./autogen.sh autoconf
     - ./configure --without-makeinfo
diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el
index 341c5af..4e1a462 100644
--- a/test/lisp/filenotify-tests.el
+++ b/test/lisp/filenotify-tests.el
@@ -649,6 +649,10 @@ delivered."
                '(created deleted stopped))
               ((string-equal (file-notify--test-library) "kqueue")
                '(created changed deleted stopped))
+               ;; On emba, `deleted' and `stopped' events of the
+               ;; directory are not detected.
+               ((getenv "EMACS_EMBA_CI")
+                '(created changed deleted))
               (t '(created changed deleted deleted stopped)))
            (write-region
             "any text" nil file-notify--test-tmpfile nil 'no-message)
@@ -687,6 +691,10 @@ delivered."
                '(created created changed changed deleted stopped))
               ((string-equal (file-notify--test-library) "kqueue")
                '(created changed created changed deleted stopped))
+               ;; On emba, `deleted' and `stopped' events of the
+               ;; directory are not detected.
+               ((getenv "EMACS_EMBA_CI")
+                '(created changed created changed deleted deleted))
               (t '(created changed created changed
                    deleted deleted deleted stopped)))
            (write-region
@@ -732,6 +740,10 @@ delivered."
                '(created created deleted deleted stopped))
               ((string-equal (file-notify--test-library) "kqueue")
                '(created changed renamed deleted stopped))
+               ;; On emba, `deleted' and `stopped' events of the
+               ;; directory are not detected.
+               ((getenv "EMACS_EMBA_CI")
+                '(created changed renamed deleted))
               (t '(created changed renamed deleted deleted stopped)))
            (write-region
             "any text" nil file-notify--test-tmpfile nil 'no-message)
@@ -940,51 +952,55 @@ delivered."
     (file-notify--test-cleanup))
 
   (unwind-protect
-      (let ((file-notify--test-tmpdir
-            (make-temp-file "file-notify-test-parent" t)))
-       (should
-        (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)
-              file-notify--test-desc
-              (file-notify-add-watch
-               file-notify--test-tmpdir
-               '(change) #'file-notify--test-event-handler)))
-       (should (file-notify-valid-p file-notify--test-desc))
-       (file-notify--test-with-events
-        (cond
-         ;; w32notify does not raise `deleted' and `stopped' events
-         ;; for the watched directory.
-         ((string-equal (file-notify--test-library) "w32notify")
-          '(created changed deleted))
-          ;; gvfs-monitor-dir on cygwin does not detect the `created'
-          ;; event reliably.
-         ((string-equal (file-notify--test-library) "gvfs-monitor-dir.exe")
-          '((deleted stopped)
-            (created deleted stopped)))
-         ;; There are two `deleted' events, for the file and for the
-         ;; directory.  Except for cygwin and kqueue.  And cygwin
-         ;; does not raise a `changed' event.
-         ((eq system-type 'cygwin)
-          '(created deleted stopped))
-         ((string-equal (file-notify--test-library) "kqueue")
-          '(created changed deleted stopped))
-         (t '(created changed deleted deleted stopped)))
-        (write-region
-         "any text" nil file-notify--test-tmpfile nil 'no-message)
-        (file-notify--test-read-event)
-        (delete-directory file-notify--test-tmpdir 'recursive))
-       ;; After deleting the parent directory, the descriptor must
-       ;; not be valid anymore.
-       (should-not (file-notify-valid-p file-notify--test-desc))
-        ;; w32notify doesn't generate `stopped' events when the parent
-        ;; directory is deleted, which doesn't provide a chance for
-        ;; filenotify.el to remove the descriptor from the internal
-        ;; hash table it maintains.  So we must remove the descriptor
-        ;; manually.
-        (if (string-equal (file-notify--test-library) "w32notify")
-            (file-notify--rm-descriptor file-notify--test-desc))
+      ;; On emba, `deleted' and `stopped' events of the directory are
+      ;; not detected.
+      (unless (getenv "EMACS_EMBA_CI")
+        (let ((file-notify--test-tmpdir
+              (make-temp-file "file-notify-test-parent" t)))
+         (should
+          (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)
+                file-notify--test-desc
+                (file-notify-add-watch
+                 file-notify--test-tmpdir
+                 '(change) #'file-notify--test-event-handler)))
+         (should (file-notify-valid-p file-notify--test-desc))
+         (file-notify--test-with-events
+             (cond
+              ;; w32notify does not raise `deleted' and `stopped'
+              ;; events for the watched directory.
+              ((string-equal (file-notify--test-library) "w32notify")
+               '(created changed deleted))
+               ;; gvfs-monitor-dir on cygwin does not detect the
+               ;; `created' event reliably.
+              ((string-equal
+                 (file-notify--test-library) "gvfs-monitor-dir.exe")
+               '((deleted stopped)
+                 (created deleted stopped)))
+              ;; There are two `deleted' events, for the file and for
+              ;; the directory.  Except for cygwin and kqueue.  And
+              ;; cygwin does not raise a `changed' event.
+              ((eq system-type 'cygwin)
+               '(created deleted stopped))
+              ((string-equal (file-notify--test-library) "kqueue")
+               '(created changed deleted stopped))
+              (t '(created changed deleted deleted stopped)))
+           (write-region
+            "any text" nil file-notify--test-tmpfile nil 'no-message)
+           (file-notify--test-read-event)
+           (delete-directory file-notify--test-tmpdir 'recursive))
+         ;; After deleting the parent directory, the descriptor must
+         ;; not be valid anymore.
+         (should-not (file-notify-valid-p file-notify--test-desc))
+          ;; w32notify doesn't generate `stopped' events when the
+          ;; parent directory is deleted, which doesn't provide a
+          ;; chance for filenotify.el to remove the descriptor from
+          ;; the internal hash table it maintains.  So we must remove
+          ;; the descriptor manually.
+          (if (string-equal (file-notify--test-library) "w32notify")
+              (file-notify--rm-descriptor file-notify--test-desc))
 
-        ;; The environment shall be cleaned up.
-        (file-notify--test-cleanup-p))
+          ;; The environment shall be cleaned up.
+          (file-notify--test-cleanup-p)))
 
     ;; Cleanup.
     (file-notify--test-cleanup)))
@@ -1022,7 +1038,9 @@ delivered."
     (file-notify--test-cleanup))
 
   (unwind-protect
-      (progn
+      ;; On emba, `deleted' and `stopped' events of the directory are
+      ;; not detected.
+      (unless (getenv "EMACS_EMBA_CI")
        (should
         (setq file-notify--test-tmpfile
               (make-temp-file "file-notify-test-parent" t)))
@@ -1109,7 +1127,8 @@ delivered."
             (file-notify--test-read-event)
             (delete-file file)))
         (delete-directory file-notify--test-tmpfile)
-        (if (string-equal (file-notify--test-library) "w32notify")
+        (if (or (string-equal (file-notify--test-library) "w32notify")
+                (getenv "EMACS_EMBA_CI"))
             (file-notify--rm-descriptor file-notify--test-desc))
 
         ;; The environment shall be cleaned up.
@@ -1316,11 +1335,17 @@ the file watch."
                  ;; w32notify does not raise `deleted' and `stopped'
                  ;; events for the watched directory.
                   ((string-equal (file-notify--test-library) "w32notify") '())
+                  ;; On emba, `deleted' and `stopped' events of the
+                  ;; directory are not detected.
+                  ((getenv "EMACS_EMBA_CI")
+                   '())
                   (t '(deleted stopped))))))
           (delete-directory file-notify--test-tmpfile 'recursive))
-        (should-not (file-notify-valid-p file-notify--test-desc1))
-        (should-not (file-notify-valid-p file-notify--test-desc2))
-        (when (string-equal (file-notify--test-library) "w32notify")
+        (unless (getenv "EMACS_EMBA_CI")
+          (should-not (file-notify-valid-p file-notify--test-desc1))
+          (should-not (file-notify-valid-p file-notify--test-desc2)))
+        (when (or (string-equal (file-notify--test-library) "w32notify")
+                  (getenv "EMACS_EMBA_CI"))
           (file-notify--rm-descriptor file-notify--test-desc1)
           (file-notify--rm-descriptor file-notify--test-desc2))
 



reply via email to

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