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