]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/bscan-tape
Make out of freespace non-fatal for removable devices -- i.e. behaves like tape
[bacula/bacula] / regress / tests / bscan-tape
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6
7 #
8 # Run a simple backup of the Bacula build directory using the compressed option
9 #   then backup four times, each with incremental then 
10 #   do a bscan and restore.
11 #   It should require at least 4 different bsrs.
12 #
13 TestName="bscan-tape"
14 JobName=bscantape
15 . scripts/functions
16
17 require_tape_drive
18
19 copy_tape_confs
20
21 echo "${cwd}/build" >tmp/file-list
22
23 cp ${cwd}/bin/bacula-sd.conf tmp/1
24 sed "s%# Maximum File Size%  Maximum File Size%" tmp/1 >${cwd}/bin/bacula-sd.conf
25
26 change_jobname NightlySave $JobName
27 start_test
28
29 cat <<END_OF_DATA >tmp/bconcmds
30 @$out /dev/null
31 estimate job=$JobName listing
32 estimate job=$JobName listing
33 messages
34 @$out tmp/log1.out
35 setdebug level=2 storage=tape
36 label storage=tape volume=TestVolume001 slot=0 pool=Default
37 run job=$JobName level=Full yes 
38 wait
39 run job=$JobName level=Full yes
40 wait
41 messages
42 quit
43 END_OF_DATA
44
45 run_bacula
46 check_for_zombie_jobs storage=tape
47
48 # make some files for the incremental to pick up
49 touch ${cwd}/build/src/dird/*.c ${cwd}/build/src/dird/*.o
50 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
51    
52 #
53 # run a second job
54 #
55 cat <<END_OF_DATA >tmp/bconcmds
56 @$out /dev/null
57 messages
58 @$out tmp/log1.out
59 run job=$JobName level=Incremental yes
60 wait
61 messages
62 quit
63 END_OF_DATA
64
65 run_bconsole
66 scripts/check_for_zombie_jobs storage=tape
67
68 touch ${cwd}/build/src/dird/*.c
69 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
70 #
71 # run a third job
72 #
73
74 run_bconsole
75 scripts/check_for_zombie_jobs storage=tape
76
77 # make some files for the incremental to pick up
78 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
79 #echo "abc" > ${cwd}/build/src/lib/dummy
80 #
81 # run a fourth job
82 #
83
84 run_bconsole
85 scripts/check_for_zombie_jobs storage=tape
86
87 stop_bacula
88
89 #
90 # now drop and recreate the database
91 #
92 cd bin
93 ./drop_bacula_tables >/dev/null 2>&1
94 ./make_bacula_tables >/dev/null 2>&1
95 ./grant_bacula_privileges 2>&1 >/dev/null
96 cd ..
97
98 echo "volume=TestVolume001" >tmp/bscan.bsr
99
100 bscan_libdbi
101
102 # If the database has a password pass it to bscan
103 if test "x${db_password}" = "x"; then
104   PASSWD=
105 else
106   PASSWD="-P ${db_password}"
107 fi
108
109 if test "$debug" -eq 1 ; then
110   $bin/bscan -w working $BSCANLIBDBI -u ${db_user} -n ${db_name} $PASSWD -m -s -v -b tmp/bscan.bsr -c bin/bacula-sd.conf tape                
111 else
112   $bin/bscan -w working $BSCANLIBDBI -u ${db_user} -n ${db_name} $PASSWD -m -s -v -b tmp/bscan.bsr -c bin/bacula-sd.conf tape >/dev/null 2>&1
113 fi
114
115 echo $BSCANLIBDBI
116
117 cat <<END_OF_DATA >tmp/bconcmds
118 @$out /dev/null
119 messages
120 @$out tmp/log2.out
121 @# 
122 @# now do a restore
123 @#
124 restore where=${cwd}/tmp/bacula-restores select all storage=tape done
125 yes
126 wait
127 messages
128 quit
129 END_OF_DATA
130
131 run_bacula
132 check_for_zombie_jobs storage=tape
133 stop_bacula
134 rm -f  ${cwd}/build/src/lib/dummy
135
136 check_two_logs
137 check_restore_diff
138 end_test