]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/ansi-label-tape
regress: enhance btape-test to detect NOT correct message
[bacula/bacula] / regress / tests / ansi-label-tape
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2017 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6 # Test of ANSI labeled tapes
7 #
8 # Run a simple backup of the Bacula build directory 
9 #   to a tape then restore it, we do that twice to ensure that
10 #   we can correctly append to a tape.
11 # We also use the purge and the relabel commands as
12 #   well as a pile of status storage commands.
13 #
14 TestName="ansi-label-tape"
15 JobName=backuptape
16 . scripts/functions
17
18 require_tape_drive
19
20 scripts/copy-tape-confs
21 /bin/cp -f scripts/ansi-sd-tape.conf bin/bacula-sd.conf
22 scripts/cleanup-tape
23
24 echo "${cwd}/build" >${cwd}/tmp/file-list
25
26 change_jobname NightlySave $JobName
27 start_test
28
29 # Write out bconsole commands
30 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
31 @$out /dev/null
32 messages
33 @$out ${cwd}/tmp/log1.out
34 @#setdebug level=200 storage=tape
35 label storage=tape volume=Vol001 slot=0 pool=Default
36 purge volume=Vol001
37 relabel pool=Default storage=tape oldVolume=Vol001 volume=Vol002 slot=0
38 purge volume=Vol002
39 relabel pool=Default storage=tape oldVolume=Vol002 volume=Vol001 slot=0
40 run job=$JobName yes
41 status storage=tape
42 @sleep 1
43 wait
44 messages
45 @# 
46 @# now do a restore
47 @#
48 @$out ${cwd}/tmp/log2.out
49 setdebug level=200 storage=tape
50 restore where=${cwd}/tmp/bacula-restores select all storage=tape done
51 yes
52 wait
53 list volumes
54 messages
55 END_OF_DATA
56
57 run_bacula
58 check_for_zombie_jobs storage=tape
59 stop_bacula
60
61 #
62 # Now do a second backup after making a few changes
63 #
64 touch ${cwd}/build/src/dird/*.c
65 echo "test test" > ${cwd}/build/src/dird/xxx
66
67 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
68 @$out /dev/null
69 messages
70 @$out ${cwd}/tmp/log1.out
71 list volumes
72 @#setdebug level=300 storage=tape
73 run job=$JobName yes
74 wait
75 list volumes
76 messages
77 @# 
78 @# now do a second restore
79 @#
80 @$out ${cwd}/tmp/log2.out
81 list volumes
82 restore where=${cwd}/tmp/bacula-restores select all storage=tape done
83 yes
84 wait
85 list volumes
86 messages
87 quit
88 END_OF_DATA
89
90 run_bacula
91 check_for_zombie_jobs storage=tape
92 stop_bacula
93
94 check_two_logs
95 check_restore_diff
96 end_test