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