MIDAS
Loading...
Searching...
No Matches
test_odb.cxx File Reference
#include <stdio.h>
#include <sys/time.h>
#include <iostream>
#include <assert.h>
#include <signal.h>
#include <string.h>
#include <stdlib.h>
#include "tmfe.h"
#include "midas.h"
Include dependency graph for test_odb.cxx:

Go to the source code of this file.

Functions

std::string toString (int i)
 
void print_ia (const std::vector< int > &ia)
 
void print_da (const std::vector< double > &da)
 
bool report_fail (const char *text)
 
bool report_fail (const std::string &text)
 
bool rmdir (HNDLE hDB, HNDLE hROOT, const char *path)
 
bool test_mkdir (HNDLE hDB, HNDLE hROOT, const char *path)
 
bool test_mkdir_fail (HNDLE hDB, HNDLE hROOT, const char *path, int fail_status)
 
bool test_chdir (HNDLE hDB, HNDLE hROOT, const char *path, HNDLE *phKey)
 
bool test_delete_key (HNDLE hDB, HNDLE hROOT, const char *path)
 
bool test_delete (HNDLE hDB, HNDLE hROOT, const char *path)
 
bool test_find_fail (HNDLE hDB, HNDLE hROOT, const char *path, int fail_status)
 
bool test_find_key_fail (HNDLE hDB, HNDLE hROOT, const char *path, int fail_status)
 
bool test_symlink (HNDLE hDB, HNDLE hROOT, const char *path, const char *link_target)
 
bool test_symlink_fail (HNDLE hDB, HNDLE hROOT, const char *path, const char *link_target, int fail_status)
 
bool test_enum (const std::vector< HNDLE > &hlist, const std::vector< KEY > &klist)
 
bool test_enum_links (const std::vector< HNDLE > &hlist, const std::vector< KEY > &klist)
 
bool test_all (HNDLE hDB)
 
int main (int argc, char *argv[])
 

Variables

static int gCountFail = 0
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 448 of file test_odb.cxx.

449{
450 setbuf(stdout,NULL);
451 setbuf(stderr,NULL);
452
453 signal(SIGILL, SIG_DFL);
454 signal(SIGBUS, SIG_DFL);
455 signal(SIGSEGV, SIG_DFL);
456 signal(SIGPIPE, SIG_DFL);
457
458 const char* hostname = NULL;
459 const char* exptname = NULL;
460
461 if (argc > 1)
462 hostname = argv[1];
463
464 TMFE* mfe = TMFE::Instance();
465
466 TMFeResult r;
467
468 r = mfe->Connect("test_odb", hostname, exptname);
469
470 if (r.error_flag) {
471 fprintf(stderr,"Cannot connect to MIDAS, error %s\n", r.error_message.c_str());
472 return -1;
473 }
474
475 HNDLE hDB = mfe->fDB;
476
477 bool ok = true;
478
479 printf("\n");
480 printf("Starting tests:\n");
481 printf("\n");
482
483 ok &= test_all(hDB);
484
485 if (mfe)
486 mfe->Disconnect();
487
488 if (ok) {
489 printf("\n");
490 printf("Tests passed OK\n");
491 printf("\n");
492 } else {
493 printf("\n");
494 printf("Number of FAILED tests: %d\n", gCountFail);
495 printf("\n");
496 }
497
498 return 0;
499}
Definition tmfe.h:381
int fDB
ODB database handle.
Definition tmfe.h:394
TMFeResult Connect(const char *progname=NULL, const char *hostname=NULL, const char *exptname=NULL)
Definition tmfe.cxx:65
static TMFE * Instance()
Definition tmfe.cxx:57
TMFeResult Disconnect()
Definition tmfe.cxx:154
bool error_flag
Definition tmfe.h:89
std::string error_message
Definition tmfe.h:91
HNDLE hDB
main ODB handle
Definition mana.cxx:207
INT HNDLE
Definition midas.h:132
static int gCountFail
Definition test_odb.cxx:49
bool test_all(HNDLE hDB)
Definition test_odb.cxx:253
Here is the call graph for this function:

◆ print_da()

void print_da ( const std::vector< double > &  da)

Definition at line 37 of file test_odb.cxx.

38{
39 int size = da.size();
40 printf("int[%d] has [", size);
41 for (int i=0; i<size; i++) {
42 if (i>0)
43 printf(", ");
44 printf("%f", da[i]);
45 }
46 printf("]");
47}
INT i
Definition mdump.cxx:32

◆ print_ia()

void print_ia ( const std::vector< int > &  ia)

Definition at line 25 of file test_odb.cxx.

26{
27 int size = ia.size();
28 printf("int[%d] has [", size);
29 for (int i=0; i<size; i++) {
30 if (i>0)
31 printf(", ");
32 printf("%d", ia[i]);
33 }
34 printf("]");
35}

◆ report_fail() [1/2]

bool report_fail ( const char *  text)

Definition at line 51 of file test_odb.cxx.

52{
53 printf("FAIL: %s\n", text);
54 gCountFail++;
55 return false;
56}
Here is the caller graph for this function:

◆ report_fail() [2/2]

bool report_fail ( const std::string &  text)

Definition at line 58 of file test_odb.cxx.

59{
60 printf("FAIL: %s\n", text.c_str());
61 gCountFail++;
62 return false;
63}

◆ rmdir()

bool rmdir ( HNDLE  hDB,
HNDLE  hROOT,
const char *  path 
)

Definition at line 65 of file test_odb.cxx.

66{
67 HNDLE hKey;
68
69 printf("rmdir(%s)\n", path);
70
71 int status = db_find_link(hDB, hROOT, path, &hKey);
72
73 if (status == DB_NO_KEY)
74 return true;
75
76 if (status != DB_SUCCESS)
77 return report_fail(msprintf("test_mkdir: Cannot delete subdirectory \"%s\", db_find_link() status %d\n", path, status));
78
80
81 if (status == DB_SUCCESS)
82 return true;
83
84 return report_fail(msprintf("test_mkdir: Delete subdirectory \"%s\" failed, status %d\n", path, status));
85}
#define DB_SUCCESS
Definition midas.h:632
#define DB_NO_KEY
Definition midas.h:643
INT db_delete_key(HNDLE hDB, HNDLE hKey, BOOL follow_links)
Definition odb.cxx:3933
INT db_find_link(HNDLE hDB, HNDLE hKey, const char *key_name, HNDLE *subhKey)
Definition odb.cxx:4293
HNDLE hKey
std::string msprintf(const char *format,...)
Definition midas.cxx:419
DWORD status
Definition odbhist.cxx:39
bool report_fail(const char *text)
Definition test_odb.cxx:51
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_all()

bool test_all ( HNDLE  hDB)

Definition at line 253 of file test_odb.cxx.

254{
255 bool ok = true;
256
257 ok &= rmdir(hDB, 0, "test_odb");
258
259 if (!ok)
260 return false;
261
262 ok &= test_mkdir(hDB, 0, "test_odb");
263
264 if (!ok)
265 return false;
266
267 HNDLE hROOT = 0;
268
269 ok &= test_chdir(hDB, 0, "test_odb", &hROOT);
270
271 if (!ok)
272 return false;
273
274 ok &= test_find_fail(hDB, hROOT, "does-not-exist", DB_NO_KEY);
275 ok &= test_find_fail(hDB, hROOT, "/does-not-exist", DB_NO_KEY);
276
277 ok &= test_find_fail(hDB, 0, "/System", DB_SUCCESS); // exists at top level
278 ok &= test_find_fail(hDB, hROOT, "/System", DB_NO_KEY); // but not in our subdirectory
279
280 ok &= test_mkdir(hDB, hROOT, "test_mkdir");
281 ok &= test_mkdir_fail(hDB, hROOT, "/test_mkdir", DB_KEY_EXIST); // unexpected, leading slash is ignored?
282
283 // test db_create_key()
284
285 ok &= test_mkdir_fail(hDB, hROOT, "invalid_name[", DB_INVALID_NAME);
286 ok &= test_mkdir_fail(hDB, hROOT, "invalid_name]", DB_INVALID_NAME);
287 ok &= test_mkdir_fail(hDB, hROOT, "", DB_INVALID_NAME);
288 ok &= test_mkdir_fail(hDB, hROOT, "/", DB_INVALID_NAME);
289 ok &= test_mkdir_fail(hDB, hROOT, "//", DB_INVALID_NAME);
290 ok &= test_mkdir_fail(hDB, hROOT, "invalid//invalid", DB_INVALID_NAME);
291 //ok &= test_mkdir_fail(hDB, hROOT, NULL, DB_INVALID_NAME); -- core dump if rpc_is_remote()
292
293 // test db_delete_key()
294
295 ok &= test_mkdir(hDB, hROOT, "test_delete_key");
296 ok &= test_delete_key(hDB, hROOT, "test_delete_key");
297 ok &= test_find_fail(hDB, hROOT, "test_delete_key", DB_NO_KEY); // deleted
298
299 ok &= test_mkdir(hDB, hROOT, "test_delete_key_dir/test/test/test_mkdir"); // multi-level create and delete
300 ok &= test_delete_key(hDB, hROOT, "test_delete_key_dir");
301 ok &= test_find_fail(hDB, hROOT, "test_delete_key_dir", DB_NO_KEY); // deleted
302
303 // test db_delete()
304
305 ok &= test_mkdir(hDB, hROOT, "test_delete");
306 ok &= test_delete(hDB, hROOT, "test_delete");
307 ok &= test_find_fail(hDB, hROOT, "test_delete", DB_NO_KEY); // deleted
308
309 ok &= test_mkdir(hDB, hROOT, "test_delete_dir/test/test/test_mkdir"); // multi-level create and delete
310 ok &= test_delete(hDB, hROOT, "test_delete_dir");
311 ok &= test_find_fail(hDB, hROOT, "test_delete_dir", DB_NO_KEY); // deleted
312
313 // test symlinks
314
315 ok &= test_symlink_fail(hDB, hROOT, "test_symlink_fail", "/does-not-exist", DB_NO_KEY);
316 ok &= test_symlink_fail(hDB, hROOT, "test_symlink_fail", "no-leading-slash", DB_INVALID_NAME);
317 ok &= test_symlink_fail(hDB, hROOT, "test_symlink", "/test_odb/test_mkdir", DB_NO_KEY); // unexpected
318 ok &= test_symlink(hDB, 0, "/test_odb/test_symlink", "/test_odb/test_mkdir");
319
320 // test symlink to symlink
321
322 ok &= test_symlink(hDB, 0, "/test_odb/test_symlink_to_symlink", "/test_odb/test_symlink");
323
324 //
325 // test db_delete_key of symlink
326 //
327
328 ok &= test_mkdir(hDB, 0, "/test_odb/test_symlink1_target");
329 ok &= test_symlink(hDB, 0, "/test_odb/test_symlink1", "/test_odb/test_symlink1_target");
330 ok &= test_delete_key(hDB, hROOT, "test_symlink1"); // delete symlink
331 ok &= test_find_fail(hDB, hROOT, "test_symlink1", DB_NO_KEY); // symlinks deleted
332 ok &= test_find_fail(hDB, hROOT, "test_symlink1_target", DB_SUCCESS); // symlink target remains
333
334 //
335 // test db_delete_key of symlink
336 //
337
338 ok &= test_mkdir(hDB, 0, "/test_odb/test_symlink2_target");
339 ok &= test_symlink(hDB, 0, "/test_odb/test_symlink2", "/test_odb/test_symlink2_target");
340 ok &= test_delete(hDB, hROOT, "test_symlink2"); // delete symlink
341 ok &= test_find_fail(hDB, hROOT, "test_symlink2", DB_NO_KEY); // symlinks deleted
342 ok &= test_find_fail(hDB, hROOT, "test_symlink2_target", DB_SUCCESS); // symlink target remains
343
344#if 0
345 //
346 // test db_delete_key with follow_links set to true
347 //
348
349 // delete(false) deletes the symlink,
350 // delete(true) deletes the link target, and the link
351
352 ok &= test_mkdir(hDB, 0, "/test_odb/test_symlink_target");
353 ok &= test_symlink(hDB, 0, "/test_odb/test_symlink1", "/test_odb/test_symlink_target");
354 ok &= test_symlink(hDB, 0, "/test_odb/test_symlink2", "/test_odb/test_symlink_target");
355 ok &= test_delete(hDB, hROOT, "test_symlink1"); // delete symlink
356 ok &= test_delete(hDB, hROOT, "test_symlink2", true); // delete symlink target
357 ok &= test_find_fail(hDB, hROOT, "test_symlink_target", DB_NO_KEY); // deleted
358 ok &= test_find_fail(hDB, hROOT, "test_symlink1", DB_NO_KEY); // deleted
359 ok &= test_find_fail(hDB, hROOT, "test_symlink2", DB_NO_KEY); // dangling link
360
361 // chained links, target of last link is deleted, intermediate link remain (dangling)
362
363 ok &= test_mkdir(hDB, 0, "/test_odb/test_link_to_link");
364 ok &= test_symlink(hDB, 0, "/test_odb/test_link_to_link1", "/test_odb/test_link_to_link");
365 ok &= test_symlink(hDB, 0, "/test_odb/test_link_to_link2", "/test_odb/test_link_to_link1");
366 ok &= test_delete(hDB, hROOT, "test_link_to_link2", true); // delete symlink target
367 ok &= test_find_fail(hDB, hROOT, "test_link_to_link", DB_NO_KEY); // deleted
368 ok &= test_find_fail(hDB, hROOT, "test_link_to_link1", DB_SUCCESS); // unexpectedly not deleted
369 ok &= test_find_fail(hDB, hROOT, "test_link_to_link2", DB_NO_KEY); // deleted
370 ok &= test_find_key_fail(hDB, hROOT, "test_link_to_link1", DB_INVALID_LINK); // dangling link
371
372 // subdirectory has a link to something else, it is also deleted
373
374 ok &= test_mkdir(hDB, 0, "/test_odb/test_symlink_dir1");
375 ok &= test_mkdir(hDB, 0, "/test_odb/test_symlink_dir2");
376 ok &= test_symlink(hDB, 0, "/test_odb/test_symlink_dir1/test_symlink", "/test_odb/test_symlink_dir2");
377 ok &= test_delete(hDB, hROOT, "test_symlink_dir1", true); // delete symlink target
378 ok &= test_find_fail(hDB, hROOT, "test_symlink_dir1", DB_NO_KEY); // deleted
379 ok &= test_find_fail(hDB, hROOT, "test_symlink_dir2", DB_NO_KEY); // deleted
380
381 // test delete of circular links
382
383 ok &= test_mkdir(hDB, 0, "/test_odb/test_circular_link");
384 ok &= test_symlink(hDB, 0, "/test_odb/test_circular_link/test_link", "/test_odb/test_circular_link");
385 ok &= test_symlink(hDB, 0, "/test_odb/test_circular_link1", "/test_odb/test_circular_link");
386 ok &= test_delete(hDB, hROOT, "test_circular_link1", true); // delete symlink target
387 ok &= test_find_fail(hDB, hROOT, "test_circular_link", DB_NO_KEY); // deleted
388 ok &= test_find_fail(hDB, hROOT, "test_circular_link1", DB_NO_KEY); // deleted
389#endif
390
391 // test db_enum
392
393 {
394 int status;
395 HNDLE hKeyRoot;
396 std::vector<HNDLE> hlist;
397 std::vector<KEY> klist;
398
399 status = db_enum(hDB, 0, "/test_odb", &hlist, &klist);
400
401 if (status != DB_SUCCESS) {
402 ok &= report_fail(msprintf("test_enum: db_enum(path) status %d\n", status));
403 }
404
405 ok &= test_enum(hlist, klist);
406
407 status = db_find_key(hDB, 0, "/test_odb", &hKeyRoot);
408
409 status = db_enum(hDB, hKeyRoot, &hlist, &klist);
410
411 if (status != DB_SUCCESS) {
412 ok &= report_fail(msprintf("test_enum: db_enum(hkey) status %d\n", status));
413 }
414
415 ok &= test_enum(hlist, klist);
416 }
417
418 {
419 int status;
420 HNDLE hKeyRoot;
421 std::vector<HNDLE> hlist;
422 std::vector<KEY> klist;
423
424 status = db_enum(hDB, 0, "/test_odb", &hlist, &klist, false);
425
426 if (status != DB_SUCCESS) {
427 ok &= report_fail(msprintf("test_enum: db_enum(path) status %d\n", status));
428 }
429
430 ok &= test_enum_links(hlist, klist);
431
432 status = db_find_link(hDB, 0, "/test_odb", &hKeyRoot);
433
434 status = db_enum(hDB, hKeyRoot, &hlist, &klist, false);
435
436 if (status != DB_SUCCESS) {
437 ok &= report_fail(msprintf("test_enum: db_enum(hkey) status %d\n", status));
438 }
439
440 ok &= test_enum_links(hlist, klist);
441 }
442
443 return ok;
444}
#define DB_KEY_EXIST
Definition midas.h:642
#define DB_INVALID_NAME
Definition midas.h:635
#define DB_INVALID_LINK
Definition midas.h:653
INT EXPRT db_enum(HNDLE hDB, HNDLE hKeyRoot, std::vector< HNDLE > *sub_handles, std::vector< KEY > *sub_keys, bool follow_links)
Definition odb.cxx:5768
INT db_find_key(HNDLE hDB, HNDLE hKey, const char *key_name, HNDLE *subhKey)
Definition odb.cxx:4256
bool test_find_fail(HNDLE hDB, HNDLE hROOT, const char *path, int fail_status)
Definition test_odb.cxx:157
bool test_mkdir(HNDLE hDB, HNDLE hROOT, const char *path)
Definition test_odb.cxx:87
bool test_symlink(HNDLE hDB, HNDLE hROOT, const char *path, const char *link_target)
Definition test_odb.cxx:185
bool test_mkdir_fail(HNDLE hDB, HNDLE hROOT, const char *path, int fail_status)
Definition test_odb.cxx:99
bool test_find_key_fail(HNDLE hDB, HNDLE hROOT, const char *path, int fail_status)
Definition test_odb.cxx:171
bool test_enum_links(const std::vector< HNDLE > &hlist, const std::vector< KEY > &klist)
Definition test_odb.cxx:231
bool test_symlink_fail(HNDLE hDB, HNDLE hROOT, const char *path, const char *link_target, int fail_status)
Definition test_odb.cxx:197
bool test_enum(const std::vector< HNDLE > &hlist, const std::vector< KEY > &klist)
Definition test_odb.cxx:209
bool test_delete_key(HNDLE hDB, HNDLE hROOT, const char *path)
Definition test_odb.cxx:123
bool test_chdir(HNDLE hDB, HNDLE hROOT, const char *path, HNDLE *phKey)
Definition test_odb.cxx:111
bool rmdir(HNDLE hDB, HNDLE hROOT, const char *path)
Definition test_odb.cxx:65
bool test_delete(HNDLE hDB, HNDLE hROOT, const char *path)
Definition test_odb.cxx:145
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_chdir()

bool test_chdir ( HNDLE  hDB,
HNDLE  hROOT,
const char *  path,
HNDLE phKey 
)

Definition at line 111 of file test_odb.cxx.

112{
113 printf("chdir(%s)\n", path);
114
115 int status = db_find_link(hDB, hROOT, path, phKey);
116
117 if (status == DB_SUCCESS)
118 return true;
119
120 return report_fail(msprintf("test_mkdir: Cannot find subdirectory \"%s\", db_find_link() status %d\n", path, status));
121}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_delete()

bool test_delete ( HNDLE  hDB,
HNDLE  hROOT,
const char *  path 
)

Definition at line 145 of file test_odb.cxx.

146{
147 printf("delete(%s)\n", path);
148
149 int status = db_delete(hDB, hROOT, path);
150
151 if (status == DB_SUCCESS)
152 return true;
153
154 return report_fail(msprintf("test_delete: Delete \"%s\" failed, status %d\n", path, status));
155}
INT db_delete(HNDLE hDB, HNDLE hKeyRoot, const char *odb_path)
Definition odb.cxx:3999
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_delete_key()

bool test_delete_key ( HNDLE  hDB,
HNDLE  hROOT,
const char *  path 
)

Definition at line 123 of file test_odb.cxx.

124{
125 HNDLE hKey;
126
127 printf("delete_key(%s)\n", path);
128
129 int status = db_find_link(hDB, hROOT, path, &hKey);
130
131 if (status == DB_NO_KEY)
132 return true;
133
134 if (status != DB_SUCCESS)
135 return report_fail(msprintf("test_delete_key: Cannot delete \"%s\", db_find_link() status %d\n", path, status));
136
138
139 if (status == DB_SUCCESS)
140 return true;
141
142 return report_fail(msprintf("test_delete_key: Delete \"%s\" failed, status %d\n", path, status));
143}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_enum()

bool test_enum ( const std::vector< HNDLE > &  hlist,
const std::vector< KEY > &  klist 
)

Definition at line 209 of file test_odb.cxx.

210{
211 printf("test_enum\n");
212
213 if (hlist.size() != klist.size()) {
214 return report_fail(msprintf("test_enum: hlist and klist size mismatch\n"));
215 }
216
217 bool ok = true;
218
219 size_t expected_size = 6;
220
221 if (klist.size() != expected_size)
222 ok &= report_fail(msprintf("test_enum: klist size %zu different from expected %zu\n", klist.size(), expected_size));
223
224 for (size_t i=0; i<klist.size(); i++) {
225 printf("key %zu: \"%s\" tid %d, num_values %d\n", i, klist[i].name, klist[i].type, klist[i].num_values);
226 }
227
228 return ok;
229}
INT type
Definition mana.cxx:269
#define name(x)
Definition midas_macro.h:24
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_enum_links()

bool test_enum_links ( const std::vector< HNDLE > &  hlist,
const std::vector< KEY > &  klist 
)

Definition at line 231 of file test_odb.cxx.

232{
233 printf("test_enum_links\n");
234
235 if (hlist.size() != klist.size()) {
236 return report_fail(msprintf("test_enum: hlist and klist size mismatch\n"));
237 }
238
239 bool ok = true;
240
241 size_t expected_size = 6;
242
243 if (klist.size() != expected_size)
244 ok &= report_fail(msprintf("test_enum: klist size %zu different from expected %zu\n", klist.size(), expected_size));
245
246 for (size_t i=0; i<klist.size(); i++) {
247 printf("key %zu: \"%s\" tid %d, num_values %d\n", i, klist[i].name, klist[i].type, klist[i].num_values);
248 }
249
250 return ok;
251}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_find_fail()

bool test_find_fail ( HNDLE  hDB,
HNDLE  hROOT,
const char *  path,
int  fail_status 
)

Definition at line 157 of file test_odb.cxx.

158{
159 HNDLE hKey;
160
161 printf("find_fail(%s)\n", path);
162
163 int status = db_find_link(hDB, hROOT, path, &hKey);
164
165 if (status == fail_status)
166 return true;
167
168 return report_fail(msprintf("test_find_fail: Unexpected db_find_link(%s) status %d instead of %d\n", path, status, fail_status));
169}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_find_key_fail()

bool test_find_key_fail ( HNDLE  hDB,
HNDLE  hROOT,
const char *  path,
int  fail_status 
)

Definition at line 171 of file test_odb.cxx.

172{
173 HNDLE hKey;
174
175 printf("find_key_fail(%s)\n", path);
176
177 int status = db_find_key(hDB, hROOT, path, &hKey);
178
179 if (status == fail_status)
180 return true;
181
182 return report_fail(msprintf("test_find_key_fail: Unexpected db_find_key(%s) status %d instead of %d\n", path, status, fail_status));
183}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_mkdir()

bool test_mkdir ( HNDLE  hDB,
HNDLE  hROOT,
const char *  path 
)

Definition at line 87 of file test_odb.cxx.

88{
89 printf("mkdir(%s)\n", path);
90
91 int status = db_create_key(hDB, hROOT, path, TID_KEY);
92
93 if (status == DB_SUCCESS)
94 return true;
95
96 return report_fail(msprintf("test_mkdir: Create subdirectory \"%s\" failed, status %d\n", path, status));
97}
#define TID_KEY
Definition midas.h:349
INT db_create_key(HNDLE hDB, HNDLE hKey, const char *key_name, DWORD type)
Definition odb.cxx:3392
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_mkdir_fail()

bool test_mkdir_fail ( HNDLE  hDB,
HNDLE  hROOT,
const char *  path,
int  fail_status 
)

Definition at line 99 of file test_odb.cxx.

100{
101 printf("mkdir_fail(%s)\n", path);
102
103 int status = db_create_key(hDB, hROOT, path, TID_KEY);
104
105 if (status == fail_status)
106 return true;
107
108 return report_fail(msprintf("test_mkdir_fail: Create subdirectory \"%s\" failed, unexpcted status %d instead of %d\n", path, status, fail_status));
109}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_symlink()

bool test_symlink ( HNDLE  hDB,
HNDLE  hROOT,
const char *  path,
const char *  link_target 
)

Definition at line 185 of file test_odb.cxx.

186{
187 printf("symlink(%s) to \"%s\"\n", path, link_target);
188
189 int status = db_create_link(hDB, hROOT, path, link_target);
190
191 if (status == DB_SUCCESS)
192 return true;
193
194 return report_fail(msprintf("test_symlink: db_create_link(%s) status %d\n", path, status));
195}
INT db_create_link(HNDLE hDB, HNDLE hKey, const char *link_name, const char *destination)
Definition odb.cxx:3688
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_symlink_fail()

bool test_symlink_fail ( HNDLE  hDB,
HNDLE  hROOT,
const char *  path,
const char *  link_target,
int  fail_status 
)

Definition at line 197 of file test_odb.cxx.

198{
199 printf("symlink_fail(%s) to \"%s\"\n", path, link_target);
200
201 int status = db_create_link(hDB, hROOT, path, link_target);
202
203 if (status == fail_status)
204 return true;
205
206 return report_fail(msprintf("test_symlink_fail: db_create_link(%s) status %d instead of %d\n", path, status, fail_status));
207}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ toString()

std::string toString ( int  i)

Definition at line 18 of file test_odb.cxx.

19{
20 char buf[256];
21 sprintf(buf, "%d", i);
22 return buf;
23}

Variable Documentation

◆ gCountFail

int gCountFail = 0
static

Definition at line 49 of file test_odb.cxx.