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