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