]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/incremental-test
Add changes
[bacula/bacula] / regress / tests / incremental-test
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 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 incremental-test at `date +%R:%S` ==="
20 echo " === Starting incremental-test at `date +%R:%S` ===" >>working/log
21 echo " "
22
23 bin/bacula start 2>&1 >/dev/null
24 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
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 #
37 # Now create two new files to be restored later
38 #
39 sleep 1
40 echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt
41 cp -f ${cwd}/tmp/build/dird.c ${cwd}/tmp/build/ficheriro2.txt
42 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
43 @output /dev/null
44 messages
45 @output tmp/log1.out
46 @# Force Incremental on the second Volume
47 update volume=TestVolume001 VolStatus=Used
48 run level=Differential job=CompressedTest yes
49 wait
50 messages
51 quit
52 END_OF_DATA
53 sleep 1
54 touch ${cwd}/tmp/build/ficheriro1.txt
55 touch ${cwd}/tmp/build/ficheriro2.txt
56 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
57 @output /dev/null
58 messages
59 @output tmp/log1.out
60 run level=Incremental job=CompressedTest yes
61 wait
62 messages
63 quit
64 END_OF_DATA
65 sleep 1
66 cd ${cwd}/tmp/build
67 cp -f ficheriro2.txt 1
68 sed "s%a%b%g" 1 >ficheriro2.txt
69 rm -f 1
70 cd ${cwd}
71 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
72 @output /dev/null
73 messages
74 @output tmp/log1.out
75 run level=Differential job=CompressedTest yes
76 wait
77 messages
78 quit
79 END_OF_DATA
80 sleep 1
81 touch ${cwd}/tmp/build/ficheriro1.txt
82 touch ${cwd}/tmp/build/ficheriro2.txt
83 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
84 @output /dev/null
85 messages
86 @output tmp/log1.out
87 run level=Incremental job=CompressedTest yes
88 wait
89 messages
90 quit
91 END_OF_DATA
92 sleep 1
93 touch ${cwd}/tmp/build/ficheriro1.txt
94 touch ${cwd}/tmp/build/ficheriro2.txt
95 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
96 @output /dev/null
97 messages
98 @output tmp/log1.out
99 run level=Incremental job=CompressedTest yes
100 wait
101 messages
102 quit
103 END_OF_DATA
104 sleep 1
105 touch ${cwd}/tmp/build/ficheriro1.txt
106 touch ${cwd}/tmp/build/ficheriro2.txt
107 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
108 @output /dev/null
109 messages
110 @output tmp/log1.out
111 run level=Incremental job=CompressedTest yes
112 wait
113 messages
114 quit
115 END_OF_DATA
116 sleep 1
117 touch ${cwd}/tmp/build/ficheriro1.txt
118 touch ${cwd}/tmp/build/ficheriro2.txt
119 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
120 @output /dev/null
121 messages
122 @output tmp/log1.out
123 run level=Incremental job=CompressedTest yes
124 wait
125 messages
126 @# 
127 @# now do a restore
128 @#
129 @output tmp/log2.out
130 restore where=${cwd}/tmp/bacula-restores storage=File file=<${cwd}/tmp/restore-list
131 yes
132 wait
133 messages
134 @output
135 quit
136 END_OF_DATA
137 scripts/check_for_zombie_jobs storage=File
138 bin/bacula stop 2>&1 >/dev/null
139 grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
140 bstat=$?
141 grep "^  Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
142 rstat=$?
143 #
144 # Delete .c files because we will only restored the txt files
145 #
146 rm -f tmp/build/*.c
147 diff -r tmp/build tmp/bacula-restores${cwd}/tmp/build 2>&1 >/dev/null
148 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
149    echo " "
150    echo " "
151    echo "  !!!!! incremental-test Bacula source failed!!! !!!!! "
152    echo "  !!!!! incremental-test failed!!! !!!!! " >>test.out
153    if [ $bstat != 0 -o $rstat != 0 ] ; then
154       echo "  !!!!! Bad Job termination status     !!!!! "
155       echo "  !!!!! Bad Job termination status     !!!!! " >>test.out
156    else
157       echo "  !!!!! Restored files differ          !!!!! "
158       echo "  !!!!! Restored files differ          !!!!! " >>test.out
159    fi
160    echo " "
161 else
162    echo "  ===== incremental-test Bacula source OK ===== "
163    echo "  ===== incremental-test OK ===== " >>test.out
164    scripts/cleanup
165 fi