]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/vtape-test-changer
regress: change /bin/sleep to sleep
[bacula/bacula] / regress / tests / vtape-test-changer
1 #!/bin/sh
2 #
3 # Run backups with dummy tape driver
4 # This test setups an Autochanger with 80 slots
5 # and 5 drives (3 LTO3 and 2 LTO1)
6 #
7 # TAPE_DRIVE="$cwd/working/ach/drive0"
8 # TAPE_DRIVE1="$cwd/working/ach/drive0"
9 # AUTOCHANGER="$cwd/working/ach/conf"
10 # USE_VTAPE=yes
11 # AUTOCHANGER_SCRIPT=disk-changer
12
13
14 TestName="vtape-test-changer"
15 JobName=backup
16 . scripts/functions
17
18 require_vtape
19
20 scripts/cleanup
21 scripts/copy-tape-confs
22 cp $rscripts/bacula-dir-vtape.conf $conf/bacula-dir.conf
23 cp $rscripts/bacula-sd-vtape.conf $conf/bacula-sd.conf
24 scripts/prepare-fake-autochanger
25
26 echo "${cwd}/build" >${cwd}/tmp/file-list
27
28 start_test
29
30 when1=`perl -MPOSIX -e "print strftime('%F %T', localtime(time+30))"`
31 when2=`perl -MPOSIX -e "print strftime('%F %T', localtime(time+45))"`
32
33 clientname=`awk '/Name = .*-fd/ { if (!ok) { print $3 ; ok=1 } }' bin/bacula-dir.conf`
34
35 # Catalog record for cleaning tape "CLN01" successfully created.
36 # CLN01      | Cleaning
37
38 # Write out bconsole commands
39 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
40 @$out /dev/null
41 messages
42 @$out ${cwd}/tmp/log6.out
43 @#setdebug level=200 storage=LTO1
44 label barcodes pool=Scratch slots=1-14 storage=LTO1-ANSI_6 drive=6
45 yes
46 label barcodes pool=Scratch slots=15-40 storage=LTO1 drive=3
47 yes
48 messages
49 list volumes
50 END_OF_DATA
51
52 run_bacula
53
54 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
55 @$out ${cwd}/tmp/log7.out
56 label barcodes pool=Scratch slots=41-80 storage=LTO3 drive=0
57 yes
58 messages
59 list volumes
60 @$out ${cwd}/tmp/log1.out
61 run storage=LTO3 when="$when1" job=NightlySave  pool=Inc     yes
62 run storage=LTO3 when="$when1" job=NightlySave2 pool=Full    yes
63 run storage=LTO3 when="$when1" job=NightlySave1 pool=Default yes
64
65 run storage=LTO1 when="$when1" job=NightlySave  pool=Inc     yes
66 run storage=LTO1 when="$when1" job=NightlySave2 pool=Full    yes
67 run storage=LTO1 when="$when1" job=NightlySave1 pool=Default yes
68 run storage=LTO1 when="$when1" job=NightlySave3 pool=Diff    yes
69
70 run storage=LTO1-ANSI_6 when="$when2" job=NightlySave  pool=Inc     yes
71 wait
72 messages
73 quit
74 END_OF_DATA
75
76 run_bconsole
77 check_for_zombie_jobs storage=LTO1 client=$clientname
78 check_for_zombie_jobs storage=LTO3 client=$clientname
79 check_for_zombie_jobs storage=LTO1-ANSI_6 client=$clientname
80
81 touch ${cwd}/build/po/*.po
82
83 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
84 @$out ${cwd}/tmp/log2.out  
85 run storage=LTO1-ANSI_6 job=NightlySave3 pool=Inc  yes
86 wait
87 messages
88 @# 
89 @# now do a restore
90 @#
91 restore client=$clientname fileset="Full Set" pool=Diff where=${cwd}/tmp/bacula-restores select all done
92 yes
93 wait
94 messages
95 wait
96 messages
97 END_OF_DATA
98
99 run_bconsole
100 check_for_zombie_jobs storage=LTO1 client=$clientname
101 check_for_zombie_jobs storage=LTO3 client=$clientname
102 check_for_zombie_jobs storage=LTO1-ANSI_6 client=$clientname
103
104 # test update slots
105 # remove volume vol35 from autochanger
106 grep -v vol35 ${cwd}/working/ach/barcodes > ${cwd}/tmp/1
107 cp ${cwd}/tmp/1 ${cwd}/working/ach/barcodes
108
109 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
110 @$out ${cwd}/tmp/log3.out
111 list volume=vol35
112 update slots slots=15-40 storage=LTO1 drive=3
113 list volume=vol35
114 END_OF_DATA
115
116 run_bconsole
117
118 stop_bacula
119
120 check_two_logs
121 check_restore_diff
122
123 # get InChanger flag
124 RES=`awk -F'|' '/vol35.+Append/ { print $11 }' ${cwd}/tmp/log3.out`
125 set $RES
126 if [ $1 -eq $2 ]; then
127     print_debug "ERROR: Error in update slots"
128     bstat=1
129 fi
130
131 grep LTO1_5 tmp/log1.out > /dev/null
132 if test $? = 0; then
133     print_debug "ERROR: AutoSelect option broken"
134     bstat=1
135 fi
136
137 grep 'Error: Re-read' tmp/log1.out > /dev/null
138 if test $? = 0; then
139     print_debug "ERROR: Found Re-read errors"
140     bstat=1
141 fi
142
143 end_test