]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/bsr-opt-test
regress: fix delete-test
[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
13 scripts/cleanup
14 scripts/copy-test-confs
15 echo "${cwd}/build" >${cwd}/tmp/file-list
16
17 change_jobname NightlySave $JobName
18 start_test
19
20 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
21 @$out /dev/null
22 messages
23 @$out ${cwd}/tmp/log1.out
24 label storage=File1 volume=TestVolume001
25 label storage=File1 volume=TestVolume002
26 update Volume=TestVolume001 MaxVolBytes=3000000
27 run job=$JobName storage=File1 yes
28 wait
29 messages
30 @# 
31 @# now do a restore
32 @#
33 @$out ${cwd}/tmp/log2.out
34 setdebug level=150 storage=File1
35 restore bootstrap=${cwd}/working/restore.bsr 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 quit
45 END_OF_DATA
46
47 run_bacula
48 check_for_zombie_jobs storage=File1
49 stop_bacula
50 #
51 # This test is not really reliable. What we want to do is
52 #   to select files on only one Volume, then insure here
53 #   that only one Volume is chosen.
54 #
55 grep TestVolume002 working/restore.bsr 2>&1 >/dev/null
56 bsrstat=$?
57 check_two_logs
58
59 diff -r build/src/cats  ${cwd}/tmp/bacula-restores${cwd}/build/src/cats 2>&1 >/dev/null
60 if [ $? != 0 -o $bsrstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
61    echo " "
62    echo " "
63    echo "  !!!!! bsr-opt-test Bacula source failed!!! !!!!! "
64    echo "  !!!!! bsr-opt-test failed!!! !!!!! " >>test.out
65    if [ $bstat != 0 -o $rstat != 0 ] ; then
66       echo "  !!!!! Bad Job termination status     !!!!! "
67       echo "  !!!!! Bad Job termination status     !!!!! " >>test.out
68    elif [ $bsrstat != 0 ] ; then
69       echo "  !!!!! Volume selection error         !!!!! "
70       echo "  !!!!! Volume selection error         !!!!! " >>test.out
71    else
72       echo "  !!!!! Restored files differ          !!!!! "
73       echo "  !!!!! Restored files differ          !!!!! " >>test.out
74    fi
75    echo " "
76    exit 1
77 else
78    echo "  ===== bsr-opt-test Bacula source OK `date +%R:%S` ===== "
79    echo "  ===== bsr-opt-test OK `date +%R:%S` ===== " >>test.out
80    scripts/cleanup
81 fi