]> git.sur5r.net Git - bacula/bacula/blobdiff - regress/tests/restart-base-job-test
regress: enhance btape-test to detect NOT correct message
[bacula/bacula] / regress / tests / restart-base-job-test
index 3dce0d2ed63efcfc7caf99c08cf26df1936374a1..72a1b918d5a02d8bd5f16ad64cfc118ec27b9e7a 100755 (executable)
@@ -1,8 +1,16 @@
 #!/bin/sh
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+
 #
 # Run a backup of the build directory but force it to have
 #   a comm error, and check that it restarts correctly.
 #
+#  NOTE!!!  This test will always fail, because currently we cannot
+#           restart a Backup Job that has Base files specified.
+#
 TestName="restart-base-job-test"
 JobName=RestartJobWithBase
 . scripts/functions
@@ -13,12 +21,12 @@ echo "${cwd}/build" >${cwd}/tmp/file-list
 
 change_jobname NightlySave $JobName
 
-$bperl -e "add_attribute('$conf/bacula-dir.conf', 'Base', 'RestartJob', 'Job', 'RestartJob')"
-$bperl -e "add_attribute('$conf/bacula-dir.conf', 'Accurate', 'yes', 'Job', 'RestartJob')"
+$bperl -e "add_attribute('$conf/bacula-dir.conf', 'Base', '$JobName', 'Job', '$JobName')"
+$bperl -e "add_attribute('$conf/bacula-dir.conf', 'Accurate', 'yes', 'Job', '$JobName')"
 start_test
 
 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
-@$out /dev/null
+@output /dev/null
 messages
 @$out ${cwd}/tmp/log1.out
 label storage=File volume=TestVolume001
@@ -27,10 +35,16 @@ wait
 messages
 @exec "touch $cwd/build/po/fr.po"
 setdebug level=0 trace=0 hangup=100 client
-@#setdebug level=20 dir
+setdebug level=200 trace=1 dir
 run job=$JobName yes
 wait
 messages
+sql
+select * from JobMedia;
+
+setdebug level=0 trace=0 dir
+@$out ${cwd}/tmp/log3.out
+list jobs
 quit
 END_OF_DATA
 
@@ -39,7 +53,7 @@ run_bacula
 scripts/check_for_zombie_jobs storage=File
 
 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
-@$out /dev/null
+@output /dev/null
 messages
 @# 
 @# now do a restore
@@ -53,9 +67,25 @@ quit
 END_OF_DATA
 
 run_bconsole
-scripts/check_for_zombie_jobs storage=File
+scripts/check_for_zombie_jobs storage=File1
 stop_bacula
 
 check_two_logs
 check_restore_diff
-end_test
+
+nb_B=`awk -F '|' '/RestartJob.+ B.+ B/ { gsub(/,/, "");print $7}' $tmp/log3.out`
+nb_F=`awk -F '|' '/RestartJob.+F/ { gsub(/,/, ""); print $7}' $tmp/log3.out`
+
+if [ $nb_F -ne $nb_B ]; then
+    print_debug "ERROR: Base and Full should have the same number of files"
+    estat=1
+fi 
+
+nb_B=`awk -F '|' '/RestartJob.+B.+B/ { gsub(/,/, ""); print $8}' $tmp/log3.out`
+nb_F=`awk -F '|' '/RestartJob.+F/ { gsub(/,/, ""); print $8}' $tmp/log3.out`
+
+if [ $nb_F -gt 1000000 ]; then
+    print_debug "ERROR: Base job should backup only one file"
+    estat=2
+fi
+