]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/two-volume-changer
5e3462570aa4b9cc1397f0b6c1cd2cb6a52a9878
[bacula/bacula] / regress / tests / two-volume-changer
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory 
4 #  to two tapes where the maximum tape file size is set to 1M
5 #  Note, this test simulates the tape filling and writing to
6 #   the next tape.
7 #
8 TestName="two-volume-changer"
9 JobName=twovolchanger
10 . scripts/functions
11
12 require_tape_drive
13 require_autochanger
14
15 scripts/cleanup
16 scripts/copy-2tape-confs
17 scripts/prepare-two-tapes
18  
19 echo "${cwd}/build" >${cwd}/tmp/file-list
20
21 outf="tmp/sed_tmp"
22 echo "s%# Maximum File Size%  Maximum File Size%g" >${outf}
23 cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
24 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
25
26 change_jobname $JobName
27 start_test
28
29 # Write out bconsole commands
30 cat <<END_OF_DATA >tmp/bconcmds
31 @$out /dev/null
32 messages
33 @$out tmp/log1.out
34 label storage=tape volume=TestVolume001 slot=$SLOT1 pool=Default drive=$DRIVE1
35 label storage=tape volume=TestVolume002 slot=$SLOT2 pool=Default drive=$DRIVE1
36 update Volume=TestVolume002 MaxVolBytes=3000000 pool=Default drive=$DRIVE1
37 sql
38 select * from Storage;
39 select VolumeName,InChanger,Slot,StorageId from Media;
40
41 @#setdebug level=1000 client=$CLIENT 
42 setdebug level=150 storage=tape
43 run job=$JobName yes
44 wait
45 sql
46 select * from Storage;
47 select VolumeName,InChanger,Slot,StorageId from Media;
48
49 messages
50 quit
51 END_OF_DATA
52
53 run_bacula
54 check_for_zombie_jobs storage=tape
55 stop_bacula
56
57 $scripts/${AUTOCHANGER_SCRIPT} ${AUTOCHANGER} unload $SLOT2 ${TAPE_DRIVE} 0
58
59 cat <<END_OF_DATA >tmp/bconcmds
60 @$out /dev/null
61 messages
62 @# 
63 @# now do a restore
64 @#
65 @$out tmp/log2.out
66 restore where=${cwd}/tmp/bacula-restores select all storage=tape done
67 yes
68 wait
69 messages
70 quit
71 END_OF_DATA
72
73 run_bacula
74 check_for_zombie_jobs storage=tape
75 stop_bacula
76
77 check_two_logs
78 check_restore_diff
79 end_test