]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/bsr-opt-test
Update a couple of tests
[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
29 TestVolume001
30 label storage=File1
31 TestVolume002
32 update Volume=TestVolume001
33 6
34 3000000
35 10
36 run job=NightlySave storage=File1
37 yes
38 wait
39 messages
40 @# 
41 @# now do a restore
42 @#
43 @output tmp/log2.out
44 restore where=${cwd}/tmp/bacula-restores current
45 unmark *
46 cd ${cwd}/build/src/cats
47 mark *
48 ls
49 done
50 yes
51 wait
52 messages
53 @output
54 quit
55 END_OF_DATA
56 bin/bacula stop 2>&1 >/dev/null
57 grep TestVolume001 working/restore.bsr
58 bsrstat=$?
59 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
60 bstat=$?
61 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
62 rstat=$?
63 diff -r build/src/cats  tmp/bacula-restores${cwd}/build/src/cats
64 if [ $? != 0 -o $bsrstat != 1 -o $bstat != 0 -o $rstat != 0 ] ; then
65    echo " "
66    echo " "
67    echo "  !!!!! bsr-opt-test Bacula source failed!!! !!!!! "
68    echo "  !!!!! bsr-opt-test failed!!! !!!!! " >>test.out
69    echo " "
70 else
71    echo "  ===== bsr-opt-test Bacula source OK ===== "
72    echo "  ===== bsr-opt-test OK ===== " >>test.out
73    scripts/cleanup
74 fi