]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/restore-by-file-tape
Update more tests
[bacula/bacula] / regress / tests / restore-by-file-tape
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory 
4 #   to a tape where the maximum tape file size is set to 1M
5 #   then restore a few files from it.  Note, by setting the maximum 
6 #   file size to 1M, it runs very slow. There are about 64 files that
7 #   are created during each of the two backups.
8 #
9 TestName="restore-by-file-tape"
10 JobName=restorebyfile
11 . scripts/functions
12 set_debug 0
13
14 scripts/copy-tape-confs
15 scripts/cleanup-tape
16 echo "${cwd}/build" >/tmp/file-list
17 sed s%\^%${cwd}% ${cwd}/scripts/flist >${cwd}/tmp/restore2-list
18
19 cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
20 sed "s%# Maximum File Size%  Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
21
22 change_jobname $JobName
23 start_test
24
25 cat <<END_OF_DATA >tmp/bconcmds
26 @output /dev/null
27 messages
28 @$out   tmp/log1.out
29 label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default
30 run job=$JobName level=Full yes
31 wait
32 messages
33 @# 
34 @# now do a restore
35 @#
36 @$out   tmp/log2.out
37 restore where=${cwd}/tmp/bacula-restores storage=DDS-4 file=<${cwd}/tmp/restore2-list
38 yes
39 wait
40 messages
41 @output
42 quit
43 END_OF_DATA
44
45 run_bacula
46 check_for_zombie_jobs storage=DDS-4
47 stop_bacula
48
49 check_two_logs
50
51 dstat=0
52 #
53 # We need to stop and start Bacula to
54 #  test appending to a previously written tape
55 #
56 for i in `cat ${cwd}/tmp/restore2-list`; do
57    diff $i ${cwd}/tmp/bacula-restores$i
58    if [ $? != 0 ] ; then
59       dstat=1
60    fi
61 done
62
63 end_test
64
65 cat <<END_OF_DATA >tmp/bconcmds
66 @output /dev/null
67 messages
68 @$out   tmp/log1.out
69 run job=$JobName  level=Full yes
70 wait
71 messages
72 @#
73 @# now do a restore
74 @#
75 @$out   tmp/log2.out
76 restore where=${cwd}/tmp/bacula-restores
77 7
78 <${cwd}/tmp/restore2-list
79                                                                                         
80 yes
81 wait
82 messages
83 @output
84 quit
85 END_OF_DATA
86
87 #
88 # Bacula was stopped, but we must restart it to
89 #  test appending to a previously written tape
90 #
91 run_bacula
92 check_for_zombie_jobs storage=DDS-4
93 stop_bacula
94
95 check_two_logs
96
97 scripts/check_for_zombie_jobs storage=DDS-4
98 bin/bacula stop 2>&1 >/dev/null
99 for i in `cat ${cwd}/tmp/restore2-list`; do
100    diff $i ${cwd}/tmp/bacula-restores$i
101    if [ $? != 0 ] ; then
102       dstat=1
103    fi
104 done
105 end_test