diff options
author | Eric Wong <normalperson@yhbt.net> | 2014-12-27 23:51:47 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2014-12-27 23:51:47 +0000 |
commit | ac4a8474f4e3b0961b48d27bbe5a020b7aa93442 (patch) | |
tree | 62a6258a926153825e46cf0e5f0efe471bf5492b | |
parent | 486591b239be4bfa6e7fe4e0adb92389a30cf289 (diff) | |
download | sleepy_penguin-ac4a8474f4e3b0961b48d27bbe5a020b7aa93442.tar.gz |
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
-rw-r--r-- | test/test_inotify.rb | 13 |
1 files changed, 13 insertions, 0 deletions
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) |