]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/restore-seek-tape
Update new debugging method
[bacula/bacula] / regress / tests / restore-seek-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. This tests the
7 #   seeking capability
8 #
9 TestName="restore-seek-tape"
10 JobName=restore-tape-seek
11 . scripts/functions
12
13 copy_tape_confs
14 echo "${cwd}/tmp/build" >/tmp/file-list
15 rm -rf ${cwd}/tmp/build
16 mkdir ${cwd}/tmp/build
17 # Copy only the .c files (to be restored)
18 #  set files to "*.c" for all c files
19 files="ua_tree.c ua_update.c"
20 # files="*.c"
21 for i in ${files}; do
22    cp -p ${cwd}/build/src/dird/${i} ${cwd}/tmp/build
23 done
24 cd ${cwd}/tmp/build
25 ls >../1
26 cd ..
27 sed s%\^%${cwd}/tmp/build/% 1 >restore-list
28 #
29 # At this point restore-list contains the list
30 #  of files we will restore
31 #
32 rm -f 1
33 cd ${cwd}
34 #
35 # Now arrange to backup *everything*
36 #
37 rm -rf  ${cwd}/tmp/build
38 mkdir ${cwd}/tmp/build
39 cp -fp ${cwd}/build/src/dird/* ${cwd}/tmp/build
40 #
41 # Enable MaximumFileSize to ensure lots of JobMedia records and thus
42 #  lots of seeking
43 #
44 cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
45 sed "s%# Maximum File Size = 1000000%  Maximum File Size = 10KB%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
46
47 change_jobname NightlySave $JobName
48 start_test
49
50 cat <<END_OF_DATA >tmp/bconcmds
51 @$out /dev/null
52 messages
53 @$out tmp/log1.out
54 label storage=DDS-4 volume=TestVolume001 pool=Default
55 run job=$JobName yes
56 wait
57 messages
58 @#
59 @# now do a restore
60 @#
61 @$out tmp/log2.out
62 setdebug level=30 fd
63 setdebug level=10 storage=DDS-4
64 sql
65 @# print the JobMedia records
66 select * from JobMedia;
67
68 restore bootstrap=${cwd}/tmp/kern.bsr where=${cwd}/tmp/bacula-restores storage=DDS-4
69 7
70 <${cwd}/tmp/restore-list
71
72 yes
73 wait
74 messages
75 @$out
76 quit
77 END_OF_DATA
78
79 run_bacula
80 check_for_zombie_jobs storage=DDS-4
81 stop_bacula
82
83 # Now setup a control directory of only what we *should* restore
84 rm -rf ${cwd}/tmp/build
85 mkdir  ${cwd}/tmp/build
86 for i in ${files}; do
87    cp -p ${cwd}/build/src/dird/${i} ${cwd}/tmp/build
88 done
89
90 check_two_logs
91 check_restore_tmp_build_diff
92 end_test