Autochanger {
Name = DDS-4
Changer Device = @autochanger@
- Changer Command ="@scriptdir@/mtx-changer %c %o %S %a %d"
+ Changer Command ="@scriptdir@/@changer_script@ %c %o %S %a %d"
Device = Drive-0
}
Autochanger {
Name = DDS-4
Changer Device = @autochanger@
- Changer Command ="@scriptdir@/mtx-changer %c %o %S %a %d"
+ Changer Command ="@scriptdir@/@changer_script@ %c %o %S %a %d"
Device = Drive-0, Drive-1
}
Autochanger {
Name = DDS-4
Changer Device = @autochanger@
- Changer Command ="@scriptdir@/mtx-changer %c %o %S %a %d"
+ Changer Command ="@scriptdir@/@changer_script@ %c %o %S %a %d"
Device = Drive-0
}
scripts/cleanup
if test x@autochanger@ != x/dev/null; then
- slot=`bin/mtx-changer @autochanger@ loaded 0 @tape_drive1@ 1`
+ slot=`bin/@changer_script@ @autochanger@ loaded 0 @tape_drive1@ 1`
echo "Slot $slot in drive 1"
if test x$slot != x0 ; then
echo "unload slot $slot in drive 1"
- bin/mtx-changer @autochanger@ unload $slot @tape_drive1@ 1
+ bin/@changer_script@ @autochanger@ unload $slot @tape_drive1@ 1
fi
- slot=`bin/mtx-changer @autochanger@ loaded 0 @tape_drive@ 0`
+ slot=`bin/@changer_script@ @autochanger@ loaded 0 @tape_drive@ 0`
echo "Slot $slot in drive 0"
if test x$slot != x0 ; then
echo "unload slot $slot in drive 0"
- bin/mtx-changer @autochanger@ unload $slot @tape_drive@ 0
+ bin/@changer_script@ @autochanger@ unload $slot @tape_drive@ 0
fi
- slot=`bin/mtx-changer @autochanger@ loaded 0 @tape_drive1@ 1`
+ slot=`bin/@changer_script@ @autochanger@ loaded 0 @tape_drive1@ 1`
if test x$slot != x2; then
echo "load slot 2 in drive 1"
- bin/mtx-changer @autochanger@ load 2 @tape_drive1@ 1
+ bin/@changer_script@ @autochanger@ load 2 @tape_drive1@ 1
fi
echo "WEOF drive 1"
- mt -f @tape_drive1@ rewind
- mt -f @tape_drive1@ weof
+ init_drive @tape_drive1@
+
echo "unload slot 2 in drive 1"
- bin/mtx-changer @autochanger@ unload 2 @tape_drive1@ 1
+ bin/@changer_script@ @autochanger@ unload 2 @tape_drive1@ 1
- slot=`bin/mtx-changer @autochanger@ loaded 0 @tape_drive@ 0`
+ slot=`bin/@changer_script@ @autochanger@ loaded 0 @tape_drive@ 0`
echo "Slot $slot in drive 0"
if test x$slot != x1; then
echo "load slot 1 in drive 0"
- bin/mtx-changer @autochanger@ load 1 @tape_drive@ 0
+ bin/@changer_script@ @autochanger@ load 1 @tape_drive@ 0
fi
echo "WEOF drive 0"
- mt -f @tape_drive@ rewind
- mt -f @tape_drive@ weof
+ init_drive @tape_drive@
+
echo "unload slot 1 from drive 0"
- bin/mtx-changer @autochanger@ unload 1 @tape_drive@ 0
+ bin/@changer_script@ @autochanger@ unload 1 @tape_drive@ 0
fi
scripts/cleanup
if test x@autochanger@ != x/dev/null; then
- slot=`bin/mtx-changer @autochanger@ loaded 0 dummy $DRIVE1`
+ slot=`bin/@changer_script@ @autochanger@ loaded 0 @tape_drive@ $DRIVE1`
if test "x${slot}" != "x$SLOT2"; then
- bin/mtx-changer @autochanger@ unload $slot @tape_drive@ $DRIVE1
- bin/mtx-changer @autochanger@ load $SLOT2 @tape_drive@ $DRIVE1
+ bin/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1
+ bin/@changer_script@ @autochanger@ load $SLOT2 @tape_drive@ $DRIVE1
fi
- mt -f @tape_drive@ rewind
- mt -f @tape_drive@ weof
+
+ init_drive @tape_drive@
fi
# If we have an autochanger always load tape in slot 1
#
if test x@autochanger@ != x/dev/null; then
- slot=`bin/mtx-changer @autochanger@ loaded 0 dummy $DRIVE1`
+ slot=`bin/@changer_script@ @autochanger@ loaded 0 @tape_drive@ $DRIVE1`
if test "x${slot}" != "x$SLOT1"; then
- bin/mtx-changer @autochanger@ unload $slot @tape_drive@ $DRIVE1
- bin/mtx-changer @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1
+ bin/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1
+ bin/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1
fi
fi
-mt -f @tape_drive@ rewind
-mt -f @tape_drive@ weof
+init_drive @tape_drive@
+
#
# Cleanup left over files -- both before and after test run
#
-. ./config
+. scripts/functions
scripts/cleanup
if test "x@autochanger@" != "x/dev/null" ; then
- a=`bin/mtx-changer @autochanger@ loaded $SLOT1 @tape_drive@ 0`
+ a=`bin/@changer_script@ @autochanger@ loaded $SLOT1 @tape_drive@ 0`
if test $a = 0 ; then
- bin/mtx-changer @autochanger@ load $SLOT1 @tape_drive@ 0
+ bin/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ 0
fi
fi
-mt -f @tape_drive@ rewind
-mt -f @tape_drive@ weof
+
+init_drive @tape_drive@
+
# set the ports used by these tests
BASEPORT=${BASEPORT:-8101}
+AUTOCHANGER_SCRIPT=${AUTOCHANGER_SCRIPT:-mtx-changer}
srcdir=${BACULA_SOURCE}
dirport=${BASEPORT}
fdport=`expr ${BASEPORT} '+' 1`
echo "s%@job_email@%${EMAIL}%g" >>${out}
echo "s%@tape_drive@%${TAPE_DRIVE}%g" >>${out}
echo "s%@autochanger@%${AUTOCHANGER}%g" >>${out}
+echo "s%@changer_script@%${AUTOCHANGER_SCRIPT}%g" >>${out}
echo "s%@tmpdir@%${cwd}/tmp%g" >>${out}
echo "s%@hostname@%${HOST}%g" >>${out}
echo "s%@changer_path@%${AUTOCHANGER_PATH}%g" >>${out}
sed -f ${out} ${cwd}/scripts/cleanup-2tape.in >${cwd}/scripts/cleanup-2tape
sed -f ${out} ${cwd}/scripts/cleanup-2drive.in >${cwd}/scripts/cleanup-2drive
sed -f ${out} ${cwd}/scripts/prepare-two-tapes.in >${cwd}/scripts/prepare-two-tapes
+sed -f ${out} ${cwd}/scripts/prepare-fake-autochanger.in >${cwd}/scripts/prepare-fake-autochanger
sed -f ${out} ${cwd}/scripts/bacula-dir.conf.testrunscript.in >${cwd}/scripts/bacula-dir.conf.testrunscript
sed -f ${out} ${cwd}/scripts/tls-bacula-fd.conf.in >${cwd}/scripts/tls-bacula-fd.conf
fi
}
+require_faketape()
+{
+if test x${USE_FAKETAPE} = x ; then
+ echo "$TestName test needs the faketape driver."
+ exit 1
+fi
+}
skip_if_no_autochanger()
{
fi
}
+init_drive()
+{
+ if test a$USE_FAKETAPE = a; then
+ mt -f $1 rewind
+ mt -f $1 weof
+ else
+ cp /dev/null $1
+ fi
+}
+
# Save current directory
cwd=`pwd`
if test "x${REGRESS_DEBUG}" = "x1"; then
--- /dev/null
+#!/bin/sh
+#
+# This script will prepare a big dummy autochanger
+#
+
+. scripts/functions
+
+# check if user wants to run this test
+if test x$USE_FAKETAPE = x; then
+ exit 1
+fi
+
+adir=@working_dir@/ach
+
+mkdir $adir 2> /dev/null
+rm -f $adir/log $adir/barcodes $adir/load* $adir/slot* $adir/drive* 2> /dev/null
+
+# create the autochanger configuration file
+cat > $adir/conf <<EOF
+maxdrive=8
+maxslot=80
+dbgfile=$adir/log
+EOF
+
+# turn on ach debug
+touch $adir/log
+
+# create 75 volumes
+for i in `seq 1 75`; do
+ echo $i:vol$i >> $adir/barcodes
+ cp /dev/null $adir/slot$i
+done
+
+# make a cleaning tape
+echo 76:CLN01 >> $adir/barcodes
+cp /dev/null $adir/slot76
+
+# keep other empty
+for i in `seq 77 79`; do
+ echo $i: >> $adir/barcodes
+done
+