test: delete test with invalid assumption (#4530)
Delete the fs_event_error_reporting test. It fails in different ways, most frequently on the TSan sanitizer buildbot, due to running out of file descriptors when that is not expected, or vice versa, *not* running out of file descriptors when that *is* expected. The test creates a large number of event loops and expects to, eventually, hit EMFILE but it sometimes hits it too early, and sometimes not at all. I don't think TSan is really responsible here, it just makes the invalid assumption in the test itself more visible. Fixes: https://github.com/libuv/libuv/issues/4368
This commit is contained in:
parent
a49f264dff
commit
9dddebab0d
@ -1145,106 +1145,6 @@ TEST_IMPL(fs_event_getpath) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(__APPLE__)
|
||||
|
||||
static int fs_event_error_reported;
|
||||
|
||||
static void fs_event_error_report_cb(uv_fs_event_t* handle,
|
||||
const char* filename,
|
||||
int events,
|
||||
int status) {
|
||||
if (status != 0)
|
||||
fs_event_error_reported = status;
|
||||
}
|
||||
|
||||
static void timer_cb_nop(uv_timer_t* handle) {
|
||||
++timer_cb_called;
|
||||
uv_close((uv_handle_t*) handle, close_cb);
|
||||
}
|
||||
|
||||
static void fs_event_error_report_close_cb(uv_handle_t* handle) {
|
||||
ASSERT_NOT_NULL(handle);
|
||||
close_cb_called++;
|
||||
|
||||
/* handle is allocated on-stack, no need to free it */
|
||||
}
|
||||
|
||||
|
||||
TEST_IMPL(fs_event_error_reporting) {
|
||||
unsigned int i;
|
||||
uv_loop_t loops[1024];
|
||||
uv_fs_event_t events[ARRAY_SIZE(loops)];
|
||||
uv_loop_t* loop;
|
||||
uv_fs_event_t* event;
|
||||
|
||||
TEST_FILE_LIMIT(ARRAY_SIZE(loops) * 3);
|
||||
|
||||
delete_dir("watch_dir/");
|
||||
create_dir("watch_dir");
|
||||
|
||||
/* Create a lot of loops, and start FSEventStream in each of them.
|
||||
* Eventually, this should create enough streams to make FSEventStreamStart()
|
||||
* fail.
|
||||
*/
|
||||
for (i = 0; i < ARRAY_SIZE(loops); i++) {
|
||||
loop = &loops[i];
|
||||
ASSERT_OK(uv_loop_init(loop));
|
||||
event = &events[i];
|
||||
|
||||
timer_cb_called = 0;
|
||||
close_cb_called = 0;
|
||||
ASSERT_OK(uv_fs_event_init(loop, event));
|
||||
ASSERT_OK(uv_fs_event_start(event,
|
||||
fs_event_error_report_cb,
|
||||
"watch_dir",
|
||||
0));
|
||||
uv_unref((uv_handle_t*) event);
|
||||
|
||||
/* Let loop run for some time */
|
||||
ASSERT_OK(uv_timer_init(loop, &timer));
|
||||
ASSERT_OK(uv_timer_start(&timer, timer_cb_nop, 2, 0));
|
||||
uv_run(loop, UV_RUN_DEFAULT);
|
||||
ASSERT_EQ(1, timer_cb_called);
|
||||
ASSERT_EQ(1, close_cb_called);
|
||||
if (fs_event_error_reported != 0)
|
||||
break;
|
||||
}
|
||||
|
||||
/* At least one loop should fail */
|
||||
ASSERT_EQ(fs_event_error_reported, UV_EMFILE);
|
||||
|
||||
/* Stop and close all events, and destroy loops */
|
||||
do {
|
||||
loop = &loops[i];
|
||||
event = &events[i];
|
||||
|
||||
ASSERT_OK(uv_fs_event_stop(event));
|
||||
uv_ref((uv_handle_t*) event);
|
||||
uv_close((uv_handle_t*) event, fs_event_error_report_close_cb);
|
||||
|
||||
close_cb_called = 0;
|
||||
uv_run(loop, UV_RUN_DEFAULT);
|
||||
ASSERT_EQ(1, close_cb_called);
|
||||
|
||||
uv_loop_close(loop);
|
||||
} while (i-- != 0);
|
||||
|
||||
delete_dir("watch_dir/");
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* !defined(__APPLE__) */
|
||||
|
||||
TEST_IMPL(fs_event_error_reporting) {
|
||||
/* No-op, needed only for FSEvents backend */
|
||||
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* defined(__APPLE__) */
|
||||
|
||||
TEST_IMPL(fs_event_watch_invalid_path) {
|
||||
#if defined(NO_FS_EVENTS)
|
||||
RETURN_SKIP(NO_FS_EVENTS);
|
||||
|
||||
@ -417,7 +417,6 @@ TEST_DECLARE (fs_event_close_with_pending_event)
|
||||
TEST_DECLARE (fs_event_close_with_pending_delete_event)
|
||||
TEST_DECLARE (fs_event_close_in_callback)
|
||||
TEST_DECLARE (fs_event_start_and_close)
|
||||
TEST_DECLARE (fs_event_error_reporting)
|
||||
TEST_DECLARE (fs_event_getpath)
|
||||
TEST_DECLARE (fs_event_stop_in_cb)
|
||||
TEST_DECLARE (fs_scandir_empty_dir)
|
||||
@ -1128,7 +1127,6 @@ TASK_LIST_START
|
||||
TEST_ENTRY (fs_event_close_with_pending_delete_event)
|
||||
TEST_ENTRY (fs_event_close_in_callback)
|
||||
TEST_ENTRY (fs_event_start_and_close)
|
||||
TEST_ENTRY_CUSTOM (fs_event_error_reporting, 0, 0, 60000)
|
||||
TEST_ENTRY (fs_event_getpath)
|
||||
TEST_ENTRY (fs_event_stop_in_cb)
|
||||
TEST_ENTRY (fs_scandir_empty_dir)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user