]> git.sur5r.net Git - bacula/bacula/blobdiff - regress/tests/restore-seek-tape
regress: add function to create many dirs
[bacula/bacula] / regress / tests / restore-seek-tape
index 72c81b8f8f4f25c42d311677852b11611cd70b73..53bf6de6d236d2dfc75067b27f000963957971fc 100755 (executable)
@@ -10,10 +10,14 @@ TestName="restore-seek-tape"
 JobName=restore-tape-seek
 . scripts/functions
 
-copy_tape_confs
-echo "${cwd}/tmp/build" >/tmp/file-list
+require_tape_drive
+
+scripts/copy-tape-confs
+scripts/cleanup-tape
+
+echo "${cwd}/tmp/build" >${cwd}/tmp/file-list
 rm -rf ${cwd}/tmp/build
-mkdir ${cwd}/tmp/build
+mkdir -p ${cwd}/tmp/build
 # Copy only the .c files (to be restored)
 #  set files to "*.c" for all c files
 files="ua_tree.c ua_update.c"
@@ -24,7 +28,7 @@ done
 cd ${cwd}/tmp/build
 ls >../1
 cd ..
-sed s%\^%${cwd}/tmp/build/% 1 >restore-list
+sed s%\^%${cwd}/tmp/build/% 1 | sort | uniq >restore-list
 #
 # At this point restore-list contains the list
 #  of files we will restore
@@ -35,7 +39,7 @@ cd ${cwd}
 # Now arrange to backup *everything*
 #
 rm -rf  ${cwd}/tmp/build
-mkdir ${cwd}/tmp/build
+mkdir -p ${cwd}/tmp/build
 cp -fp ${cwd}/build/src/dird/* ${cwd}/tmp/build
 #
 # Enable MaximumFileSize to ensure lots of JobMedia records and thus
@@ -47,42 +51,41 @@ sed "s%# Maximum File Size = 1000000%  Maximum File Size = 10KB%" ${cwd}/tmp/1 >
 change_jobname NightlySave $JobName
 start_test
 
-cat <<END_OF_DATA >tmp/bconcmds
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
 @$out /dev/null
 messages
-@$out tmp/log1.out
-label storage=DDS-4 volume=TestVolume001 pool=Default
+@$out ${cwd}/tmp/log1.out
+label storage=tape volume=TestVolume001 pool=Default
 run job=$JobName yes
 wait
 messages
 @#
 @# now do a restore
 @#
-@$out tmp/log2.out
+@$out ${cwd}/tmp/log2.out
 setdebug level=30 fd
-setdebug level=10 storage=DDS-4
+setdebug level=10 storage=tape
 sql
 @# print the JobMedia records
 select * from JobMedia;
 
-restore bootstrap=${cwd}/tmp/kern.bsr where=${cwd}/tmp/bacula-restores storage=DDS-4
+restore bootstrap=${cwd}/tmp/kern.bsr where=${cwd}/tmp/bacula-restores storage=tape
 7
 <${cwd}/tmp/restore-list
 
 yes
 wait
 messages
-@$out
 quit
 END_OF_DATA
 
 run_bacula
-check_for_zombie_jobs storage=DDS-4
+check_for_zombie_jobs storage=tape
 stop_bacula
 
 # Now setup a control directory of only what we *should* restore
 rm -rf ${cwd}/tmp/build
-mkdir  ${cwd}/tmp/build
+mkdir -p  ${cwd}/tmp/build
 for i in ${files}; do
    cp -p ${cwd}/build/src/dird/${i} ${cwd}/tmp/build
 done