3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
8 # Run a backup of the build directory but force it to have
9 # a comm error, and check that it restarts correctly.
11 TestName="restart-accurate-job-test"
16 scripts/copy-test-confs
19 echo "${cwd}/build" >${cwd}/tmp/file-list
21 change_jobname NightlySave $JobName
23 $bperl -e "add_attribute('$conf/bacula-dir.conf', 'Accurate', 'yes', 'Job', 'RestartJob')"
25 touch $cwd/build/po/testfile
27 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
30 @$out ${cwd}/tmp/log1.out
31 label storage=File volume=TestVolume001
32 setdebug level=0 trace=0 hangup=100 client
33 @#setdebug level=20 dir
38 select * from JobMedia;
45 scripts/check_for_zombie_jobs storage=File
47 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
49 @$out ${cwd}/tmp/log1.out
50 setdebug level=0 trace=0 hangup=50 client
51 @exec "sh -c 'touch $cwd/build/po/*'"
52 @exec "sh -c 'touch $cwd/build/src/dird/*'"
53 @exec "rm $cwd/build/po/testfile"
58 select * from JobMedia;
63 @$out ${cwd}/tmp/log2.out
64 restore where=$tmp/bacula-restores storage=File select all done
68 @$out ${cwd}/tmp/log3.out
74 scripts/check_for_zombie_jobs storage=File
80 nb_F=`awk -F '|' '/RestartJob.+F/ { gsub(/,/, ""); print $7}' $tmp/log3.out`
81 nb_I=`awk -F '|' '/RestartJob.+I/ { gsub(/,/, ""); print $7}' $tmp/log3.out`
82 nb1=`ls $cwd/build/po/* $cwd/build/src/dird/* | wc -l`
85 if [ "$nb_I" -eq "$nb_F" ]; then
86 print_debug "ERROR: Incremental saves too much files (nb Incr == nb Full)"
90 if [ "$nb_I" -ge "$nb1" ]; then
91 print_debug "ERROR: Incremental saves too much files (more than $nb1)"