3 # Run a backup of the build directory but force it to have
4 # a comm error, and check that it restarts correctly.
6 TestName="restart-accurate-job-test"
11 scripts/copy-test-confs
12 echo "${cwd}/build" >${cwd}/tmp/file-list
14 change_jobname NightlySave $JobName
16 $bperl -e "add_attribute('$conf/bacula-dir.conf', 'Accurate', 'yes', 'Job', 'RestartJob')"
18 touch $cwd/build/po/testfile
20 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
23 @$out ${cwd}/tmp/log1.out
24 label storage=File volume=TestVolume001
25 setdebug level=0 trace=0 hangup=100 client
26 @#setdebug level=20 dir
31 select * from JobMedia;
38 scripts/check_for_zombie_jobs storage=File
40 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
42 @$out ${cwd}/tmp/log1.out
43 setdebug level=0 trace=0 hangup=50 client
44 @exec "sh -c 'touch $cwd/build/po/*'"
45 @exec "sh -c 'touch $cwd/build/src/dird/*'"
46 @exec "rm $cwd/build/po/testfile"
51 select * from JobMedia;
56 @$out ${cwd}/tmp/log2.out
57 restore where=$tmp/bacula-restores storage=File select all done
61 @$out ${cwd}/tmp/log3.out
67 scripts/check_for_zombie_jobs storage=File
73 nb_F=`awk -F '|' '/RestartJob.+F/ { gsub(/,/, ""); print $7}' $tmp/log3.out`
74 nb_I=`awk -F '|' '/RestartJob.+I/ { gsub(/,/, ""); print $7}' $tmp/log3.out`
75 nb1=`ls $cwd/build/po/* $cwd/build/src/dird/* | wc -l`
78 if [ "$nb_I" -eq "$nb_F" ]; then
79 print_debug "ERROR: Incremental saves too much files (nb Incr == nb Full)"
83 if [ "$nb_I" -ge "$nb1" ]; then
84 print_debug "ERROR: Incremental saves too much files (more than $nb1)"