1 /* fs-helpers.c --- tests for the filesystem
3 * ====================================================================
4 * Copyright (c) 2000-2004 CollabNet. All rights reserved.
6 * This software is licensed as described in the file COPYING, which
7 * you should have received as part of this distribution. The terms
8 * are also available at http://subversion.tigris.org/license-1.html.
9 * If newer versions of this license are posted there, you may use a
10 * newer version instead, at your option.
12 * This software consists of voluntary contributions made by many
13 * individuals. For exact contribution history, see the revision
14 * history and logs, available at http://subversion.tigris.org/.
15 * ====================================================================
18 #ifndef SVN_TEST__FS_HELPERS_H
19 #define SVN_TEST__FS_HELPERS_H
21 #include <apr_pools.h>
22 #include "svn_error.h"
24 #include "svn_repos.h"
25 #include "svn_delta.h"
30 #endif /* __cplusplus */
33 /*-------------------------------------------------------------------*/
35 /** Helper routines for filesystem functionality. **/
38 /* Set *FS_P to a fresh, unopened FS object, with the right warning
39 handling function set. */
41 svn_test__fs_new(svn_fs_t
**fs_p
, apr_pool_t
*pool
);
44 /* Create a filesystem of FS_TYPE in a subdir NAME and return a new FS
45 object which points to it. FS_TYPE should be either "bdb" or
46 "fsfs". Filesystem tests that are backend-specific should use
47 svn_test__create_fs instead of this. */
49 svn_test__create_fs(svn_fs_t
**fs_p
,
55 /* Create a repository with a filesystem of FS_TYPE in a subdir NAME
56 and return a new REPOS object which points to it. */
58 svn_test__create_repos(svn_repos_t
**repos_p
,
64 /* Read all data from a generic read STREAM, and return it in STRING.
65 Allocate the svn_stringbuf_t in APRPOOL. (All data in STRING will be
66 dup'ed from STREAM using APRPOOL too.) */
68 svn_test__stream_to_string(svn_stringbuf_t
**string
,
73 /* Set the contents of file in PATH under ROOT to CONTENTS. */
75 svn_test__set_file_contents(svn_fs_root_t
*root
,
81 /* Get the contents of file in PATH under ROOT, and copy them into
84 svn_test__get_file_contents(svn_fs_root_t
*root
,
86 svn_stringbuf_t
**str
,
91 /* The Helper Functions to End All Helper Functions */
93 /* Structure used for testing integrity of the filesystem's revision
94 using validate_tree(). */
95 typedef struct svn_test__tree_entry_t
97 const char *path
; /* full path of this node */
98 const char *contents
; /* text contents (NULL for directories) */
100 svn_test__tree_entry_t
;
103 /* Wrapper for an array of the above svn_test__tree_entry_t's. */
104 typedef struct svn_test__tree_t
106 svn_test__tree_entry_t
*entries
;
112 /* Given a transaction or revision root (ROOT), check to see if the
113 tree that grows from that root has all the path entries, and only
114 those entries, passed in the array ENTRIES (which is an array of
115 NUM_ENTRIES tree_test_entry_t's). */
117 svn_test__validate_tree(svn_fs_root_t
*root
,
118 svn_test__tree_entry_t
*entries
,
122 /* Structure for describing script-ish commands to perform on a
123 transaction using svn_test__txn_script_exec(). */
124 typedef struct svn_test__txn_script_command_t
128 'a' -- add (PARAM1 is file contents, or NULL for directories)
129 'c' -- copy (PARAM1 is target path, copy source is youngest rev)
131 'e' -- edit (PARAM1 is new file contents)
134 const char *path
; /* path to resource in the filesystem */
135 const char *param1
; /* command parameter (see above) */
137 svn_test__txn_script_command_t
;
140 /* Execute a "script" SCRIPT on items under TXN_ROOT. */
142 svn_test__txn_script_exec(svn_fs_root_t
*txn_root
,
143 svn_test__txn_script_command_t
*script
,
147 /* Verify that the tree that exists under ROOT is exactly the Greek
150 svn_test__check_greek_tree(svn_fs_root_t
*root
,
154 /* Create the Greek Tree under TXN_ROOT. See ./greek-tree.txt. */
156 svn_test__create_greek_tree(svn_fs_root_t
*txn_root
,
162 #endif /* __cplusplus */
164 #endif /* SVN_TEST__FS_HELPERS_H */