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