ctdb-tests: Remove function iterate_test()
authorMartin Schwenke <martin@meltin.net>
Wed, 17 Jun 2015 07:26:21 +0000 (17:26 +1000)
committerAmitay Isaacs <amitay@samba.org>
Tue, 14 Jul 2015 07:57:17 +0000 (09:57 +0200)
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/eventscripts/README
ctdb/tests/eventscripts/scripts/local.sh

index 266c530bad07acea13f3530db45b05fe99544605..304cdba185a898519a00ad92bb1441ba11a04d05 100644 (file)
@@ -11,11 +11,10 @@ Test case filenames look like:
   <eventscript>.<event>.NNN.sh
 
 The test helper functions will run <eventscript> with specified
-options.  If using the simple_test() or iterate_test() helper
-functions then the 1st <event> argument is automatically passed.  When
-simple_test_event() is used the event name must be explicitly passed
-as the 1st argument - this is more flexible and supports multiple
-events per test.
+options.  If using the simple_test() helper function then the 1st
+<event> argument is automatically passed.  When simple_test_event() is
+used the event name must be explicitly passed as the 1st argument -
+this is more flexible and supports multiple events per test.
 
 Examples:
 
index d9169aa94c1959da2b24ef194f3f09d39ed41e70..9472b808aded6c13dde0da621e2cff0c29d0f202 100644 (file)
@@ -1164,102 +1164,6 @@ simple_test_command ()
     unit_test "$@"
 }
 
-# Run an eventscript iteratively.
-# - 1st argument is the number of iterations.
-# - 2nd argument is something to eval to do setup for every iteration.
-#   The easiest thing to do here is to define a function and pass it
-#   here.
-# - Subsequent arguments come in pairs: an iteration number and
-#   something to eval for that iteration.  Each time an iteration
-#   number is matched the associated argument is given to eval after
-#   the default setup is done.  The iteration numbers need to be given
-#   in ascending order.
-#
-# Some optional args can be given *before* these, surrounded by extra
-# "--" args.  These args are passed to the eventscript.  Quoting is
-# lost.
-#
-# One use of the 2nd and further arguments is to call
-# required_result() to change what is expected of a particular
-# iteration.
-iterate_test ()
-{
-    [ -n "$event" ] || die 'simple_test: $event not set'
-
-    args=""
-    if [ "$1" = "--" ] ; then
-       shift
-       while [ "$1" != "--" ] ; do
-           args="${args}${args:+ }$1"
-           shift
-       done
-       shift
-    fi
-
-    _repeats="$1"
-    _setup_default="$2"
-    shift 2
-
-    echo "Running $_repeats iterations of \"$script $event\" $args"
-
-    _result=true
-
-    extra_footer ()
-    {
-       cat <<EOF
---------------------------------------------------
-CTDB_BASE="$CTDB_BASE"
-CTDB_ETCDIR="$CTDB_ETCDIR"
-ctdb client is "$(which ctdb)"
-ip command is "$(which ip)"
---------------------------------------------------
-EOF
-    }
-
-    for iteration in $(seq 1 $_repeats) ; do
-       # This is inefficient because the iteration-specific setup
-       # might completely replace the default one.  However, running
-       # the default is good because it allows you to revert to a
-       # particular result without needing to specify it explicitly.
-       eval $_setup_default
-       if [ $iteration = "$1" ] ; then
-           eval $2
-           shift 2
-       fi
-
-       extra_header ()
-       {
-           cat <<EOF
-
-##################################################
-Iteration $iteration
-EOF
-       }
-
-       _shell=""
-       if $TEST_COMMAND_TRACE ; then
-           _shell="sh -x"
-       else
-           _shell="sh"
-       fi
-       _out=$($_shell "${script_dir}/${script}" "$event" $args 2>&1)
-       _rc=$?
-
-       _fout=$(echo "$_out" | result_filter)
-
-       if [ "$_fout" = "$required_output" -a $_rc = $required_rc ] ; then
-           _passed=true
-       else
-           _passed=false
-           _result=false
-       fi
-
-       result_print "$_passed" "$_out" "$_rc"
-    done
-
-    result_footer "$_result"
-}
-
 # Run an NFS eventscript iteratively.
 #
 # - 1st argument is the number of iterations.