3 # Copyright (C) 2000-2017 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
6 # Run a backup of the build directory but force it to have
7 # a comm error, and check that it restarts correctly.
10 TestName="restart-base-job-test"
11 JobName=RestartJobWithBase
15 scripts/copy-test-confs
17 setup_shstore # simulate shared storage if enabled
19 echo "${cwd}/build" >${cwd}/tmp/file-list
21 change_jobname NightlySave $JobName
23 $bperl -e "add_attribute('$conf/bacula-dir.conf', 'Base', '$JobName', 'Job', '$JobName')"
24 $bperl -e "add_attribute('$conf/bacula-dir.conf', 'Accurate', 'yes', 'Job', '$JobName')"
27 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
30 @$out ${cwd}/tmp/log1.out
31 label storage=File volume=TestVolume001 slot=1 drive=0
32 setdebug level=200 storage=File
33 setdebug level=0 trace=0 hangup=43 client
34 run job=$JobName level=Base yes
37 @exec "touch $cwd/build/po/fr.po"
38 setdebug level=200 trace=1 dir
39 setdebug level=0 trace=0 hangup=0 client
44 select * from JobMedia;
46 setdebug level=0 trace=0 dir
47 @$out ${cwd}/tmp/log3.out
54 scripts/check_for_zombie_jobs storage=File
56 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
62 @$out ${cwd}/tmp/log2.out
63 restore where=$tmp/bacula-restores storage=File select all done
71 scripts/check_for_zombie_jobs storage=File
77 #nb_B=`awk -F '|' '/RestartJob.+ B.+ B/ { gsub(/,/, "");print $7}' $tmp/log3.out`
78 #nb_F=`awk -F '|' '/RestartJob.+F/ { gsub(/,/, ""); print $7}' $tmp/log3.out`
80 #if [ $nb_F -ne $nb_B ]; then
81 # print_debug "ERROR: Base and Full should have the same number of files"
85 #nb_B=`awk -F '|' '/RestartJob.+B.+B/ { gsub(/,/, ""); print $8}' $tmp/log3.out`
86 #nb_F=`awk -F '|' '/RestartJob.+F/ { gsub(/,/, ""); print $8}' $tmp/log3.out`
88 #if [ $nb_F -gt 1000000 ]; then
89 # print_debug "ERROR: Base job should backup only one file"