Mon, 18 Apr 2022 11:49:37 +0200
add pg mkdir tests
287
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | /* |
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
3 | * |
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
4 | * Copyright 2022 Olaf Wintermann. All rights reserved. |
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
5 | * |
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
6 | * Redistribution and use in source and binary forms, with or without |
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
7 | * modification, are permitted provided that the following conditions are met: |
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
8 | * |
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
9 | * 1. Redistributions of source code must retain the above copyright |
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
10 | * notice, this list of conditions and the following disclaimer. |
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | * |
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12 | * 2. Redistributions in binary form must reproduce the above copyright |
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
13 | * notice, this list of conditions and the following disclaimer in the |
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
14 | * documentation and/or other materials provided with the distribution. |
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
15 | * |
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
a171da778817
prepare build system for postgresql plugin tests
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 |
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
26 | * POSSIBILITY OF SUCH DAMAGE. |
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
27 | */ |
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
28 | |
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
29 | #include <stdio.h> |
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
30 | |
289
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
31 | #include "../../util/util.h" |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
32 | #include "../../test/testutils.h" |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
33 | #include "../../public/nsapi.h" |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
34 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
35 | #include <ucx/string.h> |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
36 | #include <ucx/utils.h> |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
37 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
38 | #include "pgtest.h" |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
39 | #include "vfs.h" |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
40 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
41 | #include <libpq-fe.h> |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
42 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
43 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
44 | static char *pg_connstr = "postgresql://localhost/test1"; |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
45 | static int abort_pg_tests = 0; |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
46 | static PGconn *test_connection; |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
47 | static ResourceData resdata; |
287
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
48 | |
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
49 | void register_pg_tests(int argc, char **argv, UcxTestSuite *suite) { |
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
50 | |
289
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
51 | test_connection = PQconnectdb(pg_connstr); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
52 | if(!test_connection) { |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
53 | abort_pg_tests = 1; |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
54 | } |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
55 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
56 | if(PQstatus(test_connection) != CONNECTION_OK) { |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
57 | abort_pg_tests = 1; |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
58 | } |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
59 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
60 | ucx_test_register(suite, test_pg_conn); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
61 | if(!abort_pg_tests) { |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
62 | resdata.data = test_connection; |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
63 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
64 | ucx_test_register(suite, test_pg_vfs_open); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
65 | ucx_test_register(suite, test_pg_vfs_io); |
293
d3899857a81d
add pg stat tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
66 | ucx_test_register(suite, test_pg_vfs_stat); |
294
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
67 | ucx_test_register(suite, test_pg_vfs_mkdir); |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
68 | ucx_test_register(suite, test_pg_vfs_unlink); |
289
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
69 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
70 | PGresult *result = PQexec(test_connection, "BEGIN"); |
293
d3899857a81d
add pg stat tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
71 | PQclear(result); |
289
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
72 | } |
287
a171da778817
prepare build system for postgresql plugin tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
73 | } |
289
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
74 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
75 | UCX_TEST(test_pg_conn) { |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
76 | char *msg = test_connection ? PQerrorMessage(test_connection) : "no connection"; |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
77 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
78 | UCX_TEST_BEGIN; |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
79 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
80 | if(abort_pg_tests) { |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
81 | int msglen = strlen(msg); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
82 | if(msglen > 0 && msg[msglen-1] == '\n') { |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
83 | msglen--; |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
84 | } |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
85 | fprintf(stdout, "%.*s: ", msglen, msg); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
86 | UCX_TEST_ASSERT(1 == 0, "skip pg tests"); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
87 | } else { |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
88 | UCX_TEST_ASSERT(1 == 1, "ok"); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
89 | } |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
90 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
91 | UCX_TEST_END; |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
92 | } |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
93 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
94 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
95 | static VFS* create_test_pgvfs(Session *sn, Request *rq) { |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
96 | return pg_vfs_create_from_resourcedata(sn, rq, &resdata); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
97 | } |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
98 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
99 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
100 | UCX_TEST(test_pg_vfs_open) { |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
101 | Session *sn = testutil_session(); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
102 | Request *rq = testutil_request(sn->pool, "PUT", "/"); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
103 | rq->vfs = create_test_pgvfs(sn, rq); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
104 | VFSContext *vfs = vfs_request_context(sn, rq); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
105 | SYS_FILE file; |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
106 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
107 | UCX_TEST_BEGIN; |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
108 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
109 | file = vfs_open(vfs, "/test_notfound1", O_RDONLY); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
110 | UCX_TEST_ASSERT(!file, "/test_notfound should not exist"); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
111 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
112 | file = vfs_open(vfs, "/test_file1", O_RDWR | O_CREAT); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
113 | UCX_TEST_ASSERT(file, "cannot create file 1"); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
114 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
115 | vfs_close(file); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
116 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
117 | UCX_TEST_END; |
294
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
118 | |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
119 | testutil_destroy_session(sn); |
289
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
120 | } |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
121 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
122 | UCX_TEST(test_pg_vfs_io) { |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
123 | Session *sn = testutil_session(); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
124 | Request *rq = testutil_request(sn->pool, "PUT", "/"); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
125 | rq->vfs = create_test_pgvfs(sn, rq); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
126 | VFSContext *vfs = vfs_request_context(sn, rq); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
127 | SYS_FILE file; |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
128 | SYS_FILE file2; |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
129 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
130 | UCX_TEST_BEGIN; |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
131 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
132 | file = vfs_open(vfs, "/test_f1", O_WRONLY | O_CREAT); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
133 | UCX_TEST_ASSERT(file, "cannot open file1"); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
134 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
135 | int w = system_fwrite(file, "test1\n", 6); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
136 | UCX_TEST_ASSERT(w == 6, "fwrite ret (1)"); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
137 | w = system_fwrite(file, "2", 1); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
138 | UCX_TEST_ASSERT(w == 1, "fwrite ret (2)"); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
139 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
140 | vfs_close(file); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
141 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
142 | file = vfs_open(vfs, "/test_f1", O_RDONLY); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
143 | file2 = vfs_open(vfs, "/test_f2", O_WRONLY | O_CREAT); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
144 | UCX_TEST_ASSERT(file, "cannot open file1"); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
145 | UCX_TEST_ASSERT(file2, "cannot open file2"); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
146 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
147 | char buf[128]; |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
148 | int r = system_fread(file, buf, 128); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
149 | UCX_TEST_ASSERT(r == 7, "cannot read from file1"); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
150 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
151 | w = system_fwrite(file2, buf, r); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
152 | UCX_TEST_ASSERT(w == 7, "cannot write to file2"); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
153 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
154 | vfs_close(file); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
155 | vfs_close(file2); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
156 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
157 | file2 = vfs_open(vfs, "/test_f2", O_RDONLY); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
158 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
159 | r = system_fread(file, buf, 128); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
160 | UCX_TEST_ASSERT(r == 7, "fread ret"); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
161 | UCX_TEST_ASSERT(!memcmp(buf, "test1\n2", 7), "wrong buffer content after read"); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
162 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
163 | vfs_close(file2); |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
164 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
165 | |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
166 | UCX_TEST_END; |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
167 | |
294
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
168 | testutil_destroy_session(sn); |
289
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
169 | } |
285d483db2fb
add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
287
diff
changeset
|
170 | |
290
efc10acf539f
implement pg vfs mkdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
289
diff
changeset
|
171 | UCX_TEST(test_pg_vfs_stat) { |
efc10acf539f
implement pg vfs mkdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
289
diff
changeset
|
172 | Session *sn = testutil_session(); |
efc10acf539f
implement pg vfs mkdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
289
diff
changeset
|
173 | Request *rq = testutil_request(sn->pool, "PUT", "/"); |
efc10acf539f
implement pg vfs mkdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
289
diff
changeset
|
174 | rq->vfs = create_test_pgvfs(sn, rq); |
efc10acf539f
implement pg vfs mkdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
289
diff
changeset
|
175 | VFSContext *vfs = vfs_request_context(sn, rq); |
efc10acf539f
implement pg vfs mkdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
289
diff
changeset
|
176 | |
efc10acf539f
implement pg vfs mkdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
289
diff
changeset
|
177 | UCX_TEST_BEGIN; |
efc10acf539f
implement pg vfs mkdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
289
diff
changeset
|
178 | |
293
d3899857a81d
add pg stat tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
179 | // testdata, content doesn't matter |
d3899857a81d
add pg stat tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
180 | char test1[512]; |
d3899857a81d
add pg stat tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
181 | memset(test1, 'x', 512); |
d3899857a81d
add pg stat tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
182 | const int test_len1 = 200; |
d3899857a81d
add pg stat tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
183 | const int test_len2 = 432; |
d3899857a81d
add pg stat tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
184 | |
d3899857a81d
add pg stat tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
185 | SYS_FILE f1 = vfs_open(vfs, "/test_s1", O_WRONLY|O_CREAT); |
d3899857a81d
add pg stat tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
186 | UCX_TEST_ASSERT(f1, "cannot open test_s1"); |
d3899857a81d
add pg stat tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
187 | system_fwrite(f1, test1, test_len1); |
d3899857a81d
add pg stat tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
188 | vfs_close(f1); |
d3899857a81d
add pg stat tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
189 | |
d3899857a81d
add pg stat tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
190 | SYS_FILE f2 = vfs_open(vfs, "/test_s2", O_RDWR|O_CREAT); |
d3899857a81d
add pg stat tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
191 | UCX_TEST_ASSERT(f2, "cannot open test_s2"); |
d3899857a81d
add pg stat tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
192 | system_fwrite(f2, test1, test_len2); |
d3899857a81d
add pg stat tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
193 | vfs_close(f2); |
d3899857a81d
add pg stat tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
194 | |
d3899857a81d
add pg stat tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
195 | struct stat st1, st2; |
d3899857a81d
add pg stat tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
196 | int r1 = vfs_stat(vfs, "/test_s1", &st1); |
d3899857a81d
add pg stat tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
197 | int r2 = vfs_stat(vfs, "/test_s2", &st2); |
d3899857a81d
add pg stat tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
198 | |
d3899857a81d
add pg stat tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
199 | UCX_TEST_ASSERT(r1 == 0, "stat1 failed"); |
d3899857a81d
add pg stat tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
200 | UCX_TEST_ASSERT(r2 == 0, "stat2 failed"); |
d3899857a81d
add pg stat tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
201 | |
d3899857a81d
add pg stat tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
202 | UCX_TEST_ASSERT(st1.st_size == test_len1, "s1 wrong length"); |
d3899857a81d
add pg stat tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
203 | UCX_TEST_ASSERT(st2.st_size == test_len2, "s2 wrong length"); |
d3899857a81d
add pg stat tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
204 | |
d3899857a81d
add pg stat tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
205 | int testfail = vfs_stat(vfs, "/test_stat_fail", &st1); |
d3899857a81d
add pg stat tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
206 | UCX_TEST_ASSERT(testfail != 0, "stat 3 should fail"); |
d3899857a81d
add pg stat tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
290
diff
changeset
|
207 | |
290
efc10acf539f
implement pg vfs mkdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
289
diff
changeset
|
208 | UCX_TEST_END; |
294
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
209 | |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
210 | testutil_destroy_session(sn); |
290
efc10acf539f
implement pg vfs mkdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
289
diff
changeset
|
211 | } |
efc10acf539f
implement pg vfs mkdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
289
diff
changeset
|
212 | |
efc10acf539f
implement pg vfs mkdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
289
diff
changeset
|
213 | UCX_TEST(test_pg_vfs_mkdir) { |
295
73a1243fce15
add pg mkdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
294
diff
changeset
|
214 | Session *sn = testutil_session(); |
73a1243fce15
add pg mkdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
294
diff
changeset
|
215 | Request *rq = testutil_request(sn->pool, "PUT", "/"); |
73a1243fce15
add pg mkdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
294
diff
changeset
|
216 | rq->vfs = create_test_pgvfs(sn, rq); |
73a1243fce15
add pg mkdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
294
diff
changeset
|
217 | VFSContext *vfs = vfs_request_context(sn, rq); |
290
efc10acf539f
implement pg vfs mkdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
289
diff
changeset
|
218 | |
295
73a1243fce15
add pg mkdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
294
diff
changeset
|
219 | UCX_TEST_BEGIN; |
73a1243fce15
add pg mkdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
294
diff
changeset
|
220 | |
73a1243fce15
add pg mkdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
294
diff
changeset
|
221 | SYS_FILE f1 = vfs_open(vfs, "/test_mkdir/file", O_WRONLY|O_CREAT); |
73a1243fce15
add pg mkdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
294
diff
changeset
|
222 | UCX_TEST_ASSERT(f1 == NULL, "open should fail"); |
73a1243fce15
add pg mkdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
294
diff
changeset
|
223 | |
73a1243fce15
add pg mkdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
294
diff
changeset
|
224 | int r = vfs_mkdir(vfs, "/test_mkdir"); |
73a1243fce15
add pg mkdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
294
diff
changeset
|
225 | UCX_TEST_ASSERT(r == 0, "mkdir failed"); |
73a1243fce15
add pg mkdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
294
diff
changeset
|
226 | |
73a1243fce15
add pg mkdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
294
diff
changeset
|
227 | f1 = vfs_open(vfs, "/test_mkdir/file", O_WRONLY|O_CREAT); |
73a1243fce15
add pg mkdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
294
diff
changeset
|
228 | UCX_TEST_ASSERT(f1, "open failed"); |
73a1243fce15
add pg mkdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
294
diff
changeset
|
229 | |
73a1243fce15
add pg mkdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
294
diff
changeset
|
230 | r = vfs_mkdir(vfs, "/test_mkdir/test_sub"); |
73a1243fce15
add pg mkdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
294
diff
changeset
|
231 | UCX_TEST_ASSERT(r == 0, "mkdir failed (2)"); |
73a1243fce15
add pg mkdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
294
diff
changeset
|
232 | |
73a1243fce15
add pg mkdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
294
diff
changeset
|
233 | UCX_TEST_END; |
73a1243fce15
add pg mkdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
294
diff
changeset
|
234 | |
73a1243fce15
add pg mkdir tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
294
diff
changeset
|
235 | testutil_destroy_session(sn); |
290
efc10acf539f
implement pg vfs mkdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
289
diff
changeset
|
236 | } |
294
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
237 | |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
238 | UCX_TEST(test_pg_vfs_unlink) { |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
239 | Session *sn = testutil_session(); |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
240 | Request *rq = testutil_request(sn->pool, "PUT", "/"); |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
241 | rq->vfs = create_test_pgvfs(sn, rq); |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
242 | VFSContext *vfs = vfs_request_context(sn, rq); |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
243 | |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
244 | UCX_TEST_BEGIN; |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
245 | |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
246 | SYS_FILE f1 = vfs_open(vfs, "/test_unlink1", O_WRONLY|O_CREAT); |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
247 | UCX_TEST_ASSERT(f1, "cannot create test file"); |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
248 | system_fwrite(f1, "test", 4); |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
249 | |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
250 | PgFile *pgfile = f1->data; |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
251 | Oid oid = pgfile->oid; |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
252 | |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
253 | vfs_close(f1); |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
254 | |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
255 | int r = vfs_unlink(vfs, "/test_unlink1"); |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
256 | UCX_TEST_ASSERT(r == 0, "unlink failed"); |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
257 | |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
258 | f1 = vfs_open(vfs, "/test_unlink1", O_RDONLY); |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
259 | UCX_TEST_ASSERT(f1 == NULL, "test file not deleted"); |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
260 | |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
261 | int pgfd = lo_open(test_connection, oid, INV_READ); |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
262 | UCX_TEST_ASSERT(pgfd < 0, "large object not deleted"); |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
263 | |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
264 | r = vfs_unlink(vfs, "/test_unlink1"); |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
265 | UCX_TEST_ASSERT(r, "unlink should fail"); |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
266 | |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
267 | UCX_TEST_END; |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
268 | |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
269 | testutil_destroy_session(sn); |
277a5896a2ec
implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
293
diff
changeset
|
270 | } |