]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/manual-two-vol-tape
regress: Tweak vtape-test-changer for more data
[bacula/bacula] / regress / tests / manual-two-vol-tape
1 #!/bin/sh
2 #
3 # Run a job with a limited tape size so that the tape fills up.
4 #  Then manually unload the tape and load a new one, label
5 #  it.
6 #
7 TestName="manual-two-vol-tape"
8 JobName=manualtwovolltape
9 . scripts/functions
10
11 require_tape_drive
12 require_autochanger
13
14 scripts/cleanup
15 scripts/copy-tape-confs
16 echo "${cwd}/build" >${cwd}/tmp/file-list
17 MTX=$AUTOCHANGER_SCRIPT
18
19 # Sleep longer if real tape
20 if [ x${USE_VTAPE} = xyes ] ; then
21    sleep=20 
22 else
23    sleep=90
24 fi
25
26 slot=0
27 export slot
28
29 # TODO -- check this
30 init_slot $TAPE_DRIVE $SLOT1
31 init_slot $TAPE_DRIVE $SLOT2
32
33 load_slot1
34
35 init_drive ${TAPE_DRIVE}
36
37 change_jobname $JobName
38 start_test
39
40 # Label second volume
41 cat <<END_OF_DATA >tmp/bconcmds
42 @out /dev/null
43 messages
44 @$out tmp/log1.out
45 label storage=tape volume=TestVolume002 slot=0 pool=Default drive=0
46 unmount storage=tape
47 quit
48 END_OF_DATA
49
50 run_bacula
51
52 # Load slot2
53 load_other_slot $slot
54 init_drive ${TAPE_DRIVE}
55
56 # label first volume, and run first half of job
57 cat <<END_OF_DATA >tmp/bconcmds
58 @$out tmp/log1.out
59 label storage=tape volume=TestVolume001 slot=0 pool=Default drive=0
60 update Volume=TestVolume001 MaxVolBytes=500000 pool=Default drive=0
61 list volumes
62 @#setdebug level=150 storage=tape
63 run job=$JobName yes
64 @# This sleep must be long enough for the first tape to fill (4MB)
65 @#  otherwise the following mtx-changer commands will fail
66 @#sleep $sleep
67 wait mount timeout=180
68 list volumes
69 unmount storage=tape
70 list volumes
71 status storage=tape
72 messages
73 quit
74 END_OF_DATA
75
76 run_bconsole
77
78 load_other_slot $slot
79
80 cat <<END_OF_DATA >tmp/bconcmds
81 @$out tmp/log1.out
82 wait mount timeout=180
83 setdebug level=200 storage=tape
84 mount storage=tape
85 @# backup should continue
86 wait
87 list volumes
88 @# 
89 @# now do a restore
90 @#
91 restore where=${cwd}/tmp/bacula-restores select all storage=tape done
92 yes
93 @sleep $sleep
94 wait mount timeout=180
95 exec "sh -c 'load_other_slot $slot'"
96 unmount storage=tape
97 list volumes
98 messages
99 wait
100 quit
101 END_OF_DATA
102
103 # run second half of backup + restore
104 run_bconsole
105
106 touch tmp/log2.out
107  
108 check_for_zombie_jobs storage=tape
109 stop_bacula
110
111 check_two_logs
112 #check_restore_diff
113 dstat=0   # no diff
114 rstat=0   # no restore
115 end_test