3 #ifdef HAVE_SYS_TYPES_H
29 #define ERR_OUT(e) std::cerr << e
45 value = (thrown ==
false);
55 assert(
make_dir(
"./test-rvm.dir/vault-1"));
56 assert(
make_dir(
"./test-rvm.dir/vault-1/2006-06-16.112632"));
57 assert(
make_dir(
"./test-rvm.dir/vault-1/2006-06-16.112632/test-job"));
58 assert(
make_dir(
"./test-rvm.dir/log.dir"));
59 assert(
make_dir(
"./test-rvm.dir/catalog.dir"));
60 assert(chmod(
"./test-rvm.dir/vault-1/2006-06-16.112632",00500) == 0);
61 assert(chmod(
"./test-rvm.dir/vault-1/2006-06-16.112632/test-job",00500) == 0);
63 out.open(
"./test-rvm.dir/file-1.conf");
64 assert(out.is_open());
65 out <<
"link-catalog-dir ./test-rvm.dir/catalog.dir" << std::endl;
66 out <<
"log-dir ./test-rvm.dir/log.dir" << std::endl;
67 out <<
"logging-level rsync" << std::endl;
68 out <<
"error-logging-level rsync" << std::endl;
69 out <<
"rsync-local-path " <<
LOCAL_RSYNC << std::endl;
70 out <<
"rsync-parallel 1" << std::endl;
71 out <<
"timestamp-resolution second" << std::endl;
72 out <<
"vault ./test-rvm.dir/vault-*" << std::endl;
73 out <<
"vault-overflow-behavior quit" << std::endl;
74 out <<
"vault-overflow-blocks 0" << std::endl;
75 out <<
"vault-overflow-inodes 0" << std::endl;
76 out <<
"vault-selection-behavior round-robin" << std::endl;
77 out <<
"<job>" << std::endl;
78 out <<
" jobname test-job" << std::endl;
79 out <<
" archive-path jobname/permutation" << std::endl;
80 out <<
" path " <<
check_cwd <<
"/" << std::endl;
81 out <<
" rsync-connection-type local" << std::endl;
82 out <<
" rsync-hardlink true" << std::endl;
83 out <<
" <rsync-options>" << std::endl;
84 out <<
" -a -v --progress --stats" << std::endl;
85 out <<
" --exclude '/.svn/'" << std::endl;
86 out <<
" --exclude '/.deps/'" << std::endl;
87 out <<
" --exclude '/autom4te.cache/'" << std::endl;
88 out <<
" --exclude '/test-rvm.dir/'" << std::endl;
89 out <<
" </rsync-options>" << std::endl;
90 out <<
" rsync-retry-count 3" << std::endl;
91 out <<
"</job>" << std::endl;
99 r = system(
"chmod -R u+w ./test-rvm.dir 2> /dev/null");
100 assert(system(
"rm -fr ./test-rvm.dir") == 0);
104 const std::string& path1,
105 const std::string& path2,
106 const std::string& file
132 std::string local_rsync;
137 if (local_rsync.size() == 0) {
138 char const * text[] = {
140 "NOTICE: Skipping this test",
142 "This test cannot be run because no local rsync binary was found during",
143 "configuration. This also means that RVM will be compiled with no",
144 "default value for the rsync-local-path command.",
146 "To change this, run the configure script with --with-rsync=<path>,",
147 "where <path> is the absolute path to the rsync binary.",
153 for (c = 0; text[c] != 0; ++c) {
154 std::cerr << text[c] << std::endl;
160 char const * argv[256] = { 0 };
166 argv[argc++] =
"<program>";
167 argv[argc++] =
"--timestamp";
168 argv[argc++] =
"2006-06-16.112632";
169 argv[argc++] =
"--archive";
179 std::cerr << std::endl;
180 std::cerr <<
" You should see an error message here:" << std::endl;
181 std::cerr <<
"-----------------------------------------" << std::endl;
218 +
static_cast<std::string
>(
"/")
220 +
static_cast<std::string
>(
".log")
226 +
static_cast<std::string
>(
"/")
228 +
static_cast<std::string
>(
".report")
242 std::cerr <<
"-----------------------------------------" << std::endl;
243 std::cerr << std::endl;
245 assert(find(subdir.begin(), subdir.end(),
"AUTHORS") == subdir.end());
250 int main(
int argc,
char const * argv[])
252 if (geteuid() != 0) {
270 <<
"NOTE: Skipping this test because I'm running as root"
void init(int argc, char const *argv[])
Initialize the configuration manager from rvm's command line options.
std::string reform_path(const std::string &a_path)
Reformat a path to remove double slashes.
bool test_inodes(const std::string &path1, const std::string &path2, const std::string &file)
void mk_dir(const std::string &a_path)
Create a directory.
void clear(void)
Clear the vault manager.
log_manager logger
The global log manager.
void path(const std::string a_path)
Retrieve information about a pathname.
void init(void)
Initialize the vault manager.
An extended string class.
void clear(void)
Clear the archive manager and clear the job list.
void catalog(void)
Create or update the catalog.
void clear(void)
Reset the catalog manager.
void default_file(const std::string &a_path)
Set the default configuration filename.
const class timestamp & timestamp(void) const
Return the timestamp of this instance of rvm.
const std::string & log_dir(void) const
Return the log-dir path.
const inode_type inode(void) const
Return the file inode.
archive_manager archiver
The global archive manager.
void set_total_time(const timer &a_class)
Report the overall RVM time.
void clear(void)
Reset configuration to default settings.
void clear(void)
Clear all values.
report_manager reporter
The global report manager.
bool exists(const std::string &a_path)
Return true if the file or directory exists.
void file_report(void)
Save report to a file.
void start(void)
Start (or restart) the timer.
catalog_manager cataloger
The global catalog manager.
const type & path(const std::string a_path, const std::string a_filter="*")
Return a vector of strings of a list of files in a subdirectory.
const std::string vault(void) const
Return the path to the selected vault.
int main(int argc, char const *argv[])
void clear(void)
Clear the log manager.
void init(void)
Initialize the log manager.
configuration_manager config
The global configuration manager instance.
Retrieve information about a file or directory.
void init(void)
Initialize the catalog manager.
void init(void)
Initialize the archive manager.
const jobs_type & jobs(void) const
Return a list of jobs.
const std::string str(void) const
Generate a string.
bool make_dir(const std::string &path)
void archive(void)
Archive jobs.
void stop(void)
Stop the timer.
Retrieve a list of files in a subdirectory that match a given wildcard filename.
void init(void)
Initialize.
vault_manager vaulter
The global vault manager.