]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/backup-bacula-tape
Update tests
[bacula/bacula] / regress / tests / backup-bacula-tape
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory 
4 #   to a tape then restore it, we do that twice to ensure that
5 #   we can correctly append to a tape.
6 #
7 cwd=`pwd`
8 scripts/copy-tape-confs
9 scripts/cleanup-tape
10
11 echo "${cwd}/build" >/tmp/file-list
12
13 echo " "
14 echo " "
15 echo " === Starting Bacula tape test at `date +%R:%S` ==="
16 echo " === Starting Bacula tape test at `date +%R:%S` ===" >>working/log
17 echo " "
18
19 bin/bacula start 2>&1 >/dev/null
20 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
21 @output /dev/null
22 messages
23 @output tmp/log1.out
24 label storage=DDS-4 volume=TestVolume001 slot=0
25 purge volume=TestVolume001
26 relabel pool=Default storage=DDS-4 oldVolume=TestVolume001 volume=TestVolume002 slot=0
27 purge volume=TestVolume002
28 relabel pool=Default storage=DDS-4 oldVolume=TestVolume002 volume=TestVolume001 slot=0
29 run job=NightlySave yes
30 status storage=DDS-4
31 status storage=DDS-4
32 status storage=DDS-4
33 status storage=DDS-4
34 status storage=DDS-4
35 status storage=DDS-4
36 sleep 1
37 status storage=DDS-4
38 status storage=DDS-4
39 status storage=DDS-4
40 status storage=DDS-4
41 status storage=DDS-4
42 sleep 1
43 status storage=DDS-4
44 status storage=DDS-4
45 status storage=DDS-4
46 status storage=DDS-4
47 status storage=DDS-4
48 sleep 1
49 status storage=DDS-4
50 status storage=DDS-4
51 status storage=DDS-4
52 status storage=DDS-4
53 status storage=DDS-4
54 sleep 1
55 status storage=DDS-4
56 status storage=DDS-4
57 status storage=DDS-4
58 status storage=DDS-4
59 status storage=DDS-4
60 wait
61 messages
62 @# 
63 @# now do a restore
64 @#
65 @output tmp/log2.out
66 restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done
67 yes
68 wait
69 messages
70 END_OF_DATA
71 bin/bacula stop 2>&1 >/dev/null
72 #
73 # Now do a second backup after making a few changes
74 #
75 touch ${cwd}/build/src/dird/*.c
76 echo "test test" > ${cwd}/build/src/dird/xxx
77 bin/bacula start 2>&1 >/dev/null
78 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
79 @output /dev/null
80 messages
81 @output tmp/log1.out
82 run job=NightlySave yes
83 wait
84 messages
85 @# 
86 @# now do a second restore
87 @#
88 @output tmp/log2.out
89 restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done
90 yes
91 wait
92 messages
93 @output
94 quit
95 END_OF_DATA
96 scripts/check_for_zombie_jobs storage=DDS-4
97
98 bin/bacula stop 2>&1 >/dev/null
99 grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
100 bstat=$?
101 grep "^  Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
102 rstat=$?
103 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
104 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
105    echo " "
106    echo " "
107    echo "  !!!!! Bacula tape test Bacula source failed!!! !!!!! "
108    echo "  !!!!! Bacula tape test failed!!! !!!!! " >>test.out
109    echo " "
110 else
111    echo "  ===== Bacula tape test Bacula source OK ===== "
112    echo "  ===== Bacula tape test OK ===== " >>test.out
113    scripts/cleanup
114 fi