]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/bsr-opt-test
Add new tape 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/bconsole -c bin/bconsole.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 #
52 # This test is not really reliable. What we want to do is
53 #   to select files on only one Volume, then insure here
54 #   that only one Volume is chosen.
55 #
56 grep TestVolume002 working/restore.bsr 2>&1 >/dev/null
57 bsrstat=$?
58 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
59 bstat=$?
60 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
61 rstat=$?
62 diff -r build/src/cats  tmp/bacula-restores${cwd}/build/src/cats 2>&1 >/dev/null
63 if [ $? != 0 -o $bsrstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
64    echo " "
65    echo " "
66    echo "  !!!!! bsr-opt-test Bacula source failed!!! !!!!! "
67    echo "  !!!!! bsr-opt-test failed!!! !!!!! " >>test.out
68    echo " "
69 else
70    echo "  ===== bsr-opt-test Bacula source OK ===== "
71    echo "  ===== bsr-opt-test OK ===== " >>test.out
72    scripts/cleanup
73 fi