]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/incremental-tape
Before done change
[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 scripts/check_for_zombie_jobs storage=DDS-4
44 echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt
45 echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt
46 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
47 @output /dev/null
48 messages
49 @output tmp/log1.out
50 run level=Incremental job=NightlySave yes
51 wait
52 messages
53 @# 
54 @# now do a restore
55 @#
56 @output tmp/log2.out
57 restore where=${cwd}/tmp/bacula-restores storage=DDS-4
58 7
59 <${cwd}/tmp/restore-list
60
61 yes
62 wait
63 messages
64 @output
65 quit
66 END_OF_DATA
67 scripts/check_for_zombie_jobs storage=DDS-4
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-tape test Bacula source failed!!! !!!!! "
82    echo "  !!!!! incremental-tape test failed!!! !!!!! " >>test.out
83    echo " "
84 else
85    echo "  ===== incremental-tape test Bacula source OK ===== "
86    echo "  ===== incremental-tape test OK ===== " >>test.out
87    scripts/cleanup
88 fi