]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
regress: skip unsuitable dedup test regarding the dedup driver
authorAlain Spineux <alain@baculasystems.com>
Tue, 17 Nov 2020 08:28:09 +0000 (09:28 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:03:28 +0000 (09:03 +0100)
- some test are incompatible with Legacy or Dedup2 drivers
- use check_dedup_enable <LIST OF VALID DRIVERS> like in
  > check_dedup_enable  # use default aka Legacy
  > check_dedup_enable Legacy
  > check_dedup_enable Dedup2
  > check_dedup_enable Legacy Dedup2 # works on both

regress/scripts/functions

index 0638036c3afe56bf01ad72ce70fed3204866606f..c1d1b88ff26ea1f0868d0f20bedc99c0a1bd9c03 100755 (executable)
@@ -851,14 +851,31 @@ die_early()
 #
 check_dedup_enable()
 {
+   dedup_drivers=${1:-Legacy}
    if [ "$FORCE_DEDUP" != "yes" ] ; then
-      print_debug "This test is dedicated to DEDUP, set variable FORCE_DEDUP to 'yes'"
+      echo "This test is dedicated to DEDUP, set variable FORCE_DEDUP to 'yes'"
       exit 0
    fi
    if [ "$DEDUP_FS_OPTION" != "bothsides" -a "$DEDUP_FS_OPTION" != "storage" -a "$DEDUP_FS_OPTION" != "none" ] ; then
-      print_debug "variable DEDUP_FS_OPTION must be set to bothsides, storage or none"
+      echo "variable DEDUP_FS_OPTION must be set to bothsides, storage or none"
       exit 1
    fi
+   if [ -n $dedup_drivers ] ; then
+      # a list of valid drivers for the test has been specified
+      # check if one match the active one
+      active_driver=${DEDUP_DRIVER=:-Legacy}
+      result="no"
+      for driver in $dedup_drivers ; do
+         if [ "$driver" = "$active_driver" ] ; then
+            result="ok"
+            break
+         fi
+      done
+      if [ $result != ok ] ; then
+         echo "This test is designed for dedup drivers: "$dedup_drivers", not $active_driver"
+         exit 0
+      fi
+   fi
 }
 
 
@@ -867,9 +884,9 @@ check_dedup_enable()
 #
 check_dedup_forced()
 {
-   check_dedup_enable
+   check_dedup_enable $*
    if [ "$DEDUP_FS_OPTION" = "none" ] ; then
-      print_debug "This test expect to see the DDE grow then DEDUP_FS_OPTION cannot be none"
+      echo "This test expect to see the DDE grow then DEDUP_FS_OPTION cannot be none"
       exit 0
    fi
 }