]> git.sur5r.net Git - bacula/bacula/commitdiff
Cleanup some autochanger code
authorKern Sibbald <kern@sibbald.com>
Sun, 1 Jun 2008 20:11:18 +0000 (20:11 +0000)
committerKern Sibbald <kern@sibbald.com>
Sun, 1 Jun 2008 20:11:18 +0000 (20:11 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/branches/Branch-2.2@7089 91ce42f0-d328-0410-95d8-f526ca767f89

regress/do_disk [new file with mode: 0755]
regress/scripts/cleanup-2tape.in
regress/scripts/cleanup-tape.in
regress/scripts/functions
regress/scripts/prepare-two-tapes.in
regress/tests/two-volume-test

diff --git a/regress/do_disk b/regress/do_disk
new file mode 100755 (executable)
index 0000000..0ac4aa8
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+#  /home/kern/bacula/bin/startmysql
+nice make setup
+echo " " >test.out
+cat build/config.out >>test.out
+echo " " >>test.out
+echo "Test results" >>test.out
+echo " " >>test.out
+./starttime
+nice ./all-non-root-tests
+echo " "
+echo "End do_file tests"
+echo "End do_file tests" >>test.out
+scripts/cleanup
+cat test.out
+./endtime
index b937ea115ee900b0cadb23dddcd035127416837a..8fa197d4df7b2e0b6ca71afec068f9dccd7a1a1a 100755 (executable)
@@ -6,28 +6,4 @@
 . scripts/functions
 
 scripts/cleanup
-
-if test x@autochanger@ != x/dev/null; then
-   slot=`bin/@changer_script@ @autochanger@ loaded 0 @tape_drive@ $DRIVE1`
-   if test "x${slot}" != "x$SLOT2"; then
-      bin/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1
-      bin/@changer_script@ @autochanger@ load $SLOT2 @tape_drive@ $DRIVE1
-   fi
-
-   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/@changer_script@ @autochanger@ loaded 0 @tape_drive@ $DRIVE1`
-   if test "x${slot}" != "x$SLOT1"; then
-      bin/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1
-      bin/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1
-   fi
-fi
-
-init_drive @tape_drive@
-
+scripts/prepare-two-tapes
index 310731c9173ec0a9e3d0485754e38b9e6ea2474e..936540289db983a13199aa913ac319d654e000ef 100755 (executable)
@@ -1,17 +1,26 @@
 #!/bin/sh
 #
-# Cleanup left over files -- both before and after test run
+# Cleanup left over files, then load $SLOT1 into drive and    
+#   write an EOF on it.
 #
+
 . scripts/functions
 
 scripts/cleanup
 
-if test "x@autochanger@" != "x/dev/null" ; then
-   a=`bin/@changer_script@ @autochanger@ loaded $SLOT1 @tape_drive@ 0`
-   if test $a = 0 ; then
-     bin/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ 0
-   fi
+if test x@autochanger@ != x/dev/null; then
+   slot=`bin/@changer_script@ @autochanger@ loaded 0 @tape_drive@ $DRIVE1`
+   case $slot in
+   0)
+      bin/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1
+      ;;
+   $SLOT1)
+      ;;
+   default)
+      bin/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1
+      bin/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1
+      ;;
+  esac
 fi
 
 init_drive @tape_drive@
-
index 11c3789623567ec068f760da1c9787241024ce7d..61d6eb499901cad011a3caa7dd7063fb3ea3d85b 100644 (file)
@@ -2,6 +2,7 @@
 # A set of useful functions to be sourced in each test
 #
 
+
 start_test()
 {
    # Turn off email
@@ -55,7 +56,7 @@ if test x${AUTOCHANGER} = x/dev/null ; then
 fi
 }
 
-require_faketape()
+require_faketape() 
 {
 if test x${USE_FAKETAPE} = x ; then
    echo "$TestName test needs the faketape driver."
@@ -130,6 +131,21 @@ run_bscan()
    fi
 }
 
+bscan_libdbi()
+{   
+   B=`echo $LIBDBI | sed 's/;//' | sed 's/;//g'`
+   B_D=`echo $B | awk '{print $3}'`
+   B_t=`echo $B | awk '{print $6}'`
+   B_p=`echo $B | awk '{print $9}'`
+
+   BSCANLIBDBI="${LIBDBI:+1}"
+                
+   if test "$BSCANLIBDBI" = "1" ; then
+      BSCANLIBDBI="-D $B_D -h $B_t -t $B_p"
+   else
+      BSCANLIBDBI=" "
+   fi
+}
 
 stop_bacula()
 {
@@ -264,3 +280,6 @@ fi
 
 # Source the configuration variables
 . ${cwd}/config
+
+CLIENT=${HOST}-fd
+AUTOCHANGER_SCRIPT=${AUTOCHANGER_SCRIPT:-mtx-changer}
index 95dad305c0efa54fc5d8813fdfe9aae41a1425d4..642a8f850ca7ffc8fca4376d955590d2f5b0f66f 100755 (executable)
@@ -2,31 +2,51 @@
 #
 # Cleanup left over files -- both before and after test run
 #
+# Write an EOF on tape in slot $SLOT1  and  on tape in $SLOT2
 
 . scripts/functions
 
 scripts/cleanup
 
-if test x@autochanger@ != x/dev/null; then
-   slot=`bin/@changer_script@ @autochanger@ loaded 0 @tape_drive@ $DRIVE1`
-   if test "x${slot}" != "x$SLOT2"; then
-      bin/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1
-      bin/@changer_script@ @autochanger@ load $SLOT2 @tape_drive@ $DRIVE1
-   fi
-   init_drive @tape_drive@
-fi
-
-
 #
-# If we have an autochanger always load tape in slot 1
+# init first of two slots
+# optimize so we don't unnecessarily unload and load slots
 #
 if test x@autochanger@ != x/dev/null; then
    slot=`bin/@changer_script@ @autochanger@ loaded 0 @tape_drive@ $DRIVE1`
-   if test "x${slot}" != "x$SLOT1"; then
+   case $slot in
+   0)
+      bin/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1
+      init_drive @tape_drive@
+      slot=$SLOT1
+      ;;
+   $SLOT1)
+      init_drive @tape_drive@
+      slot=$SLOT1
+      ;;
+   $SLOT2)
+      init_drive @tape_drive@
+      slot=$SLOT2
+      ;;
+   default)
       bin/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1
       bin/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1
-   fi
-fi
-
-init_drive @tape_drive@
+      init_drive @tape_drive@
+      slot=$SLOT1
+      ;;
+  esac
 
+# init the other slot
+  case $slot in
+   $SLOT1)
+      bin/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1
+      bin/@changer_script@ @autochanger@ load $SLOT2 @tape_drive@ $DRIVE1
+      init_drive @tape_drive@
+      ;;
+   $SLOT2)
+      bin/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1
+      bin/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1
+      init_drive @tape_drive@
+      ;;
+   esac
+fi
index 1266e75d76c84605555cf775d4c28a6cd2e35751..920beb57ac68bab9d52e7454411266f848d9ab7b 100755 (executable)
@@ -38,7 +38,7 @@ sql
 select * from Storage;
 select VolumeName,InChanger,StorageId from Media;
 
-@#setdebug level=1000 client 
+@#setdebug level=1000 client=$CLIENT 
 run job=$JobName yes
 wait
 update slots scan storage=DDS-4