sleepy_penguin RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* [PATCH] test_inotify: add test for rm_watch
@ 2014-12-27 23:55 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2014-12-27 23:55 UTC (permalink / raw)
  To: sleepy.penguin

Ugh, unfortunately this seems buggy in some cases, but we
need to ensure the regular case works.

ref: https://lkml.org/lkml/2007/7/9/3
Subject: inotify_rm_watch() EINVAL race condition for deleted files
---
 test/test_inotify.rb | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/test/test_inotify.rb b/test/test_inotify.rb
index 5cf5839..895e13b 100644
--- a/test/test_inotify.rb
+++ b/test/test_inotify.rb
@@ -103,4 +103,17 @@ class TestInotify < Testcase
     end
     assert_equal 0, nr
   end
+
+  def test_rm_watch
+    ino = Inotify.new Inotify::CLOEXEC
+    tmp = Tempfile.new 'a'
+    wd = ino.add_watch tmp.path, Inotify::ALL_EVENTS
+    assert_kind_of Integer, wd
+    tmp.syswrite '.'
+    event = ino.take
+    assert_equal wd, event.wd
+    assert_kind_of Inotify::Event, event
+    assert_equal [:MODIFY], event.events
+    assert_equal 0, ino.rm_watch(wd)
+  end
 end if defined?(SleepyPenguin::Inotify)
-- 
EW



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-12-27 23:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-27 23:55 [PATCH] test_inotify: add test for rm_watch Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/sleepy_penguin.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).