qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 12/19] qemu-iotests: drop unused _within_tolerance() filter
Date: Fri, 15 Apr 2016 19:02:15 +0200	[thread overview]
Message-ID: <1460739742-5315-13-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1460739742-5315-1-git-send-email-kwolf@redhat.com>

From: Sascha Silbe <silbe@linux.vnet.ibm.com>

_within_tolerance() isn't used anymore and possibly creates temporary
files at predictable, world-writable locations. Get rid of it.

If it's needed again in the future it can be revived easily and fixed up
to use TEST_DIR and / or safely created temporary files.

Signed-off-by: Sascha Silbe <silbe@linux.vnet.ibm.com>
Reviewed-by: Bo Tu <tubo@linux.vnet.ibm.com>
Message-id: 1460472980-26319-2-git-send-email-silbe@linux.vnet.ibm.com
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 tests/qemu-iotests/common.filter | 101 ---------------------------------------
 1 file changed, 101 deletions(-)

diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
index 84b7434..8a6e1b5 100644
--- a/tests/qemu-iotests/common.filter
+++ b/tests/qemu-iotests/common.filter
@@ -19,107 +19,6 @@
 # standard filters
 #
 
-# Checks that given_value is in range of correct_value +/- tolerance.
-# Tolerance can be an absolute value or a percentage of the correct value
-# (see examples with tolerances below).
-# Outputs suitable message to stdout if it's not in range.
-#
-# A verbose option, -v, may be used as the LAST argument
-#
-# e.g.
-# foo: 0.0298 = 0.03 +/- 5%
-# _within_tolerance "foo" 0.0298 0.03 5%
-#
-# foo: 0.0298 = 0.03 +/- 0.01
-# _within_tolerance "foo" 0.0298 0.03 0.01
-#
-# foo: 0.0298 = 0.03 -0.01 +0.002
-# _within_tolerance "foo" 0.0298 0.03 0.01 0.002
-#
-# foo: verbose output of 0.0298 = 0.03 +/- 5%
-# _within_tolerance "foo" 0.0298 0.03 5% -v
-_within_tolerance()
-{
-  _name=$1
-  _given_val=$2
-  _correct_val=$3
-  _mintol=$4
-  _maxtol=$_mintol
-  _verbose=0
-  _debug=false
-
-  # maxtol arg is optional
-  # verbose arg is optional
-  if [ $# -ge 5 ]
-  then
-     if [ "$5" = "-v" ]
-     then
-        _verbose=1
-     else
-        _maxtol=$5
-     fi
-  fi
-  if [ $# -ge 6 ]
-  then
-     [ "$6" = "-v" ] && _verbose=1
-  fi
-
-  # find min with or without %
-  _mintolerance=`echo $_mintol | sed -e 's/%//'`
-  if [ $_mintol = $_mintolerance ]
-  then
-      _min=`echo "scale=5; $_correct_val-$_mintolerance" | bc`
-  else
-      _min=`echo "scale=5; $_correct_val-$_mintolerance*0.01*$_correct_val" | bc`
-  fi
-
-  # find max with or without %
-  _maxtolerance=`echo $_maxtol | sed -e 's/%//'`
-  if [ $_maxtol = $_maxtolerance ]
-  then
-      _max=`echo "scale=5; $_correct_val+$_maxtolerance" | bc`
-  else
-      _max=`echo "scale=5; $_correct_val+$_maxtolerance*0.01*$_correct_val" | bc`
-  fi
-
-  $_debug && echo "min = $_min"
-  $_debug && echo "max = $_max"
-
-  cat <<EOF >$tmp.bc.1
-scale=5;
-if ($_min <= $_given_val) 1;
-if ($_min > $_given_val) 0;
-EOF
-
-  cat <<EOF >$tmp.bc.2
-scale=5;
-if ($_given_val <= $_max) 1;
-if ($_given_val > $_max) 0;
-EOF
-
-  _above_min=`bc <$tmp.bc.1`
-  _below_max=`bc <$tmp.bc.2`
-
-  rm -f $tmp.bc.[12]
-
-  _in_range=`expr $_above_min \& $_below_max`
-
-  # fix up min, max precision for output
-  # can vary for 5.3, 6.2
-  _min=`echo $_min | sed -e 's/0*$//'` # get rid of trailling zeroes
-  _max=`echo $_max | sed -e 's/0*$//'` # get rid of trailling zeroes
-
-  if [ $_in_range -eq 1 ]
-  then
-        [ $_verbose -eq 1 ] && echo $_name is in range
-        return 0
-  else
-        [ $_verbose -eq 1 ] && echo $_name has value of $_given_val
-        [ $_verbose -eq 1 ] && echo $_name is NOT in range $_min .. $_max
-        return 1
-  fi
-}
-
 # ctime(3) dates
 #
 _filter_date()
-- 
1.8.3.1

  parent reply	other threads:[~2016-04-15 17:03 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-15 17:02 [Qemu-devel] [PULL 00/19] Block layer patches for 2.6.0-rc3 Kevin Wolf
2016-04-15 17:02 ` [Qemu-devel] [PULL 01/19] qemu-io: Support 'aio_write -z' Kevin Wolf
2016-04-15 17:02 ` [Qemu-devel] [PULL 02/19] block: Fix blk_aio_write_zeroes() Kevin Wolf
2016-04-15 17:02 ` [Qemu-devel] [PULL 03/19] block/vpc: set errp in vpc_create Kevin Wolf
2016-04-15 17:02 ` [Qemu-devel] [PULL 04/19] vpc: use current_size field for XenServer VHD images Kevin Wolf
2016-04-15 17:02 ` [Qemu-devel] [PULL 05/19] block/vpc: use current_size field for XenConverter " Kevin Wolf
2016-04-15 17:02 ` [Qemu-devel] [PULL 06/19] block/vpc: Use the correct max sector count for " Kevin Wolf
2016-04-15 17:02 ` [Qemu-devel] [PULL 07/19] block/vpc: make checks on max table size a bit more lax Kevin Wolf
2016-04-15 17:02 ` [Qemu-devel] [PULL 08/19] block/vpc: set errp in vpc_open Kevin Wolf
2016-04-15 17:02 ` [Qemu-devel] [PULL 09/19] block/vpc: update comments to be compliant w/coding guidelines Kevin Wolf
2016-04-15 17:02 ` [Qemu-devel] [PULL 10/19] block: Don't ignore flags in blk_{, co, aio}_write_zeroes() Kevin Wolf
2016-04-15 17:02 ` [Qemu-devel] [PULL 11/19] Fix pflash migration Kevin Wolf
2016-04-15 17:02 ` Kevin Wolf [this message]
2016-04-15 17:02 ` [Qemu-devel] [PULL 13/19] qemu-iotests: common.rc: drop unused _do() Kevin Wolf
2016-04-15 17:02 ` [Qemu-devel] [PULL 14/19] qemu-iotests: tests: do not set unused tmp variable Kevin Wolf
2016-04-15 17:02 ` [Qemu-devel] [PULL 15/19] qemu-iotests: place valgrind log file in scratch dir Kevin Wolf
2016-04-15 17:02 ` [Qemu-devel] [PULL 16/19] qemu-iotests: 041: More robust assertion on quorum node Kevin Wolf
2016-04-15 17:02 ` [Qemu-devel] [PULL 17/19] nbd: Don't fail handshake on NBD_OPT_LIST descriptions Kevin Wolf
2016-04-15 17:02 ` [Qemu-devel] [PULL 18/19] nbd: fix assert() on qemu-nbd stop Kevin Wolf
2016-04-15 17:02 ` [Qemu-devel] [PULL 19/19] nbd: Don't kill server on client that doesn't request TLS Kevin Wolf
2016-04-18  8:54 ` [Qemu-devel] [PULL 00/19] Block layer patches for 2.6.0-rc3 Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1460739742-5315-13-git-send-email-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).