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