Permalink
Browse files

Merge branch 'v0.8'

  • Loading branch information...
2 parents a3b57dd + 4997738 commit c6c5b7a901d26b727acf6cdc7e6c970b18310248 @bnoordhuis bnoordhuis committed Dec 14, 2012
Showing with 34 additions and 1 deletion.
  1. +1 −1 src/unix/sunos.c
  2. +31 −0 test/test-fs-event.c
  3. +2 −0 test/test-list.h
View
@@ -376,7 +376,7 @@ int uv_fs_event_init(uv_loop_t* loop,
void uv__fs_event_close(uv_fs_event_t* handle) {
- if (handle->fd == PORT_FIRED) {
+ if (handle->fd == PORT_FIRED || handle->fd == PORT_LOADED) {
port_dissociate(handle->loop->fs_fd, PORT_SOURCE_FILE, (uintptr_t)&handle->fo);
}
handle->fd = PORT_DELETED;
View
@@ -296,6 +296,37 @@ TEST_IMPL(fs_event_watch_file_current_dir) {
return 0;
}
+TEST_IMPL(fs_event_no_callback_after_close) {
+ uv_loop_t* loop = uv_default_loop();
+ int r;
+
+ /* Setup */
+ remove("watch_dir/file1");
+ remove("watch_dir/");
+ create_dir(loop, "watch_dir");
+ create_file(loop, "watch_dir/file1");
+
+ r = uv_fs_event_init(loop,
+ &fs_event,
+ "watch_dir/file1",
+ fs_event_cb_file,
+ 0);
+ ASSERT(r != -1);
+
+ uv_close((uv_handle_t*)&fs_event, close_cb);
+ touch_file(loop, "watch_dir/file1");
+ uv_run(loop);
+
+ ASSERT(fs_event_cb_called == 0);
+ ASSERT(close_cb_called == 1);
+
+ /* Cleanup */
+ remove("watch_dir/file1");
+ remove("watch_dir/");
+
+ MAKE_VALGRIND_HAPPY();
+ return 0;
+}
TEST_IMPL(fs_event_no_callback_on_close) {
uv_loop_t* loop = uv_default_loop();
View
@@ -177,6 +177,7 @@ TEST_DECLARE (fs_event_watch_dir)
TEST_DECLARE (fs_event_watch_file)
TEST_DECLARE (fs_event_watch_file_twice)
TEST_DECLARE (fs_event_watch_file_current_dir)
+TEST_DECLARE (fs_event_no_callback_after_close)
TEST_DECLARE (fs_event_no_callback_on_close)
TEST_DECLARE (fs_event_immediate_close)
TEST_DECLARE (fs_event_close_with_pending_event)
@@ -450,6 +451,7 @@ TASK_LIST_START
TEST_ENTRY (fs_event_watch_file)
TEST_ENTRY (fs_event_watch_file_twice)
TEST_ENTRY (fs_event_watch_file_current_dir)
+ TEST_ENTRY (fs_event_no_callback_after_close)
TEST_ENTRY (fs_event_no_callback_on_close)
TEST_ENTRY (fs_event_immediate_close)
TEST_ENTRY (fs_event_close_with_pending_event)

0 comments on commit c6c5b7a

Please sign in to comment.