Skip to content

Instantly share code, notes, and snippets.

@igorzi igorzi/gist:1268982
Created Oct 6, 2011

Embed
What would you like to do?
From c3312a0239c946c99378bc9e64cc08b22b40de58 Mon Sep 17 00:00:00 2001
From: Igor Zinkovsky <igorzi@microsoft.com>
Date: Thu, 6 Oct 2011 16:18:15 -0700
Subject: [PATCH] fix fs_utime & fs_futime tests on windows
---
test/test-fs.c | 28 +++++++++++++++++++++++++---
1 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/test/test-fs.c b/test/test-fs.c
index d5e7e29..73939e2 100644
--- a/test/test-fs.c
+++ b/test/test-fs.c
@@ -1163,13 +1163,21 @@ TEST_IMPL(fs_symlink) {
TEST_IMPL(fs_utime) {
utime_check_t checkme;
- const char* path = ".";
+ const char* path = "test_file";
double atime;
double mtime;
uv_fs_t req;
int r;
+ /* Setup. */
loop = uv_default_loop();
+ unlink(path);
+ r = uv_fs_open(loop, &req, path, O_RDWR | O_CREAT,
+ S_IWRITE | S_IREAD, NULL);
+ ASSERT(r != -1);
+ ASSERT(req.result != -1);
+ uv_fs_req_cleanup(&req);
+ close(r);
atime = mtime = 400497753; /* 1982-09-10 11:22:33 */
@@ -1196,24 +1204,35 @@ TEST_IMPL(fs_utime) {
uv_run(loop);
ASSERT(utime_cb_count == 1);
+ /* Cleanup. */
+ unlink(path);
+
return 0;
}
TEST_IMPL(fs_futime) {
utime_check_t checkme;
- const char* path = ".";
+ const char* path = "test_file";
double atime;
double mtime;
uv_file file;
uv_fs_t req;
int r;
+ /* Setup. */
loop = uv_default_loop();
+ unlink(path);
+ r = uv_fs_open(loop, &req, path, O_RDWR | O_CREAT,
+ S_IWRITE | S_IREAD, NULL);
+ ASSERT(r != -1);
+ ASSERT(req.result != -1);
+ uv_fs_req_cleanup(&req);
+ close(r);
atime = mtime = 400497753; /* 1982-09-10 11:22:33 */
- r = uv_fs_open(loop, &req, path, O_RDONLY, 0, NULL);
+ r = uv_fs_open(loop, &req, path, O_RDWR, 0, NULL);
ASSERT(r != -1);
ASSERT(req.result != -1);
file = req.result; /* FIXME probably not how it's supposed to be used */
@@ -1243,6 +1262,9 @@ TEST_IMPL(fs_futime) {
uv_run(loop);
ASSERT(futime_cb_count == 1);
+ /* Cleanup. */
+ unlink(path);
+
return 0;
}
--
1.7.4.msysgit.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.