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