]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/restore-disk-seek-test
fda085da7f86d5dd0fb698c2e826ca8033ed17e1
[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 cwd=`pwd`
10 scripts/copy-test-confs
11 scripts/cleanup
12 echo "${cwd}/tmp/build" >/tmp/file-list
13 rm -rf ${cwd}/tmp/build
14 mkdir ${cwd}/tmp/build
15 # Copy only the .c files (to be restored)
16 cp -p ${cwd}/build/src/dird/*.c ${cwd}/tmp/build
17 cd ${cwd}/tmp/build
18 ls >../1
19 cd ..
20 sed s%\^%${cwd}/tmp/build/% 1 >restore-list
21 # At this point restore-list contains the list
22 #  of files we will restore
23 rm -f 1
24 cd ${cwd}
25 # Now backup *everything* 
26 rm -rf  ${cwd}/tmp/build
27 mkdir ${cwd}/tmp/build
28 cp -fp ${cwd}/build/src/dird/* ${cwd}/tmp/build
29 # Enable MaximumFileSize
30 cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
31 sed "s%# Maximum File Size%  Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
32
33 echo " "
34 echo " "
35 echo " === Starting restore-disk-seek-test at `date +%R:%S` ==="
36 echo " === Starting restore-disk-seek-test at `date +%R:%S` ===" >>working/log
37 echo " "
38
39 bin/bacula start -v -v 2>&1 >/dev/null
40 #bin/bacula start -v -v 
41 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
42 #bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
43 @output /dev/null
44 messages
45 @output tmp/log1.out
46 label storage=File volume=TestVolume001
47 run job=CompressedTest yes
48 wait
49 messages
50 @# 
51 @# now do a restore
52 @#
53 @output tmp/log2.out
54 sql
55 select * from JobMedia;
56
57 restore bootstrap=${cwd}/tmp/kern.bsr where=${cwd}/tmp/bacula-restores storage=File
58 7
59 <${cwd}/tmp/restore-list
60
61 yes
62 wait
63 messages
64 @output
65 quit
66 END_OF_DATA
67 scripts/check_for_zombie_jobs storage=File
68 bin/bacula stop 2>&1 >/dev/null
69 # Now setup a control directory of only what we *should* restore
70 rm -rf ${cwd}/tmp/build
71 mkdir  ${cwd}/tmp/build
72 cp -p ${cwd}/build/src/dird/*.c ${cwd}/tmp/build
73 grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
74 bstat=$?
75 grep "^  Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
76 rstat=$?
77 diff -r tmp/build tmp/bacula-restores${cwd}/tmp/build 2>&1 >/dev/null
78 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
79    echo " "
80    echo " "
81    echo "  !!!!! restore-disk-seek-test Bacula source failed!!! !!!!! "
82    echo "  !!!!! restore-disk-seek-test failed!!! !!!!! " >>test.out
83    if [ $bstat != 0 -o $rstat != 0 ] ; then
84       echo "  !!!!! Bad Job termination status     !!!!! "
85       echo "  !!!!! Bad Job termination status     !!!!! " >>test.out
86    else
87       echo "  !!!!! Restored files differ          !!!!! "
88       echo "  !!!!! Restored files differ          !!!!! " >>test.out
89    fi
90    echo " "
91 else
92    echo "  ===== restore-disk-seek-test Bacula source OK ===== "
93    echo "  ===== restore-disk-seek-test OK ===== " >>test.out
94 #  scripts/cleanup
95 #  rm -rf ${cwd}/tmp/build
96 fi