]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/incremental-2tape
Add execute bit on errors-test
[bacula/bacula] / regress / tests / incremental-2tape
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory then create some           
4 #   new files, do an Incremental and restore those two files.
5 #
6 # This script uses the autochanger and two tapes
7 #
8 if test x${AUTOCHANGER} = x/dev/null ; then
9    echo "incremental-2tape test skipped. No autochanger."
10    exit
11 fi
12 debug=0
13 if test "$debug" -eq 1 ; then
14   out="tee"
15 else
16   out="output"
17 fi
18 cwd=`pwd`
19 bin/bacula stop  2>&1 >/dev/null
20 cd bin
21 ./drop_bacula_tables >/dev/null 2>&1
22 ./make_bacula_tables >/dev/null 2>&1
23 ./grant_bacula_privileges 2>&1 >/dev/null
24 cd ..
25
26 scripts/copy-2tape-confs
27 scripts/cleanup-2tape
28 echo "${cwd}/tmp/build" >/tmp/file-list
29 if test ! -d ${cwd}/tmp/build ; then
30    mkdir ${cwd}/tmp/build
31 fi
32 cp -p ${cwd}/build/src/dird/*.c ${cwd}/tmp/build
33 cd ${cwd}/tmp
34 echo "${cwd}/tmp/build/ficheriro1.txt" >restore-list
35 echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list
36 cd ${cwd}
37
38 echo " "
39 echo " "
40 echo " === Starting incremental-2tape test ==="
41 echo " === Starting incremental-2tape test ===" >>working/log
42 echo " "
43
44 # Write out bconsole commands
45 cat <<END_OF_DATA >tmp/bconcmds
46 @$out /dev/null
47 messages
48 @$out tmp/log1.out
49 label storage=DDS-4 volume=TestVolume001 slot=1 Pool=Default drive=0
50 label storage=DDS-4 volume=TestVolume002 slot=2 Pool=Default drive=0
51 run job=NightlySave yes
52 wait
53 messages
54 quit
55 END_OF_DATA
56
57 if test "$debug" -eq 1 ; then
58   bin/bacula start
59   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
60 else
61   bin/bacula start 2>&1 >/dev/null
62   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf  2>&1 >/dev/null
63 fi
64 echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt
65 echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt
66 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
67 @$out /dev/null
68 messages
69 @$out tmp/log1.out
70 @# Force Incremental on the second Volume
71 update volume=TestVolume001 VolStatus=Used
72 run level=Incremental job=NightlySave yes
73 wait
74 messages
75 @# 
76 @# now do a restore
77 @#
78 @$out tmp/log2.out
79 restore where=${cwd}/tmp/bacula-restores 
80 7
81 <${cwd}/tmp/restore-list
82
83 yes
84 wait
85 messages
86 @$out
87 quit
88 END_OF_DATA
89 bin/bacula stop 2>&1 >/dev/null
90 grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
91 bstat=$?
92 grep "^  Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
93 rstat=$?
94 #
95 # Delete .c files because we will only restored the txt files
96 #
97 rm -f tmp/build/*.c
98 diff -r tmp/build tmp/bacula-restores${cwd}/tmp/build 2>&1 >/dev/null
99 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
100    echo " "
101    echo " "
102    echo "  !!!!! incremental-2tape test Bacula source failed!!! !!!!! "
103    echo "  !!!!! incremental-2tape test failed!!! !!!!! " >>test.out
104    echo " "
105 else
106    echo "  ===== incremental-2tape test Bacula source OK ===== "
107    echo "  ===== incremental-2tape test OK ===== " >>test.out
108    scripts/cleanup
109 fi