]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/restore-disk-seek-test
Begin simplification and cleanup of tests using shell functions
[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 cwd=`pwd`
15 scripts/copy-test-confs
16 scripts/cleanup
17 echo "${cwd}/tmp/build" >/tmp/file-list
18 rm -rf ${cwd}/tmp/build
19 mkdir ${cwd}/tmp/build
20 # Copy only the .c files (to be restored)
21 cp -p ${cwd}/build/src/dird/*.c ${cwd}/tmp/build
22 cd ${cwd}/tmp/build
23 ls >../1
24 cd ..
25 sed s%\^%${cwd}/tmp/build/% 1 >restore-list
26 # At this point restore-list contains the list
27 #  of files we will restore
28 rm -f 1
29 cd ${cwd}
30 # Now backup *everything* 
31 rm -rf  ${cwd}/tmp/build
32 mkdir ${cwd}/tmp/build
33 cp -fp ${cwd}/build/src/dird/* ${cwd}/tmp/build
34 # Enable MaximumFileSize
35 cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
36 sed "s%# Maximum File Size%  Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
37
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=CompressedTest 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