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