3 # Run a basejob backup of the Bacula build directory
7 TestName="prune-base-job-test"
13 echo 's/backup_advance/base_backup/' > $tmp/s
14 echo 's/Name = backup/Name = backup; Base = base_backup, backup/' >> $tmp/s
15 sed -f $tmp/s $rscripts/bacula-dir.conf.accurate > $conf/bacula-dir.conf
18 sed s/all,/all,saved,/ $conf/bacula-fd.conf > tmp/1
19 cp tmp/1 $conf/bacula-fd.conf
21 change_jobname BackupClient1 $JobName
22 dircfg=$conf/bacula-dir.conf
24 # modify some attributes in configuration file for the test
25 $bperl -e "add_attribute('$dircfg', 'AutoPrune', 'No', 'Client')"
26 $bperl -e "add_attribute('$dircfg', 'Job Retention', '1s', 'Client')"
27 $bperl -e "add_attribute('$dircfg', 'File', '<$tmp/lst', 'FileSet', 'FS_TESTJOB_ADVANCE')"
29 echo "##############################################" >> ${cwd}/tmp/log1.out
30 echo "$*" >> ${cwd}/tmp/log1.out
31 echo "##############################################" >> ${cwd}/tmp/log2.out
32 echo "$*" >> ${cwd}/tmp/log2.out
36 echo ${cwd}/bin > ${cwd}/tmp/lst
37 echo ${cwd}/bin > ${cwd}/tmp/file-list
38 echo ${cwd}/build >> ${cwd}/tmp/file-list
42 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
45 label volume=TestVolume001 storage=File pool=Default
51 ################################################################
52 p Now do a backup using base backup
53 ################################################################
55 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
56 @$out ${cwd}/tmp/log1.out
57 run job=base_backup level=base yes
60 update volume=TestVolume001 volstatus=Used
65 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
67 label volume=TestVolume002 storage=File pool=Default
68 run job=backup level=full yes
71 @exec "touch $cwd/build/po/fr.po"
72 run job=backup level=incremental yes
75 run job=backup level=differential yes
79 run job=backup level=incremental yes
86 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
90 @$out ${cwd}/tmp/log4.out
91 @exec "touch $cwd/build/po/fr.po"
92 run job=backup level=incremental yes
100 check_for_zombie_jobs storage=File
105 export bstat dstat estat
107 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
110 SELECT count(*) FROM BaseFiles;
116 @################################################################
117 @# This full job will force the purge of the previous one
118 run job=backup level=full yes
126 @################################################################
127 @# This base job will replace the first one after the next full replacement
128 run job=base_backup level=base yes
136 @################################################################
137 @# This full job will force the purge of the previous one
138 run job=backup level=full yes
146 @################################################################
147 @# see with two base jobs (base_backup and backup)
148 run job=backup level=base yes
151 @exec "touch $cwd/bin/bacula-dir.conf"
152 run job=base_backup level=base yes
156 run job=backup level=full yes
168 # Now we will verify that the pruning code is working as expected. Each time,
169 # we run 'list jobs', 'prune', 'list jobs'. check_prune_list ensures that jobids
170 # in argument are present in the first 'list jobs', the 'prune' command deletes
171 # them (same number), and checks that the last 'list jobs' doesn't contain them
172 # anymore. See scripts/functions.pm for details.
174 # B F I D I0 R I -> B F D I
175 $bperl -e "check_prune_list('$tmp/log10.out', 3,5,6)"
176 estat=$(($estat + $?))
179 $bperl -e "check_prune_list('$tmp/log11.out', 2,4,7)"
180 estat=$(($estat + $?))
183 $bperl -e "check_prune_list('$tmp/log12.out')"
184 estat=$(($estat + $?))
187 $bperl -e "check_prune_list('$tmp/log13.out',1,8)"
188 estat=$(($estat + $?))
191 $bperl -e "check_prune_list('$tmp/log14.out',9,10)"
192 estat=$(($estat + $?))