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