]> git.sur5r.net Git - bacula/bacula/blobdiff - regress/tests/accurate-test
Backport from Bacula Enterprise
[bacula/bacula] / regress / tests / accurate-test
index 001d1106d585de3cb6fba8cdb978b686421b8623..096254458ff9ce4d10446e18000ee80344fd06f4 100755 (executable)
@@ -1,4 +1,9 @@
 #!/bin/sh
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+
 #
 # TODO:
 #  - test bextract
@@ -21,10 +26,14 @@ cp tmp/1 $conf/bacula-fd.conf
 change_jobname BackupClient1 $JobName
 
 p() {
-    echo "##############################################" >> ${cwd}/tmp/log1.out
-    echo "$*" >> ${cwd}/tmp/log1.out
-    echo "##############################################" >> ${cwd}/tmp/log2.out
-    echo "$*" >> ${cwd}/tmp/log2.out
+   echo "##############################################" >> ${cwd}/tmp/log1.out
+   echo "$*" >> ${cwd}/tmp/log1.out
+   echo "##############################################" >> ${cwd}/tmp/log2.out
+   echo "$*" >> ${cwd}/tmp/log2.out
+   if test "$debug" -eq 1 ; then
+      echo "##############################################"
+      echo "$*"
+   fi
 }
 
 # cleanup
@@ -33,8 +42,8 @@ rm -rf ${cwd}/build/accurate
 
 
 # add extra files
-mkdir ${cwd}/build/accurate
-mkdir ${cwd}/build/accurate/dirtest
+mkdir -p ${cwd}/build/accurate
+mkdir -p ${cwd}/build/accurate/dirtest
 echo "test test" > ${cwd}/build/accurate/dirtest/hello
 echo "test test" > ${cwd}/build/accurate/xxx
 echo "test test" > ${cwd}/build/accurate/yyy
@@ -163,11 +172,6 @@ rm -rf ${cwd}/tmp/bacula-restores
 p Check with bls
 ################################################################
 
-$bin/bls -c $conf/bacula-sd.conf -V 'TestVolume001' FileStorage > $tmp/bls.out
-grep -- '----' $tmp/bls.out | grep xxx > /dev/null
-if [ $? != 0 ] ; then
-    bstat=2
-fi
 
 ################################################################
 p Now do a backup after making few changes
@@ -269,14 +273,14 @@ check_for_zombie_jobs storage=File
 check_two_logs
 check_restore_diff
 
-rm -rf ${cwd}/tmp/bacula-restores ${cwd}/build/accurate/bacula-restores
+rm -rf ${cwd}/tmp/bacula-restores
+
+stop_bacula
 
 ################################################################
-p Check with bscan
+p Check with bscan -- this takes some time
 ################################################################
 
-stop_bacula
-
 cd $bin
   ./drop_bacula_tables      >/dev/null 2>&1
   ./make_bacula_tables      >/dev/null 2>&1
@@ -287,7 +291,14 @@ echo "volume=TestVolume001" >tmp/bscan.bsr
 
 bscan_libdbi
 
-$bin/bscan -c $conf/bacula-sd.conf $BSCANLIBDBI -n regress -u regress -m -s -b $tmp/bscan.bsr FileStorage 2>&1 > $tmp/bscan.log
+# If the database has a password pass it to bscan
+if test "x${db_password}" = "x"; then
+  PASSWD=
+else
+  PASSWD="-P ${db_password}"
+fi
+
+$bin/bscan -c $conf/bacula-sd.conf $BSCANLIBDBI $PASSWD -n "$db_name" -u "$db_user" -m -s -b $tmp/bscan.bsr FileStorage 2>&1 > $tmp/bscan.log
 
 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
 @$out ${cwd}/tmp/log1.out
@@ -312,7 +323,7 @@ check_for_zombie_jobs storage=File
 check_two_logs
 check_restore_diff
 
-rm -rf ${cwd}/tmp/bacula-restores
+rm -rf ${cwd}/tmp/bacula-restores  ${cwd}/build/accurate/bacula-restores
 
 ################################################################
 p Now do a test with other attributes: owner, gid, rights
@@ -412,13 +423,13 @@ run_bconsole
 
 grep yyy ${cwd}/tmp/log3.out > /dev/null
 if [ $? != 0 ] ; then
-    print_debug "Can't find yyy file into 'list files' output (${cwd}/tmp/log3.out)"
+    print_debug "ERROR: Can't find yyy file into 'list files' output (${cwd}/tmp/log3.out)"
     dstat=2
 fi
 
-if grep zzz ${cwd}/tmp/log3.out > /dev/null
-then
-    print_debug "Can't find zzz file into 'list files' output (${cwd}/tmp/log3.out)"
+grep zzz ${cwd}/tmp/log3.out > /dev/null
+if [ $? = 0 ] ; then
+    print_debug "ERROR: Should not find zzz file into 'list files' output (${cwd}/tmp/log3.out)"
     dstat=2
 fi