src/server/test/vfs.c

Tue, 03 Feb 2026 19:09:53 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Tue, 03 Feb 2026 19:09:53 +0100
changeset 661
a4e1ba59b733
parent 660
f00d03835dd9
permissions
-rw-r--r--

use bool instead of WSBool in strreplace

219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 /*
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 *
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4 * Copyright 2019 Olaf Wintermann. All rights reserved.
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 *
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 * Redistribution and use in source and binary forms, with or without
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 * modification, are permitted provided that the following conditions are met:
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 *
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 * 1. Redistributions of source code must retain the above copyright
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 * notice, this list of conditions and the following disclaimer.
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 *
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 * 2. Redistributions in binary form must reproduce the above copyright
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 * notice, this list of conditions and the following disclaimer in the
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 * documentation and/or other materials provided with the distribution.
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 *
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
26 * POSSIBILITY OF SUCH DAMAGE.
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 */
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29 #include <stdio.h>
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
30 #include <stdlib.h>
251
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
31 #include <errno.h>
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
32
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
33 #include <cx/string.h>
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
34 #include <cx/list.h>
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
35 #include <cx/map.h>
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
36
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
37 #include "../daemon/session.h"
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
38
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
39 #include "testutils.h"
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
40
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
41 #include "vfs.h"
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
42
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
43 typedef struct TestVFS {
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
44 CxMap *files;
248
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
45 int count_unlink;
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
46 int count_rmdir;
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
47 } TestVFS;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
48
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
49 typedef struct TestVFSFile {
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
50 VFSFile file;
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
51 cxmutstr path;
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
52 int isdir;
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
53 CxBuffer content;
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
54 } TestVFSFile;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
55
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
56 typedef struct TestVFSDir {
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
57 VFSDir dir;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
58 TestVFSFile *file;
579
e10457d74fe1 update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 490
diff changeset
59 CxMapIterator i;
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
60 cxmutstr name;
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
61 } TestVFSDir;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
62
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
63 /* dir io */
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
64
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
65 static const char* test_resource_name(char *url) {
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
66 cxstring urlstr = cx_str(url);
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
67 if(urlstr.ptr[urlstr.length-1] == '/') {
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
68 urlstr.length--;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
69 }
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
70 cxstring resname = cx_strrchr(urlstr, '/');
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
71 if(resname.length > 1) {
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
72 return resname.ptr+1;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
73 } else {
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
74 return url;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
75 }
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
76 }
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
77
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
78 int testvfs_readdir(VFS_DIR dir, VFS_ENTRY *entry, int getstat) {
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
79 TestVFS *vfs = dir->ctx->vfs->instance;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
80 TestVFSDir *vfsdir = (TestVFSDir*)dir;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
81
660
f00d03835dd9 update ucx to version 4.0
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 659
diff changeset
82 cxmutstr prefix = cx_strcat(CX_NULLSTR, 2, vfsdir->file->path, cx_str("/"));
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
83
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
84 // not the most efficient file system implementation ever, but it is only
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
85 // for testing
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
86 // check every entry in vfs->files and return, if the parent path
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
87 // matches the open directory
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
88 TestVFSFile *file = NULL;
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
89 cx_foreach(TestVFSFile *, entry, vfsdir->i) {
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
90 if(file) break;
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
91 cxmutstr file_path = cx_strcat(
660
f00d03835dd9 update ucx to version 4.0
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 659
diff changeset
92 CX_NULLSTR,
249
3b302093945c add webdav_delete tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 248
diff changeset
93 2,
3b302093945c add webdav_delete tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 248
diff changeset
94 prefix,
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
95 cx_str(test_resource_name(entry->path.ptr)));
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
96 file = cxMapGet(vfs->files, cx_hash_key(file_path.ptr, file_path.length));
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
97 free(file_path.ptr);
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
98 }
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
99 free(prefix.ptr);
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
100
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
101 if(file) {
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
102 vfsdir->name = cx_strdup_a(
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
103 pool_allocator(dir->ctx->sn->pool),
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
104 cx_str(test_resource_name(file->path.ptr)));
220
2915b6c11aec add test for webdav_op_propfind_children
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 219
diff changeset
105 ZERO(entry, sizeof(VFS_ENTRY));
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
106 entry->name = vfsdir->name.ptr;
249
3b302093945c add webdav_delete tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 248
diff changeset
107
3b302093945c add webdav_delete tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 248
diff changeset
108 if(getstat) {
3b302093945c add webdav_delete tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 248
diff changeset
109 ZERO(&entry->stat, sizeof(struct stat));
3b302093945c add webdav_delete tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 248
diff changeset
110 if(file->isdir) {
3b302093945c add webdav_delete tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 248
diff changeset
111 entry->stat.st_mode = S_IFDIR;
3b302093945c add webdav_delete tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 248
diff changeset
112 }
3b302093945c add webdav_delete tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 248
diff changeset
113 }
3b302093945c add webdav_delete tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 248
diff changeset
114
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
115 return 1;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
116 } else {
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
117 return 0;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
118 }
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
119 }
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
120
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
121 void testvfs_dir_close(VFS_DIR dir) {
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
122 TestVFSDir *testdir = (TestVFSDir*)dir;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
123 pool_free(testdir->dir.ctx->sn->pool, dir);
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
124
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
125 }
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
126
251
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
127 ssize_t testvfs_read(SYS_FILE fd, void *buf, size_t nbyte) {
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
128 TestVFSFile *file = (TestVFSFile*)fd;
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
129 return (ssize_t)cxBufferRead(buf, 1, nbyte, &file->content);
251
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
130 }
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
131
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
132 ssize_t testvfs_write(SYS_FILE fd, const void *buf, size_t nbyte) {
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
133 TestVFSFile *file = (TestVFSFile*)fd;
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
134 return (ssize_t)cxBufferWrite(buf, 1, nbyte, &file->content);
251
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
135 }
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
136
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
137 ssize_t testvfs_pread(SYS_FILE fd, void *buf, size_t nbyte, off_t offset) {
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
138 TestVFSFile *file = (TestVFSFile*)fd;
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
139 file->content.pos = (size_t)offset;
251
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
140 return testvfs_read(fd, buf, nbyte);
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
141 }
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
142
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
143 ssize_t testvfs_pwrite(SYS_FILE fd, const void *buf, size_t nbyte, off_t offset) {
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
144 TestVFSFile *file = (TestVFSFile*)fd;
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
145 file->content.pos = (size_t)offset;
251
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
146 return testvfs_write(fd, buf, nbyte);
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
147 }
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
148
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
149 off_t testvfs_seek(SYS_FILE fd, off_t offset, int whence) {
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
150 TestVFSFile *file = (TestVFSFile*)fd;
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
151 cxBufferSeek(&file->content, offset, whence);
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
152 return (off_t)file->content.pos;
251
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
153 }
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
154
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
155 void testvfs_close(SYS_FILE fd) {
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
156 TestVFSFile *file = (TestVFSFile*)fd;
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
157 file->content.pos = 0;
251
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
158 }
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
159
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
160 VFS_IO test_file_io = {
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
161 testvfs_read,
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
162 testvfs_write,
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
163 testvfs_pread,
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
164 testvfs_pwrite,
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
165 testvfs_seek,
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
166 testvfs_close,
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
167 NULL, /* aio_read */
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
168 NULL /* aio_write */
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
169 };
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
170
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
171 VFS_DIRIO test_dir_io = {
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
172 testvfs_readdir,
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
173 testvfs_dir_close
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
174 };
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
175
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
176
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
177 /* vfs funcs */
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
178
241
4adad7faf452 add proppatch op
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 220
diff changeset
179 SYS_FILE testvfs_open(VFSContext *ctx, const char *path, int oflags) {
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
180 TestVFS *vfs = ctx->vfs->instance;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
181 TestVFSFile *file = NULL;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
182
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
183 cxstring s_path = cx_str((char*)path);
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
184 if(cx_strsuffix(s_path, cx_str("/"))) {
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
185 s_path.length--;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
186 }
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
187
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
188 file = cxMapGet(vfs->files, cx_hash_key_bytes((const unsigned char*)s_path.ptr, s_path.length));
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
189 if(!file) {
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
190 if((oflags & O_CREAT) == O_CREAT) {
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
191 file = pool_malloc(ctx->sn->pool, sizeof(TestVFSFile));
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
192 ZERO(file, sizeof(TestVFSFile));
323
dc5b0fee49df fix TestVFSFile ctx initialization
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 251
diff changeset
193 file->file.ctx = ctx;
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
194 file->path = cx_strdup_a(pool_allocator(ctx->sn->pool), s_path);
251
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
195 file->file.io = &test_file_io;
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
196
660
f00d03835dd9 update ucx to version 4.0
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 659
diff changeset
197 cxBufferInit(&file->content, pool_allocator(ctx->sn->pool), pool_malloc(ctx->sn->pool, 2048), 2048, 0);
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
198
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
199 cxMapPut(vfs->files, cx_hash_key((void*)s_path.ptr, s_path.length), file);
251
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
200 } else {
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
201 ctx->vfs_errno = ENOENT;
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
202 }
251
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
203 }
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
204
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
205 return (SYS_FILE)file;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
206 }
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
207
241
4adad7faf452 add proppatch op
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 220
diff changeset
208 int testvfs_stat(VFSContext *ctx, const char *path, struct stat *buf) {
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
209 TestVFS *vfs = ctx->vfs->instance;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
210 TestVFSFile *file = NULL;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
211
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
212 cxstring s_path = cx_str((char*)path);
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
213 if(cx_strsuffix(s_path, cx_str("/"))) {
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
214 s_path.length--;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
215 }
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
216
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
217 file = cxMapGet(vfs->files, cx_hash_key((void*)s_path.ptr, s_path.length));
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
218 if(!file) {
251
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
219 ctx->vfs_errno = ENOENT;
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
220 return 1;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
221 }
249
3b302093945c add webdav_delete tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 248
diff changeset
222
3b302093945c add webdav_delete tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 248
diff changeset
223 ZERO(buf, sizeof(struct stat));
3b302093945c add webdav_delete tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 248
diff changeset
224 if(file->isdir) {
3b302093945c add webdav_delete tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 248
diff changeset
225 buf->st_mode = S_IFDIR;
3b302093945c add webdav_delete tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 248
diff changeset
226 }
3b302093945c add webdav_delete tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 248
diff changeset
227
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
228 return 0;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
229 }
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
230
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
231 int testvfs_fstat(VFSContext *ctx, SYS_FILE fd, struct stat *buf) {
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
232 return 0;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
233 }
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
234
241
4adad7faf452 add proppatch op
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 220
diff changeset
235 VFS_DIR testvfs_opendir(VFSContext *ctx, const char *path) {
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
236 TestVFS *vfs = ctx->vfs->instance;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
237 TestVFSFile *file = NULL;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
238
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
239 cxstring s_path = cx_str((char*)path);
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
240 if(cx_strsuffix(s_path, cx_str("/"))) {
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
241 s_path.length--;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
242 }
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
243
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
244 file = cxMapGet(vfs->files, cx_hash_key((void*)s_path.ptr, s_path.length));
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
245 if(!file) {
251
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
246 ctx->vfs_errno = ENOENT;
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
247 return NULL;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
248 }
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
249
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
250 if(!file->isdir) {
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
251 return NULL;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
252 }
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
253
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
254 TestVFSDir *dir = pool_malloc(ctx->sn->pool, sizeof(TestVFSDir));
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
255 ZERO(dir, sizeof(TestVFSDir));
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
256 dir->file = file;
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
257 dir->i = cxMapIteratorValues(vfs->files);
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
258
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
259 dir->dir.ctx = ctx;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
260 dir->dir.io = &test_dir_io;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
261
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
262 return (VFS_DIR)dir;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
263 }
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
264
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
265 VFS_DIR testvfs_fdopendir(VFSContext *ctx, SYS_FILE fd) {
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
266 TestVFS *vfs = ctx->vfs->instance;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
267 TestVFSFile *file = (TestVFSFile*)fd;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
268 if(!file->isdir) {
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
269 return NULL;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
270 }
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
271
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
272 TestVFSDir *dir = pool_malloc(ctx->sn->pool, sizeof(TestVFSDir));
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
273 ZERO(dir, sizeof(TestVFSDir));
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
274 dir->file = file;
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
275 dir->i = cxMapIteratorValues(vfs->files);
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
276
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
277 dir->dir.ctx = ctx;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
278 dir->dir.io = &test_dir_io;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
279
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
280 return (VFS_DIR)dir;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
281 }
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
282
241
4adad7faf452 add proppatch op
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 220
diff changeset
283 int testvfs_mkdir(VFSContext *ctx, const char *path) {
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
284 SYS_FILE fd = testvfs_open(ctx, path, O_CREAT);
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
285 if(!fd) {
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
286 return 1;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
287 }
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
288
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
289 TestVFSFile *file = (TestVFSFile*)fd;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
290 file->isdir = 1;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
291
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
292 return 0;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
293 }
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
294
241
4adad7faf452 add proppatch op
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 220
diff changeset
295 int testvfs_unlink(VFSContext *ctx, const char *path) {
248
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
296 TestVFS *vfs = ctx->vfs->instance;
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
297 CxHashKey path_key = cx_hash_key_str(path);
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
298 TestVFSFile *file = cxMapGet(vfs->files, path_key);
248
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
299 if(!file) {
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
300 return 1;
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
301 }
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
302
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
303 if(file->isdir) {
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
304 return 1;
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
305 }
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
306
490
d218607f5a7e update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
307 cxMapRemove(vfs->files, path_key);
248
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
308 vfs->count_unlink++;
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
309 return 0;
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
310 }
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
311
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
312 int testvfs_rmdir(VFSContext *ctx, const char *path) {
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
313 TestVFS *vfs = ctx->vfs->instance;
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
314 CxHashKey path_key = cx_hash_key_str(path);
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
315 TestVFSFile *dir = cxMapGet(vfs->files, path_key);
248
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
316 if(!dir) {
251
f727a21497bb add basic PUT implementation and tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 249
diff changeset
317 ctx->vfs_errno = ENOENT;
248
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
318 return 1;
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
319 }
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
320
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
321 if(!dir->isdir) {
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
322 return 1;
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
323 }
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
324
579
e10457d74fe1 update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 490
diff changeset
325 CxMapIterator i = cxMapIteratorValues(vfs->files);
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
326 cx_foreach(TestVFSFile *, f, i) {
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 323
diff changeset
327 if(f->path.length > dir->path.length && cx_strprefix(cx_strcast(f->path), cx_strcast(dir->path))){
248
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
328 return 1; // dir not empty
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
329 }
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
330 }
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
331
490
d218607f5a7e update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
332 cxMapRemove(vfs->files, path_key);
248
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
333 vfs->count_rmdir++;
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
334 return 0;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
335 }
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
336
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
337 static VFS testVFSClass = {
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
338 testvfs_open,
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
339 testvfs_stat,
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
340 testvfs_fstat,
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
341 testvfs_opendir,
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
342 testvfs_fdopendir,
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
343 testvfs_mkdir,
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
344 testvfs_unlink,
248
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
345 testvfs_rmdir,
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
346 0,
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
347 NULL
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
348 };
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
349
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
350
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
351 VFS* testvfs_create(Session *sn) {
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
352 TestVFS *vfs = pool_malloc(sn->pool, sizeof(TestVFS));
248
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
353 vfs->count_unlink = 0;
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
354 vfs->count_rmdir = 0;
490
d218607f5a7e update ucx
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
355 vfs->files = cxHashMapCreate(pool_allocator(sn->pool), CX_STORE_POINTERS, 64);
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
356
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
357 testVFSClass.instance = vfs;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
358 return &testVFSClass;
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
359 }
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
360
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
361
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
362 /* ------------------------------------------------------------------------- */
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
363 //
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
364 // VFS Tests
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
365 //
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
366 /* ------------------------------------------------------------------------- */
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
367
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
368 CX_TEST(test_vfs_open) {
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
369 Session *sn = testutil_session();
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
370 Request *rq = testutil_request(sn->pool, "PUT", "/");
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
371 rq->vfs = testvfs_create(sn);
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
372
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
373 VFSContext *vfs = vfs_request_context(sn, rq);
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
374
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
375 CX_TEST_DO {
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
376
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
377 CX_TEST_ASSERT(vfs);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
378
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
379 SYS_FILE f1 = vfs_open(vfs, "/file1", O_CREAT);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
380 CX_TEST_ASSERT(f1);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
381
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
382 SYS_FILE f2 = vfs_open(vfs, "/file1", 0);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
383 CX_TEST_ASSERT(f2);
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
384
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
385 }
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
386
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
387 testutil_destroy_session(sn);
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
388 }
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
389
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
390 CX_TEST(test_vfs_mkdir) {
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
391 Session *sn = testutil_session();
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
392 Request *rq = testutil_request(sn->pool, "PUT", "/");
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
393 rq->vfs = testvfs_create(sn);
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
394
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
395 VFSContext *vfs = vfs_request_context(sn, rq);
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
396
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
397 CX_TEST_DO {
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
398
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
399 int err = vfs_mkdir(vfs, "/dir");
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
400 CX_TEST_ASSERT(err == 0);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
401
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
402 SYS_FILE fd = vfs_open(vfs, "/dir", 0);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
403 CX_TEST_ASSERT(fd);
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
404
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
405 }
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
406
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
407 testutil_destroy_session(sn);
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
408 }
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
409
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
410 CX_TEST(test_vfs_opendir) {
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
411 Session *sn = testutil_session();
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
412 Request *rq = testutil_request(sn->pool, "PUT", "/");
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
413 rq->vfs = testvfs_create(sn);
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
414
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
415 VFSContext *vfs = vfs_request_context(sn, rq);
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
416
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
417 CX_TEST_DO {
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
418
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
419 int err = vfs_mkdir(vfs, "/dir");
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
420 CX_TEST_ASSERT(err == 0);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
421
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
422 VFSDir *dir = vfs_opendir(vfs, "/dir");
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
423 CX_TEST_ASSERT(dir);
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
424
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
425 }
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
426
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
427 testutil_destroy_session(sn);
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
428 }
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
429
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
430 CX_TEST(test_vfs_readdir) {
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
431 Session *sn = testutil_session();
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
432 Request *rq = testutil_request(sn->pool, "PUT", "/");
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
433 rq->vfs = testvfs_create(sn);
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
434
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
435 VFSContext *vfs = vfs_request_context(sn, rq);
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
436
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
437 CX_TEST_DO {
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
438
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
439 int err = vfs_mkdir(vfs, "/dir");
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
440 CX_TEST_ASSERT(err == 0);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
441
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
442 // add some test file to /dir
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
443 CX_TEST_ASSERT(vfs_open(vfs, "/dir/file1", O_CREAT));
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
444 CX_TEST_ASSERT(vfs_open(vfs, "/dir/file2", O_CREAT));
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
445 CX_TEST_ASSERT(vfs_open(vfs, "/dir/file3", O_CREAT));
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
446 CX_TEST_ASSERT(vfs_open(vfs, "/dir/file4", O_CREAT));
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
447
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
448 VFSDir *dir = vfs_opendir(vfs, "/dir");
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
449 CX_TEST_ASSERT(dir);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
450
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
451 CxMap *files = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 8);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
452
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
453 VFSEntry entry;
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
454 while(vfs_readdir(dir, &entry)) {
659
07b815faa6ac remove unnecessary usage of cx_hash_key_str
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 633
diff changeset
455 cxMapPut(files, entry.name, dir);
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
456 }
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
457
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
458 CX_TEST_ASSERT(cxMapSize(files)== 4);
659
07b815faa6ac remove unnecessary usage of cx_hash_key_str
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 633
diff changeset
459 CX_TEST_ASSERT(cxMapGet(files, "file1"));
07b815faa6ac remove unnecessary usage of cx_hash_key_str
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 633
diff changeset
460 CX_TEST_ASSERT(cxMapGet(files, "file2"));
07b815faa6ac remove unnecessary usage of cx_hash_key_str
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 633
diff changeset
461 CX_TEST_ASSERT(cxMapGet(files, "file3"));
07b815faa6ac remove unnecessary usage of cx_hash_key_str
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 633
diff changeset
462 CX_TEST_ASSERT(cxMapGet(files, "file4"));
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
463
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
464 cxMapFree(files);
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
465
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
466 }
219
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
467
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
468 testutil_destroy_session(sn);
dd6c155c082a add simple vfs implementation for testing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
469 }
248
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
470
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
471 CX_TEST(test_vfs_unlink) {
248
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
472 Session *sn = testutil_session();
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
473 Request *rq = testutil_request(sn->pool, "PUT", "/");
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
474 rq->vfs = testvfs_create(sn);
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
475
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
476 VFSContext *vfs = vfs_request_context(sn, rq);
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
477
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
478 CX_TEST_DO {
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
479 // prepare test
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
480 int err;
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
481 err = vfs_mkdir(vfs, "/dir1");
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
482 CX_TEST_ASSERT(err == 0);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
483 err = vfs_mkdir(vfs, "/dir2");
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
484 CX_TEST_ASSERT(err == 0);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
485
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
486 SYS_FILE f1 = vfs_open(vfs, "/file1", O_CREAT);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
487 CX_TEST_ASSERT(f1);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
488
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
489 SYS_FILE f2 = vfs_open(vfs, "/file2", O_CREAT);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
490 CX_TEST_ASSERT(f1);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
491
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
492 SYS_FILE f3 = vfs_open(vfs, "/dir1/file3", O_CREAT);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
493 CX_TEST_ASSERT(f1);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
494
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
495 // test unlink
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
496 err = vfs_unlink(vfs, "/file1");
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
497 CX_TEST_ASSERT(err == 0);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
498 err = vfs_unlink(vfs, "/dir1/file3");
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
499 CX_TEST_ASSERT(err == 0);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
500
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
501 err = vfs_unlink(vfs, "/filex");
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
502 CX_TEST_ASSERT(err != 0);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
503
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
504 // check if files were removed
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
505 SYS_FILE o1 = vfs_open(vfs, "/file1", O_RDONLY);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
506 CX_TEST_ASSERT(o1 == NULL);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
507 SYS_FILE o3 = vfs_open(vfs, "/dir1/file3", O_RDONLY);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
508 CX_TEST_ASSERT(o1 == NULL);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
509
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
510 // file2 should still be there
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
511 SYS_FILE o2 = vfs_open(vfs, "/file2", O_RDONLY);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
512 CX_TEST_ASSERT(o2);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
513
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
514 // check if dir unlink fails
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
515 err = vfs_unlink(vfs, "/dir1");
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
516 CX_TEST_ASSERT(err != 0);
248
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
517
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
518 }
248
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
519
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
520 testutil_destroy_session(sn);
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
521 }
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
522
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
523 CX_TEST(test_vfs_rmdir) {
248
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
524 Session *sn = testutil_session();
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
525 Request *rq = testutil_request(sn->pool, "PUT", "/");
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
526 rq->vfs = testvfs_create(sn);
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
527
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
528 VFSContext *vfs = vfs_request_context(sn, rq);
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
529
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
530 CX_TEST_DO {
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
531 // prepare test
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
532 int err;
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
533 err = vfs_mkdir(vfs, "/dir1");
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
534 CX_TEST_ASSERT(err == 0);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
535 err = vfs_mkdir(vfs, "/dir2");
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
536 CX_TEST_ASSERT(err == 0);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
537
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
538 SYS_FILE f1 = vfs_open(vfs, "/dir1/file1", O_CREAT);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
539 CX_TEST_ASSERT(f1);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
540
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
541 err = vfs_rmdir(vfs, "/dir1");
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
542 CX_TEST_ASSERT(err != 0);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
543 err = vfs_rmdir(vfs, "/dir2");
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
544 CX_TEST_ASSERT(err == 0);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
545
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
546 err = vfs_unlink(vfs, "/dir1/file1");
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
547 CX_TEST_ASSERT(err == 0);
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
548 err = vfs_rmdir(vfs, "/dir1");
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
549 CX_TEST_ASSERT(err == 0);
248
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
550
633
392ec9026b07 port old ucx2 tests to ucx3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 579
diff changeset
551 }
248
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
552
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
553 testutil_destroy_session(sn);
bc8f8ddbad2e add vfs unlink and rmdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
554 }

mercurial