copy_test_confs
sed 's/backup_advance/base_backup/' $rscripts/bacula-dir.conf.accurate > $tmp/1
-sed 's/Name = backup/Name = backup; Base = base_backup/' $tmp/1 > $conf/bacula-dir.conf
+sed 's/Name = backup/Name = backup; Base = base_backup, backup/' $tmp/1 > $conf/bacula-dir.conf
sed s/all,/all,saved,/ $conf/bacula-fd.conf > tmp/1
cp tmp/1 $conf/bacula-fd.conf
################################################################
cat <<END_OF_DATA >${cwd}/tmp/bconcmds
@$out ${cwd}/tmp/log1.out
+update volume=TestVolume002 volstatus=Used
+label volume=TestVolume003 storage=File pool=Default
run job=backup level=incremental yes
wait
messages
END_OF_DATA
rm ${cwd}/build/accurate/yyyyyy # delete a file
-rmdir ${cwd}/build/accurate/dirtest
+rm -rf ${cwd}/build/accurate/dirtest
run_bconsole
check_two_logs
check_restore_diff
-check_files_written ${cwd}/tmp/log1.out 3
+check_files_written ${cwd}/tmp/log1.out 4
rm -rf ${cwd}/tmp/bacula-restores
+
+################################################################
+p Test the job purge
+################################################################
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@$out ${cwd}/tmp/log3.out
+sql
+SELECT count(*) FROM BaseFiles;
+
+purge volume=TestVolume002
+messages
+sql
+SELECT count(*) FROM BaseFiles;
+
+END_OF_DATA
+
+run_bconsole
+
+grep -e ' 0 *|' ${cwd}/tmp/log3.out > /dev/null
+if [ $? -ne 0 ]; then
+ print_debug "Can't purge the base job"
+ dstat=2
+fi
+
stop_bacula
end_test