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