Print this page
7290 ZFS test suite needs to control what utilities it can run
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
@@ -8,11 +8,11 @@
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
-# Copyright (c) 2012 by Delphix. All rights reserved.
+# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
#
# Return 0 if the percentage difference between $a and $b is $percent or
# greater. Return 1 if the percentage is lower or if we would divide by
@@ -28,16 +28,16 @@
typeset a=$1
typeset b=$1
typeset percent=$3
# Set $a or $b to $2 such that a >= b
- [[ '1' = $($ECHO "if ($2 > $a) 1" | $BC) ]] && a=$2 || b=$2
+ [[ '1' = $(echo "if ($2 > $a) 1" | bc) ]] && a=$2 || b=$2
# Prevent division by 0
[[ $a =~ [1-9] ]] || return 1
- typeset p=$($ECHO "scale=2; $b * 100 / $a" | $BC)
+ typeset p=$(echo "scale=2; $b * 100 / $a" | bc)
log_note "Comparing $a and $b given $percent% (calculated: $p%)"
- [[ '1' = $($ECHO "scale=2; if ($p >= $percent) 1" | $BC) ]] && return 0
+ [[ '1' = $(echo "scale=2; if ($p >= $percent) 1" | bc) ]] && return 0
return 1
}