#!/bin/sh
#
+# Copyright (C) 2000-2017 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
# Run a backup of the Bacula build directory on two Volumes
# then copy it to another device.
#
scripts/cleanup
scripts/copy-migration-confs
-scripts/prepare-disk-changer
echo "${cwd}/build" >${cwd}/tmp/file-list
#cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
#sed "s%# Maximum File Size% Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
touch ${cwd}/tmp/log2.out
+$bperl -e 'add_attribute("$conf/bacula-dir.conf", "Allow Duplicate Jobs", "no", "Job", "MigVolBackup")'
+
start_test
#
# Write out bconsole commands
cat <<END_OF_DATA >${cwd}/tmp/bconcmds
-@output
+@output /dev/null
messages
@$out ${cwd}/tmp/log1.out
label storage=File volume=FileVolume001 Pool=Default
@# should copy job 1,2,3
@# Expect: 3 copies (1,2,3)
@############################################################
-@#setdebug level=100 dir
+setdebug level=200 dir
run job=copy-uncopied yes
@sleep 5
wait
dstat=0
zstat=0
-for i in tmp/log1[0-9].out; do
- awk -F '|' '
- /list copies/ { ok=1; delete already }
- /^[|][ ]+[0-9]+/ {
- if (ok) {
- jobid=$2
- copyid=$4
-
- if (already[jobid]) {
- print "ERROR: " jobid " " copyid " " already[jobid]
- } else {
- print "OK: " jobid " " copyid
- }
-
- already[jobid]=copyid
- }
-}' $i > $i.result
-done
-
-grep ERROR tmp/log*result
-if [ $? -eq 0 ]; then
- print_debug "Found multiple copies"
- bstat=2
-fi
-
-n=`wc -l tmp/log11.out.result | awk '{ print $1 }'`
-if [ $n -ne 3 ]; then
- print_debug "log11: Bad copies number"
- bstat=3
-fi
+perl -Mscripts::functions -e 'check_multiple_copies(3)' tmp/log11.out
+bstat=`expr $bstat + $?`
-n=`wc -l tmp/log12.out.result| awk '{ print $1 }'`
-if [ $n -ne 3 ]; then
- print_debug "log12: Bad copies number"
- bstat=3
-fi
+perl -Mscripts::functions -e 'check_multiple_copies(3)' tmp/log12.out
+bstat=`expr $bstat + $?`
-n=`wc -l tmp/log13.out.result| awk '{ print $1 }'`
-if [ $n -ne 2 ]; then
- print_debug "log13: Bad copies number"
- bstat=3
-fi
+perl -Mscripts::functions -e 'check_multiple_copies(2)' tmp/log13.out
+bstat=`expr $bstat + $?`
-n=`wc -l tmp/log14.out.result| awk '{ print $1 }'`
-if [ $n -ne 2 ]; then
- print_debug "log14: Bad copies number"
- bstat=3
-fi
+perl -Mscripts::functions -e 'check_multiple_copies(2)' tmp/log14.out
+bstat=`expr $bstat + $?`
check_two_logs
end_test