add pg mkdir tests webdav

Mon, 18 Apr 2022 11:49:37 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Mon, 18 Apr 2022 11:49:37 +0200
branch
webdav
changeset 295
73a1243fce15
parent 294
277a5896a2ec
child 296
78e92337fa4e

add pg mkdir tests

src/server/plugins/postgresql/pgtest.c file | annotate | diff | comparison | revisions
src/server/plugins/postgresql/vfs.c file | annotate | diff | comparison | revisions
src/server/plugins/postgresql/vfs.h file | annotate | diff | comparison | revisions
--- a/src/server/plugins/postgresql/pgtest.c	Mon Apr 18 10:53:13 2022 +0200
+++ b/src/server/plugins/postgresql/pgtest.c	Mon Apr 18 11:49:37 2022 +0200
@@ -211,7 +211,28 @@
 }
 
 UCX_TEST(test_pg_vfs_mkdir) {
+    Session *sn = testutil_session();
+    Request *rq = testutil_request(sn->pool, "PUT", "/");
+    rq->vfs = create_test_pgvfs(sn, rq);
+    VFSContext *vfs = vfs_request_context(sn, rq);
     
+    UCX_TEST_BEGIN;
+    
+    SYS_FILE f1 = vfs_open(vfs, "/test_mkdir/file", O_WRONLY|O_CREAT);
+    UCX_TEST_ASSERT(f1 == NULL, "open should fail");
+    
+    int r = vfs_mkdir(vfs, "/test_mkdir");
+    UCX_TEST_ASSERT(r == 0, "mkdir failed");
+    
+    f1 = vfs_open(vfs, "/test_mkdir/file", O_WRONLY|O_CREAT);
+    UCX_TEST_ASSERT(f1, "open failed");
+    
+    r = vfs_mkdir(vfs, "/test_mkdir/test_sub");
+    UCX_TEST_ASSERT(r == 0, "mkdir failed (2)");
+    
+    UCX_TEST_END;
+    
+    testutil_destroy_session(sn);
 }
 
 UCX_TEST(test_pg_vfs_unlink) {
--- a/src/server/plugins/postgresql/vfs.c	Mon Apr 18 10:53:13 2022 +0200
+++ b/src/server/plugins/postgresql/vfs.c	Mon Apr 18 11:49:37 2022 +0200
@@ -679,8 +679,8 @@
     return pg_remove_file(ctx, pg, resource_id, oid);
 }
 
-int pg_vfs_rmdir(VFSContext *Ctx, const char *path) {
-    return 1;
+int pg_vfs_rmdir(VFSContext *ctx, const char *path) {
+    
 }
 
 
--- a/src/server/plugins/postgresql/vfs.h	Mon Apr 18 10:53:13 2022 +0200
+++ b/src/server/plugins/postgresql/vfs.h	Mon Apr 18 11:49:37 2022 +0200
@@ -117,7 +117,7 @@
 VFS_DIR pg_vfs_fdopendir(VFSContext *ctx, SYS_FILE fd);
 int pg_vfs_mkdir(VFSContext *ctx, const char *path);
 int pg_vfs_unlink(VFSContext *ctx, const char *path);
-int pg_vfs_rmdir(VFSContext *Ctx, const char *path);
+int pg_vfs_rmdir(VFSContext *ctx, const char *path);
 
     
 ssize_t pg_vfs_io_read(SYS_FILE fd, void *buf, size_t nbyte);

mercurial