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