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