aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHüseyin Açacak <huseyin@janeasystems.com>2025-02-14 16:31:22 +0300
committerSaúl Ibarra Corretgé <s@saghul.net>2025-02-17 08:35:37 +0100
commit82cdfb75ff9bbd0dc65820ca418b7c5d412ff4d7 (patch)
tree17dcb6f4bc6f21e11f38a64b5ac7204d425bd47f /test
parentdcace2a393a22650100e8a89debe168e92970ca4 (diff)
downloadlibuv-82cdfb75ff9bbd0dc65820ca418b7c5d412ff4d7.tar.gz
libuv-82cdfb75ff9bbd0dc65820ca418b7c5d412ff4d7.zip
win: fix the inconsistency in volume serial number
Diffstat (limited to 'test')
-rw-r--r--test/test-fs.c44
-rw-r--r--test/test-list.h2
2 files changed, 46 insertions, 0 deletions
diff --git a/test/test-fs.c b/test/test-fs.c
index 423d72dd..2519e44c 100644
--- a/test/test-fs.c
+++ b/test/test-fs.c
@@ -1607,6 +1607,50 @@ TEST_IMPL(fs_fstat) {
}
+TEST_IMPL(fs_fstat_st_dev) {
+ uv_fs_t req;
+ uv_fs_t req_link;
+ uv_loop_t* loop = uv_default_loop();
+ char* test_file = "tmp_st_dev";
+ char* symlink_file = "tmp_st_dev_link";
+
+ unlink(test_file);
+ unlink(symlink_file);
+
+ // Create file
+ int r = uv_fs_open(NULL, &req, test_file, UV_FS_O_RDWR | UV_FS_O_CREAT,
+ S_IWUSR | S_IRUSR, NULL);
+ ASSERT_GE(r, 0);
+ ASSERT_GE(req.result, 0);
+ uv_fs_req_cleanup(&req);
+
+ // Create a symlink
+ r = uv_fs_symlink(loop, &req, test_file, symlink_file, 0, NULL);
+ ASSERT_EQ(r, 0);
+ uv_fs_req_cleanup(&req);
+
+ // Call uv_fs_fstat for file
+ r = uv_fs_stat(loop, &req, test_file, NULL);
+ ASSERT_EQ(r, 0);
+
+ // Call uv_fs_fstat for symlink
+ r = uv_fs_stat(loop, &req_link, symlink_file, NULL);
+ ASSERT_EQ(r, 0);
+
+ // Compare st_dev
+ ASSERT_EQ(((uv_stat_t*)req.ptr)->st_dev, ((uv_stat_t*)req_link.ptr)->st_dev);
+
+ // Cleanup
+ uv_fs_req_cleanup(&req);
+ uv_fs_req_cleanup(&req_link);
+ unlink(test_file);
+ unlink(symlink_file);
+
+ MAKE_VALGRIND_HAPPY(loop);
+ return 0;
+}
+
+
TEST_IMPL(fs_fstat_stdio) {
int fd;
int res;
diff --git a/test/test-list.h b/test/test-list.h
index c6651299..5aa71f59 100644
--- a/test/test-list.h
+++ b/test/test-list.h
@@ -364,6 +364,7 @@ TEST_DECLARE (fs_mkdtemp)
TEST_DECLARE (fs_mkstemp)
TEST_DECLARE (fs_fstat)
TEST_DECLARE (fs_fstat_stdio)
+TEST_DECLARE (fs_fstat_st_dev)
TEST_DECLARE (fs_access)
TEST_DECLARE (fs_chmod)
TEST_DECLARE (fs_copyfile)
@@ -1083,6 +1084,7 @@ TASK_LIST_START
TEST_ENTRY (fs_mkstemp)
TEST_ENTRY (fs_fstat)
TEST_ENTRY (fs_fstat_stdio)
+ TEST_ENTRY (fs_fstat_st_dev)
TEST_ENTRY (fs_access)
TEST_ENTRY (fs_chmod)
TEST_ENTRY (fs_copyfile)