diff options
| author | Michael Albinus | 2016-12-29 19:48:17 +0100 |
|---|---|---|
| committer | Michael Albinus | 2016-12-29 19:48:17 +0100 |
| commit | b9cacf044902df441dc7cbd9a21f36833dc40a30 (patch) | |
| tree | ffbc9c40a325c9ebff9f5efcd1a053e61fcb3929 /src | |
| parent | 11b81a54d538e8deca3cd64521cf85409efb617b (diff) | |
| download | emacs-b9cacf044902df441dc7cbd9a21f36833dc40a30.tar.gz emacs-b9cacf044902df441dc7cbd9a21f36833dc40a30.zip | |
Improve filenotify-tests.el
* src/inotify.c (Finotify_valid_p):
* src/kqueue.c (Fkqueue_valid_p):
* src/w32notify.c (Fw32notify_valid_p):
* src/gfilenotify.c (Fgfile_valid_p): Fix typo in docstring.
(Fgfile_monitor_name): New defun.
(syms_of_gfilenotify): Declare Sgfile_monitor_name.
* test/lisp/filenotify-tests.el (file-notify--test-read-event):
New defun, derived from `file-notify--test-read-event-timeout'.
Replace all calls of `read-event' by this.
(file-notify--test-timeout): Fix docstring.
(file-notify--test-monitor): New defun.
(file-notify--deftest-remote): Do not bind
`file-notify--test-read-event-timeout' anymore.
(file-notify-test00-availability): Print also monitor, if existent.
(file-notify--test-with-events): Add an additional
`file-notify--test-read-event' call, in order to get it work
after `file-notify-add-watch'. Remove special timeout for cygwin.
(file-notify-test02-events): Make a better check for cygwin.
(file-notify-test06-many-events): Improve event list for cygwin.
(file-notify-test08-watched-file-in-watched-dir): Add cygwin case.
Diffstat (limited to 'src')
| -rw-r--r-- | src/gfilenotify.c | 23 | ||||
| -rw-r--r-- | src/inotify.c | 2 | ||||
| -rw-r--r-- | src/kqueue.c | 2 | ||||
| -rw-r--r-- | src/w32notify.c | 2 |
4 files changed, 25 insertions, 4 deletions
diff --git a/src/gfilenotify.c b/src/gfilenotify.c index 30d0753f7e7..1ad989a0d95 100644 --- a/src/gfilenotify.c +++ b/src/gfilenotify.c | |||
| @@ -258,7 +258,7 @@ WATCH-DESCRIPTOR should be an object returned by `gfile-add-watch'. */) | |||
| 258 | } | 258 | } |
| 259 | 259 | ||
| 260 | DEFUN ("gfile-valid-p", Fgfile_valid_p, Sgfile_valid_p, 1, 1, 0, | 260 | DEFUN ("gfile-valid-p", Fgfile_valid_p, Sgfile_valid_p, 1, 1, 0, |
| 261 | doc: /* "Check a watch specified by its WATCH-DESCRIPTOR. | 261 | doc: /* Check a watch specified by its WATCH-DESCRIPTOR. |
| 262 | 262 | ||
| 263 | WATCH-DESCRIPTOR should be an object returned by `gfile-add-watch'. | 263 | WATCH-DESCRIPTOR should be an object returned by `gfile-add-watch'. |
| 264 | 264 | ||
| @@ -278,6 +278,26 @@ invalid. */) | |||
| 278 | } | 278 | } |
| 279 | } | 279 | } |
| 280 | 280 | ||
| 281 | DEFUN ("gfile-monitor-name", Fgfile_monitor_name, Sgfile_monitor_name, 1, 1, 0, | ||
| 282 | doc: /* Return the internal monitor name for WATCH-DESCRIPTOR. | ||
| 283 | |||
| 284 | The result is a string, either "GInotifyFileMonitor", | ||
| 285 | "GKqueueFileMonitor", or "GPollFileMonitor". | ||
| 286 | |||
| 287 | WATCH-DESCRIPTOR should be an object returned by `gfile-add-watch'. | ||
| 288 | If WATCH-DESCRIPTOR is not valid, nil is returned. */) | ||
| 289 | (Lisp_Object watch_descriptor) | ||
| 290 | { | ||
| 291 | if (NILP (Fgfile_valid_p (watch_descriptor))) | ||
| 292 | return Qnil; | ||
| 293 | else | ||
| 294 | { | ||
| 295 | Lisp_Object watch_object = Fassoc (watch_descriptor, watch_list); | ||
| 296 | GFileMonitor *monitor = XINTPTR (watch_descriptor); | ||
| 297 | return build_string (G_OBJECT_TYPE_NAME (monitor)); | ||
| 298 | } | ||
| 299 | } | ||
| 300 | |||
| 281 | 301 | ||
| 282 | void | 302 | void |
| 283 | globals_of_gfilenotify (void) | 303 | globals_of_gfilenotify (void) |
| @@ -294,6 +314,7 @@ syms_of_gfilenotify (void) | |||
| 294 | defsubr (&Sgfile_add_watch); | 314 | defsubr (&Sgfile_add_watch); |
| 295 | defsubr (&Sgfile_rm_watch); | 315 | defsubr (&Sgfile_rm_watch); |
| 296 | defsubr (&Sgfile_valid_p); | 316 | defsubr (&Sgfile_valid_p); |
| 317 | defsubr (&Sgfile_monitor_name); | ||
| 297 | 318 | ||
| 298 | /* Filter objects. */ | 319 | /* Filter objects. */ |
| 299 | DEFSYM (Qchange, "change"); | 320 | DEFSYM (Qchange, "change"); |
diff --git a/src/inotify.c b/src/inotify.c index 38c8df5a29a..cacc6dca147 100644 --- a/src/inotify.c +++ b/src/inotify.c | |||
| @@ -364,7 +364,7 @@ See inotify_rm_watch(2) for more information. | |||
| 364 | } | 364 | } |
| 365 | 365 | ||
| 366 | DEFUN ("inotify-valid-p", Finotify_valid_p, Sinotify_valid_p, 1, 1, 0, | 366 | DEFUN ("inotify-valid-p", Finotify_valid_p, Sinotify_valid_p, 1, 1, 0, |
| 367 | doc: /* "Check a watch specified by its WATCH-DESCRIPTOR. | 367 | doc: /* Check a watch specified by its WATCH-DESCRIPTOR. |
| 368 | 368 | ||
| 369 | WATCH-DESCRIPTOR should be an object returned by `inotify-add-watch'. | 369 | WATCH-DESCRIPTOR should be an object returned by `inotify-add-watch'. |
| 370 | 370 | ||
diff --git a/src/kqueue.c b/src/kqueue.c index d1d0a612044..8ebd132fdc3 100644 --- a/src/kqueue.c +++ b/src/kqueue.c | |||
| @@ -491,7 +491,7 @@ WATCH-DESCRIPTOR should be an object returned by `kqueue-add-watch'. */) | |||
| 491 | } | 491 | } |
| 492 | 492 | ||
| 493 | DEFUN ("kqueue-valid-p", Fkqueue_valid_p, Skqueue_valid_p, 1, 1, 0, | 493 | DEFUN ("kqueue-valid-p", Fkqueue_valid_p, Skqueue_valid_p, 1, 1, 0, |
| 494 | doc: /* "Check a watch specified by its WATCH-DESCRIPTOR. | 494 | doc: /* Check a watch specified by its WATCH-DESCRIPTOR. |
| 495 | 495 | ||
| 496 | WATCH-DESCRIPTOR should be an object returned by `kqueue-add-watch'. | 496 | WATCH-DESCRIPTOR should be an object returned by `kqueue-add-watch'. |
| 497 | 497 | ||
diff --git a/src/w32notify.c b/src/w32notify.c index 32a03f70a66..e23e2b8740c 100644 --- a/src/w32notify.c +++ b/src/w32notify.c | |||
| @@ -670,7 +670,7 @@ w32_get_watch_object (void *desc) | |||
| 670 | } | 670 | } |
| 671 | 671 | ||
| 672 | DEFUN ("w32notify-valid-p", Fw32notify_valid_p, Sw32notify_valid_p, 1, 1, 0, | 672 | DEFUN ("w32notify-valid-p", Fw32notify_valid_p, Sw32notify_valid_p, 1, 1, 0, |
| 673 | doc: /* "Check a watch specified by its WATCH-DESCRIPTOR for validity. | 673 | doc: /* Check a watch specified by its WATCH-DESCRIPTOR for validity. |
| 674 | 674 | ||
| 675 | WATCH-DESCRIPTOR should be an object returned by `w32notify-add-watch'. | 675 | WATCH-DESCRIPTOR should be an object returned by `w32notify-add-watch'. |
| 676 | 676 | ||