]> git.sur5r.net Git - bacula/bacula/blobdiff - regress/tests/bsr-opt-test
Make out of freespace non-fatal for removable devices -- i.e. behaves like tape
[bacula/bacula] / regress / tests / bsr-opt-test
index 785f46145f2e9815943b02df0f93bccee3409f87..9f20963b2e5ac97703f94471ee6b9a84560c26b5 100755 (executable)
@@ -1,4 +1,9 @@
 #!/bin/sh
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+
 #
 # Run a simple backup of the Bacula build directory but 
 #   split the archive into two volumes, then restore
 #   the other volume is not used.  I.e. bsr optimization
 #   works.
 #
-cwd=`pwd`
-scripts/copy-test-confs
+TestName="bsr-opt-test"
+JobName=bsr-opt
+. scripts/functions
+
 scripts/cleanup
-echo "${cwd}/build" >/tmp/file-list
+scripts/copy-test-confs
+echo "${cwd}/build" >${cwd}/tmp/file-list
 
-echo " "
-echo " "
-echo " === Starting bsr-opt-test at `date +%R:%S` ==="
-echo " === Starting bsr-opt-test at `date +%R:%S` ===" >working/log
-echo " "
+change_jobname NightlySave $JobName
+start_test
 
-bin/bacula start 2>&1 >/dev/null
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
-# bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
-@output /dev/null
+MaxVolBytes=3000000
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@$out /dev/null
 messages
-@output tmp/log1.out
+@$out ${cwd}/tmp/log1.out
 label storage=File1 volume=TestVolume001
 label storage=File1 volume=TestVolume002
-update Volume=TestVolume001 MaxVolBytes=3000000
-run job=NightlySave storage=File1 yes
+update Volume=TestVolume001 MaxVolBytes=$MaxVolBytes
+run job=$JobName storage=File1 yes
 wait
 messages
 @# 
 @# now do a restore
 @#
-@output tmp/log2.out
+@$out ${cwd}/tmp/log2.out
+setdebug level=150 storage=File1 trace=1
 restore bootstrap=${cwd}/working/restore.bsr where=${cwd}/tmp/bacula-restores select storage=File1
 unmark *
 cd ${cwd}/build/src/cats
@@ -42,11 +47,12 @@ done
 yes
 wait
 messages
-@output
 quit
 END_OF_DATA
-scripts/check_for_zombie_jobs storage=File1
-bin/bacula stop 2>&1 >/dev/null
+
+run_bacula
+check_for_zombie_jobs storage=File1
+stop_bacula
 #
 # This test is not really reliable. What we want to do is
 #   to select files on only one Volume, then insure here
@@ -54,11 +60,9 @@ bin/bacula stop 2>&1 >/dev/null
 #
 grep TestVolume002 working/restore.bsr 2>&1 >/dev/null
 bsrstat=$?
-grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
-bstat=$?
-grep "^  Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
-rstat=$?
-diff -r build/src/cats  tmp/bacula-restores${cwd}/build/src/cats 2>&1 >/dev/null
+check_two_logs
+
+diff -r build/src/cats  ${cwd}/tmp/bacula-restores${cwd}/build/src/cats 2>&1 >/dev/null
 if [ $? != 0 -o $bsrstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
    echo " "
    echo " "
@@ -75,8 +79,9 @@ if [ $? != 0 -o $bsrstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
       echo "  !!!!! Restored files differ          !!!!! " >>test.out
    fi
    echo " "
+   exit 1
 else
-   echo "  ===== bsr-opt-test Bacula source OK ===== "
-   echo "  ===== bsr-opt-test OK ===== " >>test.out
+   echo "  ===== bsr-opt-test Bacula source OK `date +%R:%S` ===== "
+   echo "  ===== bsr-opt-test OK `date +%R:%S` ===== " >>test.out
    scripts/cleanup
 fi