]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/bsr-opt-test
Setup for two drives
[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
14 echo " "
15 echo " "
16 echo " === Starting bsr-opt-test at `date +%R:%S` ==="
17 echo " === Starting bsr-opt-test at `date +%R:%S` ===" >working/log
18 echo " "
19
20 bin/bacula start 2>&1 >/dev/null
21 #bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
22 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
23 @tee /dev/null
24 messages
25 @tee tmp/log1.out
26 label storage=File1 volume=TestVolume001
27 label storage=File1 volume=TestVolume002
28 update Volume=TestVolume001 MaxVolBytes=3000000
29 run job=NightlySave storage=File1 yes
30 wait
31 messages
32 @# 
33 @# now do a restore
34 @#
35 @tee tmp/log2.out
36 restore bootstrap=${cwd}/working/restore.bsr where=${cwd}/tmp/bacula-restores select storage=File1
37 unmark *
38 cd ${cwd}/build/src/cats
39 mark *
40 ls
41 done
42 yes
43 wait
44 messages
45 @tee
46 quit
47 END_OF_DATA
48 scripts/check_for_zombie_jobs storage=File1
49 bin/bacula stop 2>&1 >/dev/null
50 #
51 # This test is not really reliable. What we want to do is
52 #   to select files on only one Volume, then insure here
53 #   that only one Volume is chosen.
54 #
55 grep TestVolume002 working/restore.bsr 2>&1 >/dev/null
56 bsrstat=$?
57 grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
58 bstat=$?
59 grep "^  Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
60 rstat=$?
61 diff -r build/src/cats  tmp/bacula-restores${cwd}/build/src/cats 2>&1 >/dev/null
62 if [ $? != 0 -o $bsrstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
63    echo " "
64    echo " "
65    echo "  !!!!! bsr-opt-test Bacula source failed!!! !!!!! "
66    echo "  !!!!! bsr-opt-test failed!!! !!!!! " >>test.out
67    if [ $bstat != 0 -o $rstat != 0 ] ; then
68       echo "  !!!!! Bad Job termination status     !!!!! "
69       echo "  !!!!! Bad Job termination status     !!!!! " >>test.out
70    elif [ $bsrstat != 0 ] ; then
71       echo "  !!!!! Volume selection error         !!!!! "
72       echo "  !!!!! Volume selection error         !!!!! " >>test.out
73    else
74       echo "  !!!!! Restored files differ          !!!!! "
75       echo "  !!!!! Restored files differ          !!!!! " >>test.out
76    fi
77    echo " "
78 else
79    echo "  ===== bsr-opt-test Bacula source OK ===== "
80    echo "  ===== bsr-opt-test OK ===== " >>test.out
81    scripts/cleanup
82 fi