3 # Copyright (C) 2000-2017 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
6 # Run backups with dummy tape driver
7 # This test setups an Autochanger with 80 slots
8 # and 5 drives (5 LTO3)
12 TestName="maxdev-test"
19 scripts/copy-tape-confs
20 sed 's:Job {:Job { ClientRunBeforeJob = "sleep 5":' \
21 $rscripts/bacula-dir-vtape.conf > $conf/bacula-dir.conf
22 sed 's/VTape/VTape; maximum concurrent jobs = 3/' \
23 $rscripts/bacula-sd-vtape.conf | \
24 sed 's/LTO1/LTO3/g' > $conf/bacula-sd.conf
25 scripts/prepare-fake-autochanger
27 echo "${cwd}/build" >${cwd}/tmp/file-list
29 perl -Mscripts::functions -e "extract_resource('$conf/bacula-dir.conf', 'Job', 'NightlySave')" > $tmp/1
30 cat $tmp/1 | sed s/NightlySave/NightlySave4/ >> $conf/bacula-dir.conf
31 cat $tmp/1 | sed s/NightlySave/NightlySave5/ >> $conf/bacula-dir.conf
32 cat $tmp/1 | sed s/NightlySave/NightlySave6/ >> $conf/bacula-dir.conf
33 cat $tmp/1 | sed s/NightlySave/NightlySave7/ >> $conf/bacula-dir.conf
34 cat $tmp/1 | sed s/NightlySave/NightlySave8/ >> $conf/bacula-dir.conf
35 cat $tmp/1 | sed s/NightlySave/NightlySave9/ >> $conf/bacula-dir.conf
36 cat $tmp/1 | sed s/NightlySave/NightlySave10/ >> $conf/bacula-dir.conf
40 clientname=`awk '/Name = .*-fd/ { if (!ok) { print $3 ; ok=1 } }' bin/bacula-dir.conf`
42 when1=`perl -MPOSIX -e "print strftime('%F %T', localtime(time+30))"`
43 when2=`perl -MPOSIX -e "print strftime('%F %T', localtime(time+45))"`
45 # Catalog record for cleaning tape "CLN01" successfully created.
48 # Write out bconsole commands
49 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
52 @$out ${cwd}/tmp/log6.out
53 @#setdebug level=200 storage=LTO1
54 label barcodes pool=Scratch slots=41-60 storage=LTO3 drive=0
62 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
63 @$out ${cwd}/tmp/log1.out
64 setdebug trace=1 level=150 storage=LTO3
65 run storage=LTO3 when="$when1" job=NightlySave pool=Inc yes
66 run storage=LTO3 when="$when1" job=NightlySave2 pool=Inc yes
67 run storage=LTO3 when="$when1" job=NightlySave3 pool=Inc yes
68 run storage=LTO3 when="$when1" job=NightlySave4 pool=Inc yes
69 run storage=LTO3 when="$when1" job=NightlySave5 pool=Inc yes
70 run storage=LTO3 when="$when1" job=NightlySave6 pool=Full yes
71 run storage=LTO3 when="$when1" job=NightlySave7 pool=Full yes
72 run storage=LTO3 when="$when1" job=NightlySave8 pool=Full yes
73 run storage=LTO3 when="$when1" job=NightlySave9 pool=Full yes
74 run storage=LTO3 when="$when1" job=NightlySave10 pool=Full yes
77 @$out ${cwd}/tmp/log3.out
78 @#run storage=LTO3 when="$when1" job=NightlySave pool=Inc yes
79 @#run storage=LTO3 when="$when1" job=NightlySave2 pool=Inc yes
80 @#run storage=LTO3 when="$when1" job=NightlySave3 pool=Inc yes
81 @#run storage=LTO3 when="$when1" job=NightlySave4 pool=Inc yes
82 @#run storage=LTO3 when="$when1" job=NightlySave5 pool=Inc yes
83 @#run storage=LTO3 when="$when1" job=NightlySave6 pool=Full yes
84 @#run storage=LTO3 when="$when1" job=NightlySave7 pool=Full yes
85 @#run storage=LTO3 when="$when1" job=NightlySave8 pool=Full yes
86 @#run storage=LTO3 when="$when1" job=NightlySave9 pool=Full yes
87 @#run storage=LTO3 when="$when1" job=NightlySave10 pool=Full yes
94 check_for_zombie_jobs storage=LTO3 client=$clientname
96 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
97 setdebug trace=1 level=0 storage=LTO3
98 @$out ${cwd}/tmp/log2.out
102 restore client=$clientname fileset="Full Set" pool=Full where=${cwd}/tmp/bacula-restores select all done
109 check_for_zombie_jobs storage=LTO3 client=$clientname
116 # foreach Job, we store the drive and we count the total
117 # job number per drive
118 m/(\d+): Using Device "(.+?)"/
119 and $drive_info[$i++]="$1 $2" and $drive{$2}++;
123 foreach $k (sort keys %drive) {
124 if ($drive{$k} > 3) {
125 print "ERR $k has more than 3 jobs ($drive{$k})\n";
130 foreach $k (@drive_info) { print "$k\n"}
136 if [ $? -ne 0 ]; then
137 print_debug "ERR: Problem during log analysis"