]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/restart-accurate-job-test
37e6d82f8fa06238f1b23b66adfdcfc67835eed3
[bacula/bacula] / regress / tests / restart-accurate-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-accurate-job-test"
7 JobName=RestartJob
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', 'Accurate', 'yes', 'Job', 'RestartJob')"
17 start_test
18
19 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
20 @$out /dev/null
21 messages
22 @$out ${cwd}/tmp/log1.out
23 label storage=File volume=TestVolume001
24 setdebug level=0 trace=0 hangup=100 client
25 @#setdebug level=20 dir
26 run job=$JobName yes
27 wait
28 messages
29 quit
30 END_OF_DATA
31
32 run_bacula  
33
34 scripts/check_for_zombie_jobs storage=File
35
36 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
37 @$out /dev/null
38 @$out ${cwd}/tmp/log1.out
39 setdebug level=0 trace=0 hangup=50 client
40 @exec "sh -c 'touch $cwd/build/po/*'"
41 @exec "sh -c 'touch $cwd/build/src/dird/*'"
42 run job=$JobName yes
43 wait
44 messages
45 @# 
46 @# now do a restore
47 @#
48 @$out ${cwd}/tmp/log2.out
49 restore where=$tmp/bacula-restores storage=File select all done
50 yes
51 wait
52 messages
53 @$out ${cwd}/tmp/log3.out
54 list jobs
55 quit
56 END_OF_DATA
57
58 run_bconsole
59 scripts/check_for_zombie_jobs storage=File
60 stop_bacula
61
62 check_two_logs
63 check_restore_diff
64
65 nb_F=`awk -F '|' '/RestartJob.+F/ { gsub(/,/, ""); print $7}' $tmp/log3.out`
66 nb_I=`awk -F '|' '/RestartJob.+I/ { gsub(/,/, ""); print $7}' $tmp/log3.out`
67 nb1=`ls $cwd/build/po/* $cwd/build/src/dird/* | wc -l`
68 nb1=`expr $nb1 + 50`
69
70 if [ "$nb_I" -eq "$nb_F" ]; then
71     print_debug "ERROR: Incremental saves too much files (nb Incr == nb Full)"
72     estat=1
73 fi
74
75 if [ "$nb_I" -ge "$nb1" ]; then
76     print_debug "ERROR: Incremental saves too much files (more than $nb1)"
77     estat=1
78 fi
79
80 end_test