]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/bscan-tape
Copy trunk regress into Branch
[bacula/bacula] / regress / tests / bscan-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 
5 #   do a bscan and restore.
6 #   It should require at least 4 different bsrs.
7 #
8 TestName="bscan-tape"
9 JobName=bscantape
10 . scripts/functions
11
12 copy_tape_confs
13
14 echo "${cwd}/build" >tmp/file-list
15
16 cp ${cwd}/bin/bacula-sd.conf tmp/1
17 sed "s%# Maximum File Size%  Maximum File Size%" tmp/1 >${cwd}/bin/bacula-sd.conf
18
19 change_jobname NightlySave $JobName
20 start_test
21
22 cat <<END_OF_DATA >tmp/bconcmds
23 @output /dev/null
24 estimate job=$JobName listing
25 estimate job=$JobName listing
26 estimate job=$JobName listing
27 messages
28 @$out tmp/log1.out
29 setdebug level=2 storage=DDS-4
30 label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default
31 run job=$JobName yes
32 wait
33 run job=$JobName level=Full yes
34 wait
35 run job=$JobName level=Full yes
36 wait
37 messages
38 quit
39 END_OF_DATA
40
41 run_bacula
42 check_for_zombie_jobs storage=DDS-4
43
44 echo "Backup 1 done"
45 # make some files for the incremental to pick up
46 touch ${cwd}/build/src/dird/*.c ${cwd}/build/src/dird/*.o
47 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
48    
49 #
50 # run a second job
51 #
52 cat <<END_OF_DATA >tmp/bconcmds
53 @$out /dev/null
54 messages
55 @$out tmp/log1.out
56 run job=$JobName level=Incremental yes
57 wait
58 messages
59 quit
60 END_OF_DATA
61
62 run_bacula
63 scripts/check_for_zombie_jobs storage=DDS-4
64
65 echo "Backup 2 done"
66 touch ${cwd}/build/src/dird/*.c
67 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
68 #
69 # run a third job
70 #
71 cat <<END_OF_DATA >tmp/bconcmds
72 @$out /dev/null
73 messages
74 @$out tmp/log1.out
75 run job=$JobName level=Incremental yes
76 wait
77 messages
78 quit
79 END_OF_DATA
80
81 run_bacula
82 scripts/check_for_zombie_jobs storage=DDS-4
83
84 echo "Backup 3 done"
85 # make some files for the incremental to pick up
86 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
87 #echo "abc" > ${cwd}/build/src/lib/dummy
88 #
89 # run a fourth job
90 #
91 cat <<END_OF_DATA >tmp/bconcmds
92 @$out /dev/null
93 messages
94 @$out tmp/log1.out
95 run job=$JobName level=Incremental yes
96 wait
97 messages
98 quit
99 END_OF_DATA
100
101 run_bacula
102
103 scripts/check_for_zombie_jobs storage=DDS-4
104 stop_bacula
105
106 echo "Backup 4 done"
107 #
108 # now drop and recreate the database
109 #
110 cd bin
111 ./drop_bacula_tables >/dev/null 2>&1
112 ./make_bacula_tables >/dev/null 2>&1
113 ./grant_bacula_privileges 2>&1 >/dev/null
114 cd ..
115
116 echo "volume=TestVolume001" >tmp/bscan.bsr
117 if test "$debug" -eq 1 ; then
118   bin/bscan -w working -u regress -n regress -m -s -v -b tmp/bscan.bsr -c bin/bacula-sd.conf DDS-4                
119 else
120   bin/bscan -w working -u regress -n regress -m -s -v -b tmp/bscan.bsr -c bin/bacula-sd.conf DDS-4 2>&1 >/dev/null
121 fi
122
123 cat <<END_OF_DATA >tmp/bconcmds
124 @$out /dev/null
125 messages
126 @$out tmp/log2.out
127 @# 
128 @# now do a restore
129 @#
130 restore where=tmp/bacula-restores select all storage=DDS-4 done
131 yes
132 wait
133 messages
134 @$out
135 quit
136 END_OF_DATA
137
138 run_bacula
139 check_for_zombie_jobs storage=DDS-4
140 stop_bacula
141 rm -f  ${cwd}/build/src/lib/dummy
142
143 check_two_logs
144 check_restore_diff
145 end_test