]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/bsr-opt-test
Flush changes
[bacula/bacula] / regress / tests / bsr-opt-test
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory but 
4 #   split the archive into two volumes, then restore
5 #   files on only one of the volumes and ensure that
6 #   the other volume is not used.  I.e. bsr optimization
7 #   works.
8 #
9 cwd=`pwd`
10 scripts/copy-test-confs
11 scripts/cleanup
12 echo "${cwd}/build" >/tmp/file-list
13 bin/bacula stop 2>&1 >/dev/null
14 cd bin
15 ./drop_bacula_tables >/dev/null 2>&1
16 ./make_bacula_tables >/dev/null 2>&1
17 ./grant_bacula_privileges 2>&1 >/dev/null
18 cd ..
19
20 echo " "
21 echo " "
22 echo " === Starting bsr-opt-test  ==="
23 echo " === Starting bsr-opt-test  ===" >working/log
24 echo " "
25
26 bin/bacula start 2>&1 >/dev/null
27 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
28 @output /dev/null
29 messages
30 @output tmp/log1.out
31 label storage=File1 volume=TestVolume001
32 label storage=File1 volume=TestVolume002
33 update Volume=TestVolume001 MaxVolBytes=3000000
34 run job=NightlySave storage=File1 yes
35 wait
36 messages
37 @# 
38 @# now do a restore
39 @#
40 @output tmp/log2.out
41 restore where=${cwd}/tmp/bacula-restores select storage=File1
42 unmark *
43 cd ${cwd}/build/src/cats
44 mark *
45 ls
46 done
47 yes
48 wait
49 messages
50 @output
51 quit
52 END_OF_DATA
53 scripts/check_for_zombie_jobs storage=File1
54 bin/bacula stop 2>&1 >/dev/null
55 #
56 # This test is not really reliable. What we want to do is
57 #   to select files on only one Volume, then insure here
58 #   that only one Volume is chosen.
59 #
60 grep TestVolume002 working/restore.bsr 2>&1 >/dev/null
61 bsrstat=$?
62 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
63 bstat=$?
64 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
65 rstat=$?
66 diff -r build/src/cats  tmp/bacula-restores${cwd}/build/src/cats 2>&1 >/dev/null
67 if [ $? != 0 -o $bsrstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
68    echo " "
69    echo " "
70    echo "  !!!!! bsr-opt-test Bacula source failed!!! !!!!! "
71    echo "  !!!!! bsr-opt-test failed!!! !!!!! " >>test.out
72    echo " "
73 else
74    echo "  ===== bsr-opt-test Bacula source OK ===== "
75    echo "  ===== bsr-opt-test OK ===== " >>test.out
76    scripts/cleanup
77 fi