3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
8 # Run a simple backup of the Bacula build directory
9 # to a tape where the maximum tape file size is set to 1M
10 # then restore a few files from it. Note, by setting the maximum
11 # file size to 1M, it runs very slow. There are about 64 files that
12 # are created during each of the two backups.
14 TestName="restore-by-file-tape"
20 scripts/copy-tape-confs
23 echo "${cwd}/build" >${cwd}/tmp/file-list
24 sed s%\^%${cwd}% ${cwd}/scripts/flist | sort | uniq >${cwd}/tmp/restore2-list
26 cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
27 sed "s%# Maximum File Size% Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
29 change_jobname NightlySave $JobName
32 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
35 @$out ${cwd}/tmp/log1.out
36 label storage=tape volume=TestVolume001 slot=0 pool=Default
37 run job=$JobName level=Full yes
43 @$out ${cwd}/tmp/log2.out
44 restore where=${cwd}/tmp/bacula-restores storage=tape file=<${cwd}/tmp/restore2-list
52 check_for_zombie_jobs storage=tape
57 # We need to stop and start Bacula to
58 # test appending to a previously written tape
60 for i in `cat ${cwd}/tmp/restore2-list`; do
61 diff $i ${cwd}/tmp/bacula-restores$i
67 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
70 @$out ${cwd}/tmp/log1.out
71 run job=$JobName level=Full yes
77 @$out ${cwd}/tmp/log2.out
78 restore where=${cwd}/tmp/bacula-restores
80 <${cwd}/tmp/restore2-list
89 # Bacula was stopped, but we must restart it to
90 # test appending to a previously written tape
93 check_for_zombie_jobs storage=tape
98 scripts/check_for_zombie_jobs storage=tape
100 for i in `cat ${cwd}/tmp/restore2-list`; do
101 diff $i ${cwd}/tmp/bacula-restores$i
102 if [ $? != 0 ] ; then