]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/restore-disk-seek-test
Tweak cleaner output in accurate-test
[bacula/bacula] / regress / tests / restore-disk-seek-test
1 #!/bin/sh
2 #
3 # Run a backup of the full bacula build directory, but with the
4 #   Maximum File Size set. Then do a restore of a few files to kick in
5 #   disk seeking (not yet enabled), and ensure that the restored files
6 #   match. Even though disk seeking is not yet enabled, this is a good test,
7 #   and once it is enabled, this will test it.
8 #
9 TestName="restore-disk-seek-test"
10 JobName=restore-disk-seek
11 . scripts/functions
12
13 scripts/cleanup
14 scripts/copy-test-confs
15 echo "${cwd}/tmp/build" >${cwd}/tmp/file-list
16 rm -rf ${cwd}/tmp/build
17 mkdir -p ${cwd}/tmp/build
18 # Copy only the .c files (to be restored)
19 #  set files to "*.c" for all c files
20 files="ua_tree.c ua_update.c"
21 #  files="*.c"
22 for i in ${files}; do
23    cp -p ${cwd}/build/src/dird/${i} ${cwd}/tmp/build
24 done
25 cd ${cwd}/tmp/build
26 ls >../1
27 cd ..
28 sed s%\^%${cwd}/tmp/build/% 1 | sort | uniq >restore-list
29 #
30 # At this point restore-list contains the list
31 #  of files we will restore
32 #
33 rm -f 1
34 cd ${cwd}
35 #
36 # Now arrange to backup *everything* 
37 #
38 rm -rf  ${cwd}/tmp/build
39 mkdir -p ${cwd}/tmp/build
40 cp -fp ${cwd}/build/src/dird/* ${cwd}/tmp/build
41 #
42 # Enable MaximumFileSize to ensure lots of JobMedia records and thus
43 #  lots of seeking
44 #
45 cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
46 sed "s%# Maximum File Size%  Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
47
48 change_jobname CompressedTest $JobName
49 start_test
50
51 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
52 @$out /dev/null
53 messages
54 @$out ${cwd}/tmp/log1.out
55 label storage=File volume=TestVolume001
56 run job=$JobName yes
57 wait
58 messages
59 @# 
60 @# now do a restore
61 @#
62 @$out ${cwd}/tmp/log2.out
63 setdebug level=30 fd     
64 setdebug level=11 storage=File
65 sql
66 @# print the JobMedia records
67 select * from JobMedia;
68
69 restore bootstrap=${cwd}/tmp/kern.bsr where=${cwd}/tmp/bacula-restores storage=File
70 7
71 <${cwd}/tmp/restore-list
72
73 yes
74 wait
75 messages
76 quit
77 END_OF_DATA
78
79 run_bacula
80 check_for_zombie_jobs storage=File
81 stop_bacula
82
83 # Now setup a control directory of only what we *should* restore
84 rm -rf ${cwd}/tmp/build
85 mkdir -p  ${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