]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/restore-disk-seek-test
Update
[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 set_debug 0
13
14 scripts/cleanup
15 scripts/copy-test-confs
16 echo "${cwd}/tmp/build" >/tmp/file-list
17 rm -rf ${cwd}/tmp/build
18 mkdir ${cwd}/tmp/build
19 # Copy only the .c files (to be restored)
20 cp -p ${cwd}/build/src/dird/*.c ${cwd}/tmp/build
21 cd ${cwd}/tmp/build
22 ls >../1
23 cd ..
24 sed s%\^%${cwd}/tmp/build/% 1 >restore-list
25 # At this point restore-list contains the list
26 #  of files we will restore
27 rm -f 1
28 cd ${cwd}
29 # Now backup *everything* 
30 rm -rf  ${cwd}/tmp/build
31 mkdir ${cwd}/tmp/build
32 cp -fp ${cwd}/build/src/dird/* ${cwd}/tmp/build
33 # Enable MaximumFileSize
34 cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
35 sed "s%# Maximum File Size%  Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
36
37 change_jobname CompressedTest $JobName
38 start_test
39
40 cat <<END_OF_DATA >tmp/bconcmds
41 @$out /dev/null
42 messages
43 @$out tmp/log1.out
44 label storage=File volume=TestVolume001
45 run job=$JobName yes
46 wait
47 messages
48 @# 
49 @# now do a restore
50 @#
51 @$out tmp/log2.out
52 sql
53 select * from JobMedia;
54
55 restore bootstrap=${cwd}/tmp/kern.bsr where=${cwd}/tmp/bacula-restores storage=File
56 7
57 <${cwd}/tmp/restore-list
58
59 yes
60 wait
61 messages
62 @$out
63 quit
64 END_OF_DATA
65
66 run_bacula
67 check_for_zombie_jobs storage=File
68 stop_bacula
69
70 # Now setup a control directory of only what we *should* restore
71 rm -rf ${cwd}/tmp/build
72 mkdir  ${cwd}/tmp/build
73 cp -p ${cwd}/build/src/dird/*.c ${cwd}/tmp/build
74
75 check_two_logs
76 check_restore_tmp_build_diff
77 end_test