aboutsummaryrefslogtreecommitdiffstats
path: root/tests/zfs-tests/include/math.shlib
diff options
context:
space:
mode:
authorJohn Wren Kennedy <[email protected]>2017-04-05 20:18:22 -0400
committerBrian Behlendorf <[email protected]>2017-04-06 09:25:36 -0700
commitc1d9abf9059a19c2b48eaa645dbce2e1fba3e0b1 (patch)
treee10f847d69d44292b0b641324cc5007b8c4badff /tests/zfs-tests/include/math.shlib
parent7a4500a10102c00a67442628df2ac2395484757e (diff)
OpenZFS 7290 - ZFS test suite needs to control what utilities it can run
Authored by: John Wren Kennedy <[email protected]> Reviewed by: Dan Kimmel <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: Dan McDonald <[email protected]> Approved by: Gordon Ross <[email protected]> Ported-by: Brian Behlendorf <[email protected]> Ported-by: George Melikov <[email protected]> Porting Notes: - Utilities which aren't available under Linux have been removed. - Because of sudo's default secure path behavior PATH must be explicitly reset at the top of libtest.shlib. This avoids the need for all users to customize secure path on their system. - Updated ZoL infrastructure to manage constrained path - Updated all test cases - Check permissions for usergroup tests - When testing in-tree create links under bin/ - Update fault cleanup such that missing files during cleanup aren't fatal. - Configure su environment with constrained path OpenZFS-issue: https://www.illumos.org/issues/7290 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/1d32ba6 Closes #5903
Diffstat (limited to 'tests/zfs-tests/include/math.shlib')
-rw-r--r--tests/zfs-tests/include/math.shlib8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/zfs-tests/include/math.shlib b/tests/zfs-tests/include/math.shlib
index 38479d352..ca1cbcb4e 100644
--- a/tests/zfs-tests/include/math.shlib
+++ b/tests/zfs-tests/include/math.shlib
@@ -10,7 +10,7 @@
#
#
-# Copyright (c) 2012 by Delphix. All rights reserved.
+# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
#
@@ -30,14 +30,14 @@ function within_percent
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
}