]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/relabel-tape
Update test
[bacula/bacula] / regress / tests / relabel-tape
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory using the compressed option
4 #   then backup four times, each with incremental then finally restore.
5 #   It should require at least 4 different bsrs.
6 #
7 cwd=`pwd`
8
9 scripts/copy-tape-confs
10 scripts/cleanup-tape
11 echo "${cwd}/build" >/tmp/file-list
12
13 echo " "
14 echo " "
15 echo " === Starting relabel-tape at `date +%R:%S` ==="
16 echo " === Starting relabel-tape at `date +%R:%S` ===" >>working/log
17 echo " "
18
19 bin/bacula start 2>&1 >/dev/null
20 #bin/bacula start
21 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
22 #bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
23 @output /dev/null
24 messages
25 @output tmp/log1.out
26 label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default
27 run job=NightlySave level=Full yes
28 wait
29 messages
30 add pool=Default
31 0
32 TestVolume002
33 0
34 no
35 update volume=TestVolume001
36 1
37
38 .
39 run job=NightlySave level=Full yes
40 @sleep 20
41 unmount
42 unmount
43 purge volume=TestVolume001
44 relabel oldvolume=TestVolume001 volume=TestVolume003 slot=0
45 list volumes
46 messages
47 wait
48 messages
49 @output
50 quit
51 END_OF_DATA
52 echo "Backup done"
53
54 # now do several restores to ensure we cleanup between jobs
55 #
56 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
57 @output /dev/null
58 restore where=${cwd}/tmp/bacula-restores select all done
59 yes
60 wait
61 restore where=${cwd}/tmp/bacula-restores select all done
62 yes
63 wait
64 @output tmp/log2.out
65 @#
66 @# now unmount the tape and start two restores
67 @#  at the same time
68 @#
69 unmount storage=DDS-4
70 restore where=${cwd}/tmp/bacula-restores select all done
71 yes
72 restore where=${cwd}/tmp/bacula-restores select
73 unmark *
74 mark *
75 done
76 yes
77 mount storage=DDS-4
78 wait
79 messages
80 @output
81 quit
82 END_OF_DATA
83 scripts/check_for_zombie_jobs storage=DDS-4
84 bin/bacula stop 2>&1 >/dev/null
85 grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
86 bstat=$?
87 grep "^  Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
88 rstat=$?
89 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
90 dstat=$?
91 if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
92    echo " "
93    echo " "
94    echo "  !!!!! relabel-tape Bacula source failed!!! !!!!! "
95    echo "  !!!!! relabel-tape failed!!! !!!!! " >>test.out
96    echo "diff=$dstat backup=$bstat restore=$rstat"
97    echo " "
98 else
99    echo "  ===== relabel-tape Bacula source OK ===== "
100    echo "  ===== relabel-tape OK ===== " >>test.out
101    scripts/cleanup
102 fi