]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/maxdev-test
baculum: Add strip_prefix, add_prefix, add_suffix and regex_where restore options...
[bacula/bacula] / regress / tests / maxdev-test
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2017 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6 # Run backups with dummy tape driver
7 # This test setups an Autochanger with 80 slots
8 # and 5 drives (5 LTO3)
9 #
10
11
12 TestName="maxdev-test"
13 JobName=backup
14 . scripts/functions
15
16 require_vtape
17
18 scripts/cleanup
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
26
27 echo "${cwd}/build" >${cwd}/tmp/file-list
28
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
37
38 start_test
39
40 clientname=`awk '/Name = .*-fd/ { if (!ok) { print $3 ; ok=1 } }' bin/bacula-dir.conf`
41
42 when1=`perl -MPOSIX -e "print strftime('%F %T', localtime(time+30))"`
43 when2=`perl -MPOSIX -e "print strftime('%F %T', localtime(time+45))"`
44
45 # Catalog record for cleaning tape "CLN01" successfully created.
46 # CLN01      | Cleaning
47
48 # Write out bconsole commands
49 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
50 @output /dev/null
51 messages
52 @$out ${cwd}/tmp/log6.out
53 @#setdebug level=200 storage=LTO1
54 label barcodes pool=Scratch slots=41-60 storage=LTO3 drive=0
55 yes
56 messages
57 list volumes
58 END_OF_DATA
59
60 run_bacula
61
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
75 wait
76 messages
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
88 @#wait
89 @#messages
90 quit
91 END_OF_DATA
92
93 run_bconsole
94 check_for_zombie_jobs storage=LTO3 client=$clientname
95
96 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
97 setdebug trace=1 level=0 storage=LTO3
98 @$out ${cwd}/tmp/log2.out  
99 @# 
100 @# now do a restore
101 @#
102 restore client=$clientname fileset="Full Set" pool=Full where=${cwd}/tmp/bacula-restores select all done
103 yes
104 wait
105 messages
106 END_OF_DATA
107
108 run_bconsole
109 check_for_zombie_jobs storage=LTO3 client=$clientname
110
111 stop_bacula
112
113 check_two_logs
114 check_restore_diff
115 perl -ne '
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}++;
120
121 END {
122  $err=0;
123  foreach $k (sort keys %drive) { 
124     if ($drive{$k} > 3) {
125        print "ERR $k has more than 3 jobs ($drive{$k})\n";
126        $err++;
127     }
128  }
129  if ($err) {
130     foreach $k (@drive_info) { print "$k\n"}
131     exit 1;
132  }
133 }
134 ' $tmp/log1.out
135
136 if [ $? -ne 0 ]; then
137     print_debug "ERR: Problem during log analysis"
138     estat=1
139 fi
140 end_test