From cb2f6a9743cc6ed32236c17facae52e5965edfd5 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Wed, 10 Dec 2014 19:47:47 +0100 Subject: [PATCH] test: fix test-fs-file-loop on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Check whether uv_fs_symlink() succeeds. * Bail out early if we're on an old version of windows, or if we're not able to create symlinks because we're not elevated. PR-URL: https://github.com/libuv/libuv/pull/55 Reviewed-By: Saúl Ibarra Corretgé --- test/test-fs.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/test-fs.c b/test/test-fs.c index 471860a7..2c392251 100644 --- a/test/test-fs.c +++ b/test/test-fs.c @@ -568,7 +568,17 @@ TEST_IMPL(fs_file_loop) { loop = uv_default_loop(); unlink("test_symlink"); - uv_fs_symlink(loop, &req, "test_symlink", "test_symlink", 0, NULL); + r = uv_fs_symlink(loop, &req, "test_symlink", "test_symlink", 0, NULL); +#ifdef _WIN32 + /* + * Windows XP and Server 2003 don't support symlinks; we'll get UV_ENOTSUP. + * Starting with vista they are supported, but only when elevated, otherwise + * we'll see UV_EPERM. + */ + if (r == UV_ENOTSUP || r == UV_EPERM) + return 0; +#endif + ASSERT(r == 0); uv_fs_req_cleanup(&req); r = uv_fs_open(loop, &req, "test_symlink", O_RDONLY, 0, NULL);