]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/two-pool-tape
Updates
[bacula/bacula] / regress / tests / two-pool-tape
1 #!/bin/sh
2 #
3 # This is Arno's test.  It uses two pools, two tapes, and
4 #  an autochanger. Note, the Director has three Pools in its 
5 #  conf:  Default, Full, and Inc.  Default is used in the
6 #  NightlySave job by default.  What is backed up is what
7 #  is in /tmp/file-list, which is by default the Bacula
8 #  source code (i.e. the build directory).
9 #
10 debug=1
11 if test "$debug" -eq 1 ; then
12   out="tee"
13 else
14   out="output"
15 fi
16 cwd=`pwd`
17 scripts/cleanup
18 scripts/copy-2tape-confs
19 scripts/prepare-two-tapes
20  
21 # Make a relatively large backup set 50 x source code directory
22 echo "${cwd}/build" >/tmp/file-list
23 echo "${cwd}/build" >>/tmp/file-list
24 echo "${cwd}/build" >>/tmp/file-list
25 echo "${cwd}/build" >>/tmp/file-list
26 echo "${cwd}/build" >>/tmp/file-list
27 echo "${cwd}/build" >>/tmp/file-list
28 echo "${cwd}/build" >>/tmp/file-list
29 echo "${cwd}/build" >>/tmp/file-list
30 echo "${cwd}/build" >>/tmp/file-list
31 echo "${cwd}/build" >>/tmp/file-list
32 echo "${cwd}/build" >>/tmp/file-list
33 echo "${cwd}/build" >>/tmp/file-list
34 echo "${cwd}/build" >>/tmp/file-list
35 echo "${cwd}/build" >>/tmp/file-list
36 echo "${cwd}/build" >>/tmp/file-list
37 echo "${cwd}/build" >>/tmp/file-list
38 echo "${cwd}/build" >>/tmp/file-list
39 echo "${cwd}/build" >>/tmp/file-list
40 echo "${cwd}/build" >>/tmp/file-list
41 echo "${cwd}/build" >>/tmp/file-list
42 echo "${cwd}/build" >>/tmp/file-list
43 echo "${cwd}/build" >>/tmp/file-list
44 echo "${cwd}/build" >>/tmp/file-list
45 echo "${cwd}/build" >>/tmp/file-list
46 echo "${cwd}/build" >>/tmp/file-list
47 echo "${cwd}/build" >>/tmp/file-list
48 echo "${cwd}/build" >>/tmp/file-list
49 echo "${cwd}/build" >>/tmp/file-list
50 echo "${cwd}/build" >>/tmp/file-list
51 echo "${cwd}/build" >>/tmp/file-list
52 echo "${cwd}/build" >>/tmp/file-list
53 echo "${cwd}/build" >>/tmp/file-list
54 echo "${cwd}/build" >>/tmp/file-list
55 echo "${cwd}/build" >>/tmp/file-list
56 echo "${cwd}/build" >>/tmp/file-list
57 echo "${cwd}/build" >>/tmp/file-list
58 echo "${cwd}/build" >>/tmp/file-list
59 echo "${cwd}/build" >>/tmp/file-list
60 echo "${cwd}/build" >>/tmp/file-list
61 echo "${cwd}/build" >>/tmp/file-list
62 echo "${cwd}/build" >>/tmp/file-list
63 echo "${cwd}/build" >>/tmp/file-list
64 echo "${cwd}/build" >>/tmp/file-list
65 echo "${cwd}/build" >>/tmp/file-list
66 echo "${cwd}/build" >>/tmp/file-list
67 echo "${cwd}/build" >>/tmp/file-list
68 echo "${cwd}/build" >>/tmp/file-list
69 echo "${cwd}/build" >>/tmp/file-list
70 echo "${cwd}/build" >>/tmp/file-list
71 echo "${cwd}/build" >>/tmp/file-list
72
73 echo " "
74 echo " "
75 echo " === Starting Two Pool Tape test at `date +%R:%S` ==="
76 echo " === Starting Two Pool Tape test at `date +%R:%S` ===" >>working/log
77 echo " "
78 # Write out bconsole commands to a file
79 cat <<END_OF_DATA >tmp/bconcmds
80 @$out /dev/null
81 messages
82 @$out tmp/log1.out
83 label storage=DDS-4 volume=TestVolume001 slot=1 pool=Full drive=0
84 label storage=DDS-4 volume=TestVolume002 slot=2 pool=Default drive=0
85 run job=NightlySave level=Full pool=Default yes
86 @# wait between starting jobs
87 @sleep 60
88 @#setdebug level=100 storage=DDS-4
89 run job=NightlySave level=Full pool=Full yes
90 @sleep 10
91 messages
92 @sleep 10
93 messages
94 @sleep 10
95 status storage=DDS-4
96 messages
97 wait
98 messages
99 @# 
100 @# now do a restore
101 @#
102 @$out tmp/log2.out
103 restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done
104 yes
105 wait
106 messages
107 @$out
108 quit
109 END_OF_DATA
110
111 # start Bacula and run bconsole commands
112 if test "$debug" -eq 1 ; then
113   bin/bacula start
114   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
115 else
116   bin/bacula start 2>&1 >/dev/null
117   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf  2>&1 >/dev/null
118 fi
119 # Make sure no jobs are still running (debug check)
120 scripts/check_for_zombie_jobs storage=DDS-4
121
122 # stop Bacula
123 bin/bacula stop 2>&1 >/dev/null
124 # Check if backup done correctly
125 grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
126 bstat=$?
127 grep "^  Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
128 rstat=$?
129 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
130 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
131    echo " "
132    echo " "
133    echo "  !!!!! Two Pool Tape test Bacula source failed!!! !!!!! "
134    echo "  !!!!! Two Pool Tape test failed!!! !!!!! " >>test.out
135    echo " "
136 else
137    echo "  ===== Two Pool Tape test Bacula source OK ===== "
138    echo "  ===== Two Pool Tape test OK ===== " >>test.out
139 #  scripts/cleanup
140 fi