]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/decremental-test
Before done change
[bacula/bacula] / regress / tests / decremental-test
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory then create some           
4 #   new files, do a Decremental and restore those two files.
5 #
6 cwd=`pwd`
7 scripts/copy-test-confs
8 scripts/cleanup
9 echo "${cwd}/tmp/build" >/tmp/file-list
10 mkdir ${cwd}/tmp/build
11 cp -p ${cwd}/build/src/dird/*.c ${cwd}/tmp/build
12 cd ${cwd}/tmp
13 echo "${cwd}/tmp/build/ficheriro1.txt" >restore-list
14 echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list
15 cd ${cwd}
16 bin/bacula stop  2>&1 >/dev/null
17 cd bin
18 ./drop_bacula_tables >/dev/null 2>&1
19 ./make_bacula_tables >/dev/null 2>&1
20 ./grant_bacula_privileges 2>&1 >/dev/null
21 cd ..
22
23 echo " "
24 echo " "
25 echo " === Starting decremental-test ==="
26 echo " === Starting decremental-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=File volume=TestVolume001
35 label storage=File volume=TestVolume002
36 run job=CompressedTest yes
37 wait
38 messages
39 quit
40 END_OF_DATA
41 scripts/check_for_zombie_jobs storage=File
42 echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt
43 echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt
44 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
45 @output /dev/null
46 messages
47 @output tmp/log1.out
48 @# Force decremental on the second Volume
49 update volume=TestVolume001 VolStatus=Used
50 run level=decremental job=CompressedTest yes
51 wait
52 messages
53 @output
54 END_OF_DATA
55 scripts/check_for_zombie_jobs storage=File
56 echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt
57 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
58 @output /dev/null
59 messages
60 @output tmp/log1.out
61 run level=incremental job=CompressedTest yes
62 wait
63 messages
64 @# 
65 @# now do a restore
66 @#
67 @output tmp/log2.out
68 restore where=${cwd}/tmp/bacula-restores storage=File file=<${cwd}/tmp/restore-list
69 yes
70 wait
71 messages
72 @output
73 quit
74 END_OF_DATA
75 scripts/check_for_zombie_jobs storage=File
76 bin/bacula stop 2>&1 >/dev/null
77 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
78 bstat=$?
79 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
80 rstat=$?
81 #
82 # Delete .c files because we will only restored the txt files
83 #
84 rm -f tmp/build/*.c
85 diff -r tmp/build tmp/bacula-restores${cwd}/tmp/build 2>&1 >/dev/null
86 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
87    echo " "
88    echo " "
89    echo "  !!!!! decremental-test Bacula source failed!!! !!!!! "
90    echo "  !!!!! decremental-test failed!!! !!!!! " >>test.out
91    echo " "
92 else
93    echo "  ===== decremental-test Bacula source OK ===== "
94    echo "  ===== decremental-test OK ===== " >>test.out
95    scripts/cleanup
96 fi