label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0
@# run two jobs (both will be migrated)
run job=$JobName yes
+@sleep 2
run job=$JobName yes
wait
list jobs
-list volumes
-@#setdebug level=100 dir
@# should migrate two jobs
-@#setdebug level=51 storage=DiskChanger
run job=migrate-job yes
wait
messages
-@# purge volume=FileVolume001
list jobs
-list volumes
-list joblog jobid=6
wait
@#
@# Now do another backup, but level Incremental
run job=$JobName level=Incremental yes
wait
messages
-@sleep 1
+@sleep 2
@################################################################
-@$out $cwd/tmp/log3.out
-@#
-@# This final job that runs should be Incremental and
-@# not upgraded to full.
+@$out $cwd/tmp/log10.out
+setdebug level=1 director
list jobs
prune jobs yes
list jobs
check_two_logs
check_restore_diff
-$bperl -e "check_job_list('$tmp/log3.out',1,2,3,4,5,7)"
+# Now we will verify that the pruning code is working as expected. Each time,
+# we run 'list jobs', 'prune', 'list jobs'. check_prune_list ensures that jobids
+# in argument are present in the first 'list jobs', the 'prune' command deletes
+# them (same number), and checks that the last 'list jobs' doesn't contain them
+# anymore. See scripts/functions.pm for details.
+
+# M M g g F F I0 -> F
+$bperl -e "check_prune_list('$tmp/log10.out',1,2,3,4,5,7)"
estat=$(($estat + $?))
end_test