]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/bsr-opt-test
Make out of freespace non-fatal for removable devices -- i.e. behaves like tape
[bacula/bacula] / regress / tests / bsr-opt-test
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6
7 #
8 # Run a simple backup of the Bacula build directory but 
9 #   split the archive into two volumes, then restore
10 #   files on only one of the volumes and ensure that
11 #   the other volume is not used.  I.e. bsr optimization
12 #   works.
13 #
14 TestName="bsr-opt-test"
15 JobName=bsr-opt
16 . scripts/functions
17
18 scripts/cleanup
19 scripts/copy-test-confs
20 echo "${cwd}/build" >${cwd}/tmp/file-list
21
22 change_jobname NightlySave $JobName
23 start_test
24
25 MaxVolBytes=3000000
26 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
27 @$out /dev/null
28 messages
29 @$out ${cwd}/tmp/log1.out
30 label storage=File1 volume=TestVolume001
31 label storage=File1 volume=TestVolume002
32 update Volume=TestVolume001 MaxVolBytes=$MaxVolBytes
33 run job=$JobName storage=File1 yes
34 wait
35 messages
36 @# 
37 @# now do a restore
38 @#
39 @$out ${cwd}/tmp/log2.out
40 setdebug level=150 storage=File1 trace=1
41 restore bootstrap=${cwd}/working/restore.bsr where=${cwd}/tmp/bacula-restores select storage=File1
42 unmark *
43 cd ${cwd}/build/src/cats
44 mark *
45 ls
46 done
47 yes
48 wait
49 messages
50 quit
51 END_OF_DATA
52
53 run_bacula
54 check_for_zombie_jobs storage=File1
55 stop_bacula
56 #
57 # This test is not really reliable. What we want to do is
58 #   to select files on only one Volume, then insure here
59 #   that only one Volume is chosen.
60 #
61 grep TestVolume002 working/restore.bsr 2>&1 >/dev/null
62 bsrstat=$?
63 check_two_logs
64
65 diff -r build/src/cats  ${cwd}/tmp/bacula-restores${cwd}/build/src/cats 2>&1 >/dev/null
66 if [ $? != 0 -o $bsrstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
67    echo " "
68    echo " "
69    echo "  !!!!! bsr-opt-test Bacula source failed!!! !!!!! "
70    echo "  !!!!! bsr-opt-test failed!!! !!!!! " >>test.out
71    if [ $bstat != 0 -o $rstat != 0 ] ; then
72       echo "  !!!!! Bad Job termination status     !!!!! "
73       echo "  !!!!! Bad Job termination status     !!!!! " >>test.out
74    elif [ $bsrstat != 0 ] ; then
75       echo "  !!!!! Volume selection error         !!!!! "
76       echo "  !!!!! Volume selection error         !!!!! " >>test.out
77    else
78       echo "  !!!!! Restored files differ          !!!!! "
79       echo "  !!!!! Restored files differ          !!!!! " >>test.out
80    fi
81    echo " "
82    exit 1
83 else
84    echo "  ===== bsr-opt-test Bacula source OK `date +%R:%S` ===== "
85    echo "  ===== bsr-opt-test OK `date +%R:%S` ===== " >>test.out
86    scripts/cleanup
87 fi