]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/restore-by-file-tape
Updates
[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 copy_tape_confs
14
15 echo "${cwd}/build" >/tmp/file-list
16 sed s%\^%${cwd}% ${cwd}/scripts/flist >${cwd}/tmp/restore2-list
17
18 cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
19 sed "s%# Maximum File Size%  Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
20
21 change_jobname NightlySave $JobName
22 start_test
23
24 cat <<END_OF_DATA >tmp/bconcmds
25 @output /dev/null
26 messages
27 @$out   tmp/log1.out
28 label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default
29 run job=$JobName level=Full yes
30 wait
31 messages
32 @# 
33 @# now do a restore
34 @#
35 @$out   tmp/log2.out
36 restore where=${cwd}/tmp/bacula-restores storage=DDS-4 file=<${cwd}/tmp/restore2-list
37 yes
38 wait
39 messages
40 @output
41 quit
42 END_OF_DATA
43
44 run_bacula
45 check_for_zombie_jobs storage=DDS-4
46 stop_bacula
47
48 dstat=0
49 #
50 # We need to stop and start Bacula to
51 #  test appending to a previously written tape
52 #
53 for i in `cat ${cwd}/tmp/restore2-list`; do
54    diff $i ${cwd}/tmp/bacula-restores$i
55    if [ $? != 0 ] ; then
56       dstat=1
57    fi
58 done
59
60 cat <<END_OF_DATA >tmp/bconcmds
61 @output /dev/null
62 messages
63 @$out   tmp/log1.out
64 run job=$JobName  level=Full yes
65 wait
66 messages
67 @#
68 @# now do a restore
69 @#
70 @$out   tmp/log2.out
71 restore where=${cwd}/tmp/bacula-restores
72 7
73 <${cwd}/tmp/restore2-list
74                                                                                         
75 yes
76 wait
77 messages
78 @output
79 quit
80 END_OF_DATA
81
82 #
83 # Bacula was stopped, but we must restart it to
84 #  test appending to a previously written tape
85 #
86 run_bacula
87 check_for_zombie_jobs storage=DDS-4
88 stop_bacula
89
90 check_two_logs
91
92 scripts/check_for_zombie_jobs storage=DDS-4
93 bin/bacula stop 2>&1 >/dev/null
94 for i in `cat ${cwd}/tmp/restore2-list`; do
95    diff $i ${cwd}/tmp/bacula-restores$i
96    if [ $? != 0 ] ; then
97       dstat=1
98    fi
99 done
100
101 end_test