]> git.sur5r.net Git - bacula/bacula/blobdiff - regress/tests/strip-test
regress: add function to create many dirs
[bacula/bacula] / regress / tests / strip-test
index 6b86ce4ac90edba4187a36512ee82724c4ef717b..cadac49f6d09461a976d1571047128a78cfcd0d9 100755 (executable)
@@ -9,8 +9,17 @@ JobName=stripTest
 scripts/cleanup
 scripts/copy-strip-confs
 
+# Make a copy of build/src/dird to be backed up
+rm -rf ${tmp}/$$-strip
+mkdir -p ${tmp}/$$-strip
+cp -rpf ${cwd}/build/src/dird/ ${tmp}/$$-strip/
+echo "${tmp}/$$-strip" >${cwd}/tmp/file-list
 
-echo "${cwd}/build/src/dird" >${cwd}/tmp/file-list
+# Now, strip the first 4 parts of the path (which is what
+#   the backup will do and put the result in rpath
+echo "${tmp}/$$-strip/" >${tmp}/1
+rpath=`cut -f5- -d'/' ${tmp}/1`
+#echo "========= $rpath"
 
 change_jobname NightlySave $JobName
 start_test
@@ -18,6 +27,9 @@ start_test
 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
 @$out /dev/null
 messages
+@#
+@# Do a backup
+@#
 @$out ${cwd}/tmp/log1.out
 @#setdebug level=150 dir
 @#setdebug level=150 storage=FileStorage
@@ -32,6 +44,8 @@ END_OF_DATA
 
 run_bacula
 
+rm -rf ${cwd}/tmp/bacula-restores
+
 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
 @$out /dev/null
 messages
@@ -44,7 +58,6 @@ restore where=${cwd}/tmp/bacula-restores select all storage=FileStorage done
 yes
 wait
 messages
-@$out
 quit
 END_OF_DATA
 
@@ -54,6 +67,14 @@ check_for_zombie_jobs storage=FileStorage
 stop_bacula
 
 check_two_logs
-# check_restore_diff does not work because we cannot read all /etc, so skip it
-dstat=0
+#
+if test "$debug" -eq 1 ; then
+   diff -ur ${tmp}/$$-strip/ ${tmp}/bacula-restores/${rpath}
+else 
+   diff -r ${tmp}/$$-strip/ ${tmp}/bacula-restores/${rpath} 2>&1 >/dev/null
+fi
+dstat=$?
+
+rm -rf ${tmp}/$$-strip
+
 end_test