]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/two-pool-tape
Update
[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 20 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
43 echo " "
44 echo " "
45 echo " === Starting Two Pool Tape test at `date +%R:%S` ==="
46 echo " === Starting Two Pool Tape test at `date +%R:%S` ===" >>working/log
47 echo " "
48 # Write out bconsole commands to a file
49 cat <<END_OF_DATA >tmp/bconcmds
50 @$out /dev/null
51 messages
52 @$out tmp/log1.out
53 label storage=DDS-4 volume=TestVolume001 slot=1 pool=Full drive=0
54 label storage=DDS-4 volume=TestVolume002 slot=2 pool=Default drive=0
55 run job=NightlySave level=Full pool=Default yes
56 @# wait between starting jobs
57 @sleep 60
58 run job=NightlySave level=Full pool=Full yes
59 @sleep 10
60 messages
61 @sleep 10
62 messages
63 @sleep 10
64 status storage=DDS-4
65 messages
66 wait
67 messages
68 @# 
69 @# now do a restore
70 @#
71 @$out tmp/log2.out
72 restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done
73 yes
74 wait
75 messages
76 @$out
77 quit
78 END_OF_DATA
79
80 # start Bacula and run bconsole commands
81 if test "$debug" -eq 1 ; then
82   bin/bacula start
83   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
84 else
85   bin/bacula start 2>&1 >/dev/null
86   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf  2>&1 >/dev/null
87 fi
88 # Make sure no jobs are still running (debug check)
89 scripts/check_for_zombie_jobs storage=DDS-4
90
91 # stop Bacula
92 bin/bacula stop 2>&1 >/dev/null
93 # Check if backup done correctly
94 grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
95 bstat=$?
96 grep "^  Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
97 rstat=$?
98 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
99 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
100    echo " "
101    echo " "
102    echo "  !!!!! Two Pool Tape test Bacula source failed!!! !!!!! "
103    echo "  !!!!! Two Pool Tape test failed!!! !!!!! " >>test.out
104    echo " "
105 else
106    echo "  ===== Two Pool Tape test Bacula source OK ===== "
107    echo "  ===== Two Pool Tape test OK ===== " >>test.out
108 #  scripts/cleanup
109 fi