]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/multi-storage-test
chmod +x regress/tests/multi-storage-test
[bacula/bacula] / regress / tests / multi-storage-test
1 #!/bin/sh
2 #
3 # This script uses the virtual disk autochanger
4 #
5 TestName="multi-storage-test"
6 JobName=backup
7 . scripts/functions
8
9 scripts/cleanup
10 scripts/copy-2disk-confs
11 scripts/prepare-disk-changer
12
13 perl -ne '
14 if (/^Storage {/) { $in=1; $nb++; }
15 if (/^}/) { $in=0 }
16 if (/Address / && $in) {$_ = "Address = 127.0.0.$nb\n"; }
17 print;
18 ' $conf/bacula-dir.conf > $tmp/1
19 cp $tmp/1 $conf/bacula-dir.conf
20
21 disable_pluguins
22
23 echo "${cwd}/tmp/build" >${cwd}/tmp/file-list
24 if test ! -d ${cwd}/tmp/build ; then
25    mkdir ${cwd}/tmp/build
26 fi
27 cp -p ${cwd}/build/src/dird/*.c ${cwd}/tmp/build
28 cd ${cwd}/tmp
29 echo "${cwd}/tmp/build/ficheriro1.txt" >restore-list
30 echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list
31 cd ${cwd}
32
33 change_jobname $JobName
34 start_test
35
36 # Write out bconsole commands
37 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
38 @$out /dev/null
39 messages
40 @$out ${cwd}/tmp/log1.out
41 label storage=DDS-4 volume=TestVolume001 Pool=Default slot=1 drive=0
42 label storage=File  volume=TestVolume002 Pool=Default
43 run job=$JobName storage=DDS-4 yes
44 wait
45 messages
46 quit
47 END_OF_DATA
48
49 run_bacula
50
51 echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt
52 echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt
53
54
55 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
56 @$out /dev/null
57 messages
58 @$out ${cwd}/tmp/log1.out
59 @# Force Incremental on the second Volume
60 run level=Incremental storage=File job=$JobName yes
61 wait
62 messages
63 @# 
64 @# now do a restore
65 @#
66 @$out ${cwd}/tmp/log2.out
67 setdebug trace=1 level=110 client
68 setdebug trace=1 level=110 director
69 restore where=${cwd}/tmp/bacula-restores select all done yes
70 wait
71 messages
72 @$out
73 quit
74 END_OF_DATA
75
76 run_bconsole
77
78 check_for_zombie_jobs storage=File
79 stop_bacula
80
81 check_two_logs
82 check_restore_tmp_build_diff
83
84 #
85 # This script seems to more or less randomly fail, so we
86 #  add extra code here to produce a "dump" in the event of
87 #  an error.
88 #
89 if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
90    cat ${cwd}/tmp/log1.out
91    echo "  "
92    cat ${cwd}/tmp/log2.out
93    echo "  "
94    diff -r ${cwd}/tmp/build ${cwd}/tmp/bacula-restores${cwd}/tmp/build
95 fi
96
97 end_test