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