~svn/ubuntu/raring/subversion/ppa

« back to all changes in this revision

Viewing changes to subversion/tests/fs-helpers.h

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-12-05 01:26:14 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051205012614-qom4xfypgtsqc2xq
Tags: 1.2.3dfsg1-3ubuntu1
Merge with the final Debian release of 1.2.3dfsg1-3, bringing in
fixes to the clean target, better documentation of the libdb4.3
upgrade and build fixes to work with swig1.3_1.3.27.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* fs-helpers.c --- tests for the filesystem
 
2
 *
 
3
 * ====================================================================
 
4
 * Copyright (c) 2000-2004 CollabNet.  All rights reserved.
 
5
 *
 
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.
 
11
 *
 
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
 * ====================================================================
 
16
 */
 
17
 
 
18
#ifndef SVN_TEST__FS_HELPERS_H
 
19
#define SVN_TEST__FS_HELPERS_H
 
20
 
 
21
#include <apr_pools.h>
 
22
#include "svn_error.h"
 
23
#include "svn_fs.h"
 
24
#include "svn_repos.h"
 
25
#include "svn_delta.h"
 
26
#include "svn_test.h"
 
27
 
 
28
#ifdef __cplusplus
 
29
extern "C" {
 
30
#endif /* __cplusplus */
 
31
 
 
32
 
 
33
/*-------------------------------------------------------------------*/
 
34
 
 
35
/** Helper routines for filesystem functionality. **/
 
36
 
 
37
 
 
38
/* Set *FS_P to a fresh, unopened FS object, with the right warning
 
39
   handling function set.  */
 
40
svn_error_t *
 
41
svn_test__fs_new (svn_fs_t **fs_p, apr_pool_t *pool);
 
42
 
 
43
 
 
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. */
 
48
svn_error_t *
 
49
svn_test__create_fs (svn_fs_t **fs_p,
 
50
                     const char *name, 
 
51
                     const char *fs_type,
 
52
                     apr_pool_t *pool);
 
53
 
 
54
 
 
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.  */
 
57
svn_error_t *
 
58
svn_test__create_repos (svn_repos_t **repos_p,
 
59
                        const char *name,
 
60
                        const char *fs_type,
 
61
                        apr_pool_t *pool);
 
62
 
 
63
 
 
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.) */
 
67
svn_error_t *
 
68
svn_test__stream_to_string (svn_stringbuf_t **string,
 
69
                            svn_stream_t *stream, 
 
70
                            apr_pool_t *pool);
 
71
 
 
72
 
 
73
/* Set the contents of file in PATH under ROOT to CONTENTS.  */
 
74
svn_error_t *
 
75
svn_test__set_file_contents (svn_fs_root_t *root,
 
76
                             const char *path,
 
77
                             const char *contents, 
 
78
                             apr_pool_t *pool);
 
79
 
 
80
 
 
81
/* Get the contents of file in PATH under ROOT, and copy them into
 
82
   STR.  */
 
83
svn_error_t *
 
84
svn_test__get_file_contents (svn_fs_root_t *root,
 
85
                             const char *path,
 
86
                             svn_stringbuf_t **str, 
 
87
                             apr_pool_t *pool);
 
88
 
 
89
 
 
90
 
 
91
/* The Helper Functions to End All Helper Functions */
 
92
 
 
93
/* Structure used for testing integrity of the filesystem's revision
 
94
   using validate_tree(). */
 
95
typedef struct svn_test__tree_entry_t
 
96
{
 
97
  const char *path;     /* full path of this node */
 
98
  const char *contents; /* text contents (NULL for directories) */
 
99
}
 
100
svn_test__tree_entry_t;
 
101
  
 
102
 
 
103
/* Wrapper for an array of the above svn_test__tree_entry_t's.  */
 
104
typedef struct svn_test__tree_t
 
105
{
 
106
  svn_test__tree_entry_t *entries;
 
107
  int num_entries;
 
108
}
 
109
svn_test__tree_t;
 
110
 
 
111
 
 
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).  */
 
116
svn_error_t *
 
117
svn_test__validate_tree (svn_fs_root_t *root,
 
118
                         svn_test__tree_entry_t *entries,
 
119
                         int num_entries, 
 
120
                         apr_pool_t *pool);
 
121
 
 
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
 
125
{
 
126
  /* command: 
 
127
 
 
128
     'a' -- add (PARAM1 is file contents, or NULL for directories)
 
129
     'c' -- copy (PARAM1 is target path, copy source is youngest rev)
 
130
     'd' -- delete
 
131
     'e' -- edit (PARAM1 is new file contents)
 
132
  */
 
133
  int cmd;
 
134
  const char *path; /* path to resource in the filesystem */
 
135
  const char *param1; /* command parameter (see above) */
 
136
 
137
svn_test__txn_script_command_t;
 
138
 
 
139
 
 
140
/* Execute a "script" SCRIPT on items under TXN_ROOT.  */
 
141
svn_error_t *
 
142
svn_test__txn_script_exec (svn_fs_root_t *txn_root,
 
143
                           svn_test__txn_script_command_t *script,
 
144
                           int num_edits, 
 
145
                           apr_pool_t *pool);
 
146
 
 
147
/* Verify that the tree that exists under ROOT is exactly the Greek
 
148
   Tree. */
 
149
svn_error_t *
 
150
svn_test__check_greek_tree (svn_fs_root_t *root,
 
151
                            apr_pool_t *pool);
 
152
 
 
153
 
 
154
/* Create the Greek Tree under TXN_ROOT.  See ./greek-tree.txt.  */
 
155
svn_error_t *
 
156
svn_test__create_greek_tree (svn_fs_root_t *txn_root,
 
157
                             apr_pool_t *pool);
 
158
 
 
159
 
 
160
#ifdef __cplusplus
 
161
}
 
162
#endif /* __cplusplus */
 
163
 
 
164
#endif  /* SVN_TEST__FS_HELPERS_H */