]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/incremental-test
Update and add tests
[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 ==="
20 echo " === Starting incremental-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 Incremental on the second Volume
43 update volume=TestVolume001 VolStatus=Used
44 run level=Incremental job=CompressedTest yes
45 wait
46 messages
47 @# 
48 @# now do a restore
49 @#
50 @output tmp/log2.out
51 restore where=${cwd}/tmp/bacula-restores storage=File file=<${cwd}/tmp/restore-list
52 yes
53 wait
54 messages
55 @output
56 quit
57 END_OF_DATA
58 scripts/check_for_zombie_jobs storage=File
59 bin/bacula stop 2>&1 >/dev/null
60 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
61 bstat=$?
62 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
63 rstat=$?
64 #
65 # Delete .c files because we will only restored the txt files
66 #
67 rm -f tmp/build/*.c
68 diff -r tmp/build tmp/bacula-restores${cwd}/tmp/build 2>&1 >/dev/null
69 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
70    echo " "
71    echo " "
72    echo "  !!!!! incremental-test Bacula source failed!!! !!!!! "
73    echo "  !!!!! incremental-test failed!!! !!!!! " >>test.out
74    echo " "
75 else
76    echo "  ===== incremental-test Bacula source OK ===== "
77    echo "  ===== incremental-test OK ===== " >>test.out
78    scripts/cleanup
79 fi