diff --git a/test/test-fs-event.c b/test/test-fs-event.c index 4cbbab85..ea34bd63 100644 --- a/test/test-fs-event.c +++ b/test/test-fs-event.c @@ -480,6 +480,8 @@ TEST_IMPL(fs_event_watch_dir_recursive) { #ifdef _WIN32 TEST_IMPL(fs_event_watch_dir_short_path) { uv_loop_t* loop; + uv_fs_t req; + int has_shortnames; int r; /* Setup */ @@ -489,26 +491,37 @@ TEST_IMPL(fs_event_watch_dir_short_path) { create_dir("watch_dir"); create_file("watch_dir/file1"); - r = uv_fs_event_init(loop, &fs_event); - ASSERT(r == 0); - r = uv_fs_event_start(&fs_event, fs_event_cb_dir, "watch_~1", 0); - ASSERT(r == 0); - r = uv_timer_init(loop, &timer); - ASSERT(r == 0); - r = uv_timer_start(&timer, timer_cb_file, 100, 0); - ASSERT(r == 0); + /* Newer version of Windows ship with + HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\NtfsDisable8dot3NameCreation + not equal to 0. So we verify the files we created are addressable by a 8.3 + short name */ + has_shortnames = uv_fs_stat(NULL, &req, "watch_~1", NULL) != UV_ENOENT; + if (has_shortnames) { + r = uv_fs_event_init(loop, &fs_event); + ASSERT(r == 0); + r = uv_fs_event_start(&fs_event, fs_event_cb_dir, "watch_~1", 0); + ASSERT(r == 0); + r = uv_timer_init(loop, &timer); + ASSERT(r == 0); + r = uv_timer_start(&timer, timer_cb_file, 100, 0); + ASSERT(r == 0); - uv_run(loop, UV_RUN_DEFAULT); + uv_run(loop, UV_RUN_DEFAULT); - ASSERT(fs_event_cb_called == 1); - ASSERT(timer_cb_called == 1); - ASSERT(close_cb_called == 1); + ASSERT(fs_event_cb_called == 1); + ASSERT(timer_cb_called == 1); + ASSERT(close_cb_called == 1); + } /* Cleanup */ remove("watch_dir/file1"); remove("watch_dir/"); MAKE_VALGRIND_HAPPY(); + + if (!has_shortnames) + RETURN_SKIP("Was not able to address files with 8.3 short name."); + return 0; } #endif