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. This tests the
14 TestName="restore-seek-tape"
15 JobName=restore-tape-seek
20 scripts/copy-tape-confs
23 echo "${cwd}/tmp/build" >${cwd}/tmp/file-list
24 rm -rf ${cwd}/tmp/build
25 mkdir -p ${cwd}/tmp/build
26 # Copy only the .c files (to be restored)
27 # set files to "*.c" for all c files
28 files="ua_tree.c ua_update.c"
31 cp -p ${cwd}/build/src/dird/${i} ${cwd}/tmp/build
36 sed s%\^%${cwd}/tmp/build/% 1 | sort | uniq >restore-list
38 # At this point restore-list contains the list
39 # of files we will restore
44 # Now arrange to backup *everything*
46 rm -rf ${cwd}/tmp/build
47 mkdir -p ${cwd}/tmp/build
48 cp -fp ${cwd}/build/src/dird/* ${cwd}/tmp/build
50 # Enable MaximumFileSize to ensure lots of JobMedia records and thus
53 cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
54 sed "s%# Maximum File Size = 1000000% Maximum File Size = 10KB%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
56 change_jobname NightlySave $JobName
59 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
62 @$out ${cwd}/tmp/log1.out
63 label storage=tape volume=TestVolume001 pool=Default
70 @$out ${cwd}/tmp/log2.out
72 setdebug level=10 storage=tape
74 @# print the JobMedia records
75 select * from JobMedia;
77 restore bootstrap=${cwd}/tmp/kern.bsr where=${cwd}/tmp/bacula-restores storage=tape
79 <${cwd}/tmp/restore-list
88 check_for_zombie_jobs storage=tape
91 # Now setup a control directory of only what we *should* restore
92 rm -rf ${cwd}/tmp/build
93 mkdir -p ${cwd}/tmp/build
95 cp -p ${cwd}/build/src/dird/${i} ${cwd}/tmp/build
99 check_restore_tmp_build_diff