]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/maxdev-test
ceede3836fb034887f0a3706e4a42c5395de5983
[bacula/bacula] / regress / tests / maxdev-test
1 #!/bin/sh
2 #
3 # Run backups with dummy tape driver
4 # This test setups an Autochanger with 80 slots
5 # and 5 drives (5 LTO3)
6 #
7
8
9 TestName="maxdev-test"
10 JobName=backup
11 . scripts/functions
12
13 require_vtape
14
15 scripts/cleanup
16 scripts/copy-tape-confs
17 sed 's:Job {:Job { ClientRunBeforeJob = "/bin/sleep 5":' \
18     $rscripts/bacula-dir-vtape.conf > $conf/bacula-dir.conf
19 sed 's/VTape/VTape; maximum concurrent jobs = 3/' \
20     $rscripts/bacula-sd-vtape.conf | \
21     sed 's/LTO1/LTO3/g' > $conf/bacula-sd.conf
22 scripts/prepare-fake-autochanger
23
24 echo "${cwd}/build" >${cwd}/tmp/file-list
25
26 perl -Mscripts::functions -e "extract_resource('$conf/bacula-dir.conf', 'Job', 'NightlySave')" > $tmp/1
27 cat $tmp/1 | sed s/NightlySave/NightlySave4/ >> $conf/bacula-dir.conf
28 cat $tmp/1 | sed s/NightlySave/NightlySave5/ >> $conf/bacula-dir.conf
29 cat $tmp/1 | sed s/NightlySave/NightlySave6/ >> $conf/bacula-dir.conf
30 cat $tmp/1 | sed s/NightlySave/NightlySave7/ >> $conf/bacula-dir.conf
31 cat $tmp/1 | sed s/NightlySave/NightlySave8/ >> $conf/bacula-dir.conf
32 cat $tmp/1 | sed s/NightlySave/NightlySave9/ >> $conf/bacula-dir.conf
33 cat $tmp/1 | sed s/NightlySave/NightlySave10/ >> $conf/bacula-dir.conf
34
35 start_test
36
37 clientname=`awk '/Name = .*-fd/ { if (!ok) { print $3 ; ok=1 } }' bin/bacula-dir.conf`
38
39 when1=`perl -MPOSIX -e "print strftime('%F %T', localtime(time+30))"`
40 when2=`perl -MPOSIX -e "print strftime('%F %T', localtime(time+45))"`
41
42 # Catalog record for cleaning tape "CLN01" successfully created.
43 # CLN01      | Cleaning
44
45 # Write out bconsole commands
46 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
47 @output /dev/null
48 messages
49 @$out ${cwd}/tmp/log6.out
50 @#setdebug level=200 storage=LTO1
51 label barcodes pool=Scratch slots=41-60 storage=LTO3 drive=0
52 yes
53 messages
54 list volumes
55 END_OF_DATA
56
57 run_bacula
58
59 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
60 @$out ${cwd}/tmp/log1.out
61 setdebug trace=1 level=150 storage=LTO3
62 run storage=LTO3 when="$when1" job=NightlySave   pool=Inc     yes
63 run storage=LTO3 when="$when1" job=NightlySave2  pool=Inc     yes
64 run storage=LTO3 when="$when1" job=NightlySave3  pool=Inc     yes
65 run storage=LTO3 when="$when1" job=NightlySave4  pool=Inc     yes
66 run storage=LTO3 when="$when1" job=NightlySave5  pool=Inc     yes
67 run storage=LTO3 when="$when1" job=NightlySave6  pool=Full    yes
68 run storage=LTO3 when="$when1" job=NightlySave7  pool=Full    yes
69 run storage=LTO3 when="$when1" job=NightlySave8  pool=Full    yes
70 run storage=LTO3 when="$when1" job=NightlySave9  pool=Full    yes
71 run storage=LTO3 when="$when1" job=NightlySave10 pool=Full    yes
72 wait
73 messages
74 @$out ${cwd}/tmp/log3.out
75 @#run storage=LTO3 when="$when1" job=NightlySave   pool=Inc     yes
76 @#run storage=LTO3 when="$when1" job=NightlySave2  pool=Inc     yes
77 @#run storage=LTO3 when="$when1" job=NightlySave3  pool=Inc     yes
78 @#run storage=LTO3 when="$when1" job=NightlySave4  pool=Inc     yes
79 @#run storage=LTO3 when="$when1" job=NightlySave5  pool=Inc     yes
80 @#run storage=LTO3 when="$when1" job=NightlySave6  pool=Full    yes
81 @#run storage=LTO3 when="$when1" job=NightlySave7  pool=Full    yes
82 @#run storage=LTO3 when="$when1" job=NightlySave8  pool=Full    yes
83 @#run storage=LTO3 when="$when1" job=NightlySave9  pool=Full    yes
84 @#run storage=LTO3 when="$when1" job=NightlySave10 pool=Full    yes
85 @#wait
86 @#messages
87 quit
88 END_OF_DATA
89
90 run_bconsole
91 check_for_zombie_jobs storage=LTO3 client=$clientname
92
93 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
94 setdebug trace=1 level=0 storage=LTO3
95 @$out ${cwd}/tmp/log2.out  
96 @# 
97 @# now do a restore
98 @#
99 restore client=$clientname fileset="Full Set" pool=Full where=${cwd}/tmp/bacula-restores select all done
100 yes
101 wait
102 messages
103 END_OF_DATA
104
105 run_bconsole
106 check_for_zombie_jobs storage=LTO3 client=$clientname
107
108 stop_bacula
109
110 check_two_logs
111 check_restore_diff
112 perl -ne '
113 # foreach Job, we store the drive and we count the total
114 # job number per drive
115 m/(\d+): Using Device "(.+?)"/ 
116   and $drive_info[$i++]="$1 $2" and $drive{$2}++;
117
118 END {
119  $err=0;
120  foreach $k (sort keys %drive) { 
121     if ($drive{$k} > 3) {
122        print "ERR $k has more than 3 jobs ($drive{$k})\n";
123        $err++;
124     }
125  }
126  if ($err) {
127     foreach $k (@drive_info) { print "$k\n"}
128     exit 1;
129  }
130 }
131 ' $tmp/log1.out
132
133 if [ $? -ne 0 ]; then
134     print_debug "ERR: Problem during log analysis"
135     estat=1
136 fi
137 end_test
138