--- /dev/null
+#!/bin/sh
+#
+# Run a basejob backup of the Bacula build directory
+# then restore it.
+#
+
+TestName="prune-base-job-test"
+JobName=backup
+. scripts/functions
+$rscripts/cleanup
+
+copy_test_confs
+echo 's/backup_advance/base_backup/' > $tmp/s
+echo 's/Name = backup/Name = backup; Base = base_backup, backup/' >> $tmp/s
+sed -f $tmp/s $rscripts/bacula-dir.conf.accurate > $conf/bacula-dir.conf
+rm -f $tmp/s
+
+sed s/all,/all,saved,/ $conf/bacula-fd.conf > tmp/1
+cp tmp/1 $conf/bacula-fd.conf
+
+change_jobname BackupClient1 $JobName
+$bperl -e 'add_attribute("$conf/bacula-dir.conf", "AutoPrune", "No", "Client")'
+$bperl -e 'add_attribute("$conf/bacula-dir.conf", "Job Retention", "1s", "Client")'
+
+p() {
+ echo "##############################################" >> ${cwd}/tmp/log1.out
+ echo "$*" >> ${cwd}/tmp/log1.out
+ echo "##############################################" >> ${cwd}/tmp/log2.out
+ echo "$*" >> ${cwd}/tmp/log2.out
+}
+
+
+echo ${cwd}/bin > ${cwd}/tmp/file-list
+
+start_test
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@output /dev/null
+messages
+label volume=TestVolume001 storage=File pool=Default
+messages
+END_OF_DATA
+
+run_bacula
+
+################################################################
+p Now do a backup using base backup
+################################################################
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@$out ${cwd}/tmp/log1.out
+run job=base_backup level=base yes
+wait
+messages
+update volume=TestVolume001 volstatus=Used
+END_OF_DATA
+
+run_bconsole
+
+echo ${cwd}/build > ${cwd}/tmp/file-list
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@$out $tmp/log4.out
+label volume=TestVolume002 storage=File pool=Default
+run job=backup level=full yes
+wait
+messages
+@exec "touch $cwd/build/po/fr.po"
+run job=backup level=incremental yes
+wait
+messages
+@$out $tmp/log2.out
+@#
+@# now do a restore
+@#
+restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
+yes
+wait
+messages
+@$out ${cwd}/tmp/log4.out
+@exec "touch $cwd/build/po/fr.po"
+run job=backup level=incremental yes
+wait
+messages
+quit
+END_OF_DATA
+
+
+run_bconsole
+check_for_zombie_jobs storage=File
+
+check_two_logs
+check_restore_diff
+
+export bstat dstat estat
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@$out $tmp/log10.out
+list jobs
+prune jobs yes
+list jobs
+END_OF_DATA
+
+run_bconsole
+
+$bperl -e "check_job_list('$tmp/log10.out', 4)"
+stop_bacula
+end_test