]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/restart-base-job-test
3a6a2dc5304c3e619e25d613ec1f7252ac3ae537
[bacula/bacula] / regress / tests / restart-base-job-test
1 #!/bin/sh
2 #
3 # Run a backup of the build directory but force it to have
4 #   a comm error, and check that it restarts correctly.
5 #
6 TestName="restart-base-job-test"
7 JobName=RestartJobWithBase
8 . scripts/functions
9
10 scripts/cleanup
11 scripts/copy-test-confs
12 echo "${cwd}/build" >${cwd}/tmp/file-list
13
14 change_jobname NightlySave $JobName
15
16 $bperl -e "add_attribute('$conf/bacula-dir.conf', 'Base', 'RestartJob', 'Job', 'RestartJob')"
17 $bperl -e "add_attribute('$conf/bacula-dir.conf', 'Accurate', 'yes', 'Job', 'RestartJob')"
18 start_test
19
20 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
21 @$out /dev/null
22 messages
23 @$out ${cwd}/tmp/log1.out
24 label storage=File volume=TestVolume001
25 run job=$JobName level=Base yes
26 wait
27 messages
28 @exec "touch $cwd/build/po/fr.po"
29 setdebug level=0 trace=0 hangup=100 client
30 @#setdebug level=20 dir
31 run job=$JobName yes
32 wait
33 messages
34 @$out ${cwd}/tmp/log3.out
35 list jobs
36 quit
37 END_OF_DATA
38
39 run_bacula  
40
41 scripts/check_for_zombie_jobs storage=File
42
43 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
44 @$out /dev/null
45 messages
46 @# 
47 @# now do a restore
48 @#
49 @$out ${cwd}/tmp/log2.out
50 restore where=$tmp/bacula-restores storage=File select all done
51 yes
52 wait
53 messages
54 quit
55 END_OF_DATA
56
57 run_bconsole
58 scripts/check_for_zombie_jobs storage=File
59 stop_bacula
60
61 check_two_logs
62 check_restore_diff
63
64 nb_B=`awk -F '|' '/RestartJob.+ B.+ B/ { gsub(/,/, "");print $7}' $tmp/log3.out`
65 nb_F=`awk -F '|' '/RestartJob.+F/ { gsub(/,/, ""); print $7}' $tmp/log3.out`
66
67 if [ $nb_F -ne $nb_B ]; then
68     print_debug "ERROR: Base and Full should have the same number of files"
69     estat=1
70 fi 
71
72 nb_B=`awk -F '|' '/RestartJob.+B.+B/ { gsub(/,/, ""); print $8}' $tmp/log3.out`
73 nb_F=`awk -F '|' '/RestartJob.+F/ { gsub(/,/, ""); print $8}' $tmp/log3.out`
74
75 if [ $nb_F -gt 1000000 ]; then
76     print_debug "ERROR: Base job should backup only one file"
77     estat=2
78 fi
79
80 end_test