]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/two-pool-tape
a9dabe443961218f82a916ccbe519d2e32bca2ea
[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 . config.out
11 if test x${AUTOCHANGER} = x/dev/null ; then
12    echo "two-pool-tape test skipped. No autochanger."
13    exit
14 fi
15 debug=0
16 if test "$debug" -eq 1 ; then
17   out="tee"
18 else
19   out="output"
20 fi
21 cwd=`pwd`
22 scripts/cleanup
23 scripts/copy-2tape-confs
24 scripts/prepare-two-tapes
25  
26 # Make a relatively large backup set 5 x source code directory
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
33 echo " "
34 echo " "
35 echo " === Starting Two Pool Tape test at `date +%R:%S` ==="
36 echo " === Starting Two Pool Tape test at `date +%R:%S` ===" >>working/log
37 echo " "
38 # Write out bconsole commands to a file
39 cat <<END_OF_DATA >tmp/bconcmds
40 @output /dev/null
41 messages
42 @$out tmp/log1.out
43 label storage=DDS-4 volume=TestVolume001 slot=1 pool=Full drive=0
44 label storage=DDS-4 volume=TestVolume002 slot=2 pool=Default drive=0
45 list volumes
46 @# Start job with Client run before and sleep
47 run job=NightlySave1 level=Full pool=Default yes
48 run job=NightlySave1 level=Full pool=Default yes
49 run job=NightlySave1 level=Full pool=Default yes
50 @# wait between starting jobs
51 @sleep 60
52 @#setdebug level=100 storage=DDS-4
53 run job=NightlySave2 level=Full pool=Full yes
54 run job=NightlySave2 level=Full pool=Full yes
55 run job=NightlySave2 level=Full pool=Full yes
56 @sleep 10
57 messages
58 @sleep 10
59 messages
60 @sleep 10
61 status storage=DDS-4
62 messages
63 wait
64 list volumes
65 messages
66 @# 
67 @# now do a restore
68 @#
69 @$out tmp/log2.out
70 restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done
71 yes
72 wait
73 messages
74 @$out
75 quit
76 END_OF_DATA
77
78 # start Bacula and run bconsole commands
79 if test "$debug" -eq 1 ; then
80   bin/bacula start
81   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
82 else
83   bin/bacula start 2>&1 >/dev/null
84   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf  2>&1 >/dev/null
85 fi
86 # Make sure no jobs are still running (debug check)
87 scripts/check_for_zombie_jobs storage=DDS-4
88
89 # stop Bacula
90 bin/bacula stop 2>&1 >/dev/null
91 # Check if backup done correctly
92 grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
93 bstat=$?
94 grep "^  Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
95 rstat=$?
96 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
97 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
98    echo " "
99    echo " "
100    echo "  !!!!! Two Pool Tape test Bacula source failed!!! !!!!! "
101    echo "  !!!!! Two Pool Tape test failed!!! !!!!! " >>test.out
102    echo " "
103 else
104    echo "  ===== Two Pool Tape test Bacula source OK ===== "
105    echo "  ===== Two Pool Tape test OK ===== " >>test.out
106 #  scripts/cleanup
107 fi