]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/restart-base-job-test
Add more debug to restart regress scripts
[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', '$JobName', 'Job', '$JobName')"
17 $bperl -e "add_attribute('$conf/bacula-dir.conf', 'Accurate', 'yes', 'Job', '$JobName')"
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=200 trace=1 dir
31 run job=$JobName yes
32 wait
33 messages
34 sql
35 select * from JobMedia;
36
37 setdebug level=0 trace=0 dir
38 @$out ${cwd}/tmp/log3.out
39 list jobs
40 quit
41 END_OF_DATA
42
43 run_bacula  
44
45 scripts/check_for_zombie_jobs storage=File
46
47 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
48 @$out /dev/null
49 messages
50 @# 
51 @# now do a restore
52 @#
53 @$out ${cwd}/tmp/log2.out
54 restore where=$tmp/bacula-restores storage=File select all done
55 yes
56 wait
57 messages
58 quit
59 END_OF_DATA
60
61 run_bconsole
62 scripts/check_for_zombie_jobs storage=File
63 stop_bacula
64
65 check_two_logs
66 check_restore_diff
67
68 nb_B=`awk -F '|' '/RestartJob.+ B.+ B/ { gsub(/,/, "");print $7}' $tmp/log3.out`
69 nb_F=`awk -F '|' '/RestartJob.+F/ { gsub(/,/, ""); print $7}' $tmp/log3.out`
70
71 if [ $nb_F -ne $nb_B ]; then
72     print_debug "ERROR: Base and Full should have the same number of files"
73     estat=1
74 fi 
75
76 nb_B=`awk -F '|' '/RestartJob.+B.+B/ { gsub(/,/, ""); print $8}' $tmp/log3.out`
77 nb_F=`awk -F '|' '/RestartJob.+F/ { gsub(/,/, ""); print $8}' $tmp/log3.out`
78
79 if [ $nb_F -gt 1000000 ]; then
80     print_debug "ERROR: Base job should backup only one file"
81     estat=2
82 fi
83
84 end_test