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