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