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