]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/bsr-opt-test
Make FreeBSD config correctly for tapes
[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 bin/drop_sqlite_tables
15 bin/make_sqlite_tables
16
17 echo " "
18 echo " "
19 echo " === Starting bsr-opt-test  ==="
20 echo " === Starting bsr-opt-test  ===" >working/log
21 echo " "
22
23 bin/bacula start 2>&1 >/dev/null
24 bin/console -c bin/console.conf <<END_OF_DATA
25 @output /dev/null
26 messages
27 @output tmp/log1.out
28 label storage=File1 volume=TestVolume001
29 label storage=File1 volume=TestVolume002
30 update Volume=TestVolume001 MaxVolBytes=3000000
31 run job=NightlySave storage=File1 yes
32 wait
33 messages
34 @# 
35 @# now do a restore
36 @#
37 @output tmp/log2.out
38 restore where=${cwd}/tmp/bacula-restores select
39 unmark *
40 cd ${cwd}/build/src/cats
41 mark *
42 ls
43 done
44 yes
45 wait
46 messages
47 @output
48 quit
49 END_OF_DATA
50 bin/bacula stop 2>&1 >/dev/null
51 grep TestVolume001 working/restore.bsr
52 bsrstat=$?
53 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
54 bstat=$?
55 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
56 rstat=$?
57 diff -r build/src/cats  tmp/bacula-restores${cwd}/build/src/cats 2>&1 >/dev/null
58 if [ $? != 0 -o $bsrstat != 1 -o $bstat != 0 -o $rstat != 0 ] ; then
59    echo " "
60    echo " "
61    echo "  !!!!! bsr-opt-test Bacula source failed!!! !!!!! "
62    echo "  !!!!! bsr-opt-test failed!!! !!!!! " >>test.out
63    echo " "
64 else
65    echo "  ===== bsr-opt-test Bacula source OK ===== "
66    echo "  ===== bsr-opt-test OK ===== " >>test.out
67    scripts/cleanup
68 fi