]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/four-jobs-tape
Add new tape tests
[bacula/bacula] / regress / tests / four-jobs-tape
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory using the compressed option
4 #   then backup four times, each with incremental then finally restore.
5 #   It should require at least 4 different bsrs.
6 #
7 cwd=`pwd`
8 bin/bacula stop 2>&1 >/dev/null
9 bin/drop_sqlite_tables
10 bin/make_sqlite_tables
11
12 scripts/copy-tape-confs
13 scripts/cleanup-tape
14 echo "${cwd}/build" >/tmp/file-list
15
16 echo " "
17 echo " "
18 echo " === Starting four-jobs-tape  ==="
19 echo " === Starting four-jobs-tape  ===" >>working/log
20 echo " "
21
22 bin/bacula start 2>&1 >/dev/null
23 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
24 @output /dev/null
25 estimate job=NightlySave listing
26 estimate job=NightlySave listing
27 estimate job=NightlySave listing
28 messages
29 @output tmp/log1.out
30 label storage=DDS-4 volume=TestVolume001 slot=0
31 run job=NightlySave yes
32 wait
33 messages
34 quit
35 END_OF_DATA
36 echo "Backup 1 done"
37 # make some files for the incremental to pick up
38 touch ${cwd}/build/src/dird/*.c ${cwd}/build/src/dird/*.o
39 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
40    
41 #
42 # run a second job
43 #
44 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
45 @output /dev/null
46 messages
47 @output tmp/log1.out
48 run job=NightlySave level=Incremental yes
49 wait
50 messages
51 quit
52 END_OF_DATA
53 echo "Backup 2 done"
54 touch ${cwd}/build/src/dird/*.c
55 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
56 #
57 # run a third job
58 #
59 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
60 @output /dev/null
61 messages
62 @output tmp/log1.out
63 run job=NightlySave level=Incremental yes
64 wait
65 messages
66 quit
67 END_OF_DATA
68 echo "Backup 3 done"
69 # make some files for the incremental to pick up
70 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
71 #
72 # run a fourth job
73 #
74 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
75 @output /dev/null
76 messages
77 @output tmp/log1.out
78 run job=NightlySave level=Incremental yes
79 wait
80 messages
81 quit
82 END_OF_DATA
83 echo "Backup 4 done"
84
85 # now do several restores to ensure we cleanup between jobs
86 #
87 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
88 @output /dev/null
89 restore where=${cwd}/tmp/bacula-restores select all
90 yes
91 wait
92 restore where=${cwd}/tmp/bacula-restores select all
93 yes
94 wait
95 @output tmp/log2.out
96 restore where=${cwd}/tmp/bacula-restores select all
97 yes
98 wait
99 messages
100 @output
101 quit
102 END_OF_DATA
103 bin/bacula stop 2>&1 >/dev/null
104 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
105 bstat=$?
106 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
107 rstat=$?
108 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
109 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
110    echo " "
111    echo " "
112    echo "  !!!!! four-jobs-tape Bacula source failed!!! !!!!! "
113    echo "  !!!!! four-jobs-tape failed!!! !!!!! " >>test.out
114    echo " "
115 else
116    echo "  ===== four-jobs-tape Bacula source OK ===== "
117    echo "  ===== four-jobs-tape OK ===== " >>test.out
118    scripts/cleanup
119 fi