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