]> git.sur5r.net Git - bacula/bacula/blobdiff - regress/tests/recycle-test
Add debug to next_vol.c + shorten retention for recycle-test
[bacula/bacula] / regress / tests / recycle-test
index 57a499714a31eb44c370c872907b3062b3c34679..0d47661a5dc78ec6669e6dd0ab11b22fee66a9e9 100755 (executable)
@@ -5,62 +5,83 @@
 #   volumes to be recycled, and cycling through the volumes
 #   twice. Tests maxvoljobs and volretention.
 #
-cwd=`pwd`
-scripts/copy-test-confs
+# Note, this test is a bit tricky, in that if you get too
+#   much data in the regress/build directory, the test will
+#   fail because it will run out of enough volumes to backup
+#   all the data.
+#
+TestName="recycle-test"
+JobName=Recycle
+. 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 recycle-test at `date +%R:%S` ==="
-echo " === Starting recycle-test at `date +%R:%S` ===" >working/log
-echo " "
+change_jobname NightlySave $JobName
+start_test
 
-#bin/bacula start 2>&1 >/dev/null
-bin/bacula start
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
-@output /dev/null
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@$out /dev/null
 messages
+@$out ${cwd}/tmp/log1.out
 label storage=File1 volume=TestVolume001
 label storage=File1 volume=TestVolume002
 label storage=File1 volume=TestVolume003
-update Volume=TestVolume001 volretention=10s
-update Volume=TestVolume001 maxvoljobs=1
-update Volume=TestVolume002 volretention=10s
-update Volume=TestVolume002 maxvoljobs=1
-update Volume=TestVolume003 volretention=10s
-update Volume=TestVolume003 maxvoljobs=1
+label storage=File1 volume=TestVolume004
+@# Note, this is going to fail if the pruning gets
+@#  to tight because the saved volume is too large.
+@#  In that case, either add another volume, or
+@#  increase the volume capacity a bit.
+update Volume=TestVolume001 volretention=5s
+update Volume=TestVolume001 maxvolbytes=200000000
+update Volume=TestVolume002 volretention=5s
+update Volume=TestVolume002 maxvolbytes=200000000
+update Volume=TestVolume003 volretention=5s
+update Volume=TestVolume003 maxvolbytes=200000000
+update Volume=TestVolume004 volretention=5s
+update Volume=TestVolume004 maxvolbytes=200000000
 list volumes
-run job=NightlySave storage=File1 level=full yes
+setdebug level=150 storage=File1
+setdebug level=50 dir
+run job=$JobName storage=File1 level=full yes
+run job=$JobName storage=File1 level=full yes
+run job=$JobName storage=File1 level=full yes
 wait
 messages
 list volumes
-run job=NightlySave storage=File1 level=full yes
+@sleep 12 
+run job=$JobName storage=File1 level=full yes
+run job=$JobName storage=File1 level=full yes
+run job=$JobName storage=File1 level=full yes
 wait
 messages
 list volumes
-run job=NightlySave storage=File1 level=full yes
+@sleep 12
+run job=$JobName storage=File1 level=full yes
+run job=$JobName storage=File1 level=full yes
+run job=$JobName storage=File1 level=full yes
 wait
 messages
 list volumes
-@sleep 10
-run job=NightlySave storage=File1 level=full yes
+@sleep 12
+run job=$JobName storage=File1 level=full yes
+run job=$JobName storage=File1 level=full yes
+run job=$JobName storage=File1 level=full yes
 wait
 messages
 list volumes
-run job=NightlySave storage=File1 level=full yes
-wait
-messages
-@output tmp/log1.out
-list volumes
-run job=NightlySave storage=File1 level=full yes
+@sleep 12
+run job=$JobName storage=File1 level=full yes
+run job=$JobName storage=File1 level=full yes
+run job=$JobName storage=File1 level=full yes
 wait
 messages
 list volumes
 @# 
 @# now do a restore
 @#
-@output tmp/log2.out
+@$out ${cwd}/tmp/log2.out
 restore where=${cwd}/tmp/bacula-restores select storage=File1
 unmark *
 mark *
@@ -68,31 +89,13 @@ done
 yes
 wait
 messages
-@output
 quit
 END_OF_DATA
-scripts/check_for_zombie_jobs storage=File1
-bin/bacula stop 2>&1 >/dev/null
-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  tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
-if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
-   echo " "
-   echo " "
-   echo "  !!!!! recycle-test Bacula source failed!!! !!!!! "
-   echo "  !!!!! recycle-test failed!!! !!!!! " >>test.out
-   if [ $bstat != 0 -o $rstat != 0 ] ; then
-      echo "  !!!!! Bad Job termination status     !!!!! "
-      echo "  !!!!! Bad Job termination status     !!!!! " >>test.out
-   else
-      echo "  !!!!! Restored files differ          !!!!! "
-      echo "  !!!!! Restored files differ          !!!!! " >>test.out
-   fi
-   echo " "
-else
-   echo "  ===== recycle-test Bacula source OK `date +%R:%S` ===== "
-   echo "  ===== recycle-test OK `date +%R:%S` ===== " >>test.out
-   scripts/cleanup
-fi
+
+run_bacula
+check_for_zombie_jobs storage=File1
+stop_bacula
+
+check_two_logs
+check_restore_diff
+end_test