]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/bsr-opt-test
e4ca9a31575df86d3c6cd7326667feda805c45b9
[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 TestName="bsr-opt-test"
10 JobName=bsr-opt
11 . scripts/functions
12 set_debug 0
13
14 scripts/copy-test-confs
15 scripts/cleanup
16 echo "${cwd}/build" >/tmp/file-list
17
18 change_jobname $JobName
19
20 start_test
21
22 cat <<END_OF_DATA >tmp/bconcmds
23 @$out /dev/null
24 messages
25 @$out tmp/log1.out
26 label storage=File1 volume=TestVolume001
27 label storage=File1 volume=TestVolume002
28 update Volume=TestVolume001 MaxVolBytes=3000000
29 run job=$JobName storage=File1 yes
30 wait
31 messages
32 @# 
33 @# now do a restore
34 @#
35 @$out 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 @$out
46 quit
47 END_OF_DATA
48
49 run_bacula
50 check_for_zombie_jobs storage=File1
51 stop_bacula
52 #
53 # This test is not really reliable. What we want to do is
54 #   to select files on only one Volume, then insure here
55 #   that only one Volume is chosen.
56 #
57 grep TestVolume002 working/restore.bsr 2>&1 >/dev/null
58 bsrstat=$?
59 check_two_logs
60
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 `date +%R:%S` ===== "
80    echo "  ===== bsr-opt-test OK `date +%R:%S` ===== " >>test.out
81    scripts/cleanup
82 fi