aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/Makefile1
-rwxr-xr-xt/t5000-tar-tree.sh6
-rwxr-xr-xt/t6002-rev-list-bisect.sh29
3 files changed, 17 insertions, 19 deletions
diff --git a/t/Makefile b/t/Makefile
index a6b80882c..e71da7782 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -5,6 +5,7 @@
#GIT_TEST_OPTS=--verbose --debug
SHELL_PATH ?= $(SHELL)
+TAR ?= $(TAR)
T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index 6bf34066e..5dffb8e1e 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -50,7 +50,7 @@ test_expect_success \
test_expect_success \
'validate file modification time' \
- 'TZ=GMT tar tvf b.tar a/a |
+ 'TZ=GMT $TAR tvf b.tar a/a |
awk \{print\ \$4,\ \(length\(\$5\)\<7\)\ ?\ \$5\":00\"\ :\ \$5\} \
>b.mtime &&
echo "2005-05-27 22:00:00" >expected.mtime &&
@@ -63,7 +63,7 @@ test_expect_success \
test_expect_success \
'extract tar archive' \
- '(cd b && tar xf -) <b.tar'
+ '(cd b && $TAR xf -) <b.tar'
test_expect_success \
'validate filenames' \
@@ -80,7 +80,7 @@ test_expect_success \
test_expect_success \
'extract tar archive with prefix' \
- '(cd c && tar xf -) <c.tar'
+ '(cd c && $TAR xf -) <c.tar'
test_expect_success \
'validate filenames with prefix' \
diff --git a/t/t6002-rev-list-bisect.sh b/t/t6002-rev-list-bisect.sh
index d0a4ff29c..42fcbc60c 100755
--- a/t/t6002-rev-list-bisect.sh
+++ b/t/t6002-rev-list-bisect.sh
@@ -7,20 +7,6 @@ test_description='Tests git-rev-list --bisect functionality'
. ./test-lib.sh
. ../t6000lib.sh # t6xxx specific functions
-bc_expr()
-{
-bc <<EOF
-scale=1
-define abs(x) {
- if (x>=0) { return (x); } else { return (-x); }
-}
-define floor(x) {
- save=scale; scale=0; result=x/1; scale=save; return (result);
-}
-$*
-EOF
-}
-
# usage: test_bisection max-diff bisect-option head ^prune...
#
# e.g. test_bisection 1 --bisect l1 ^l0
@@ -35,8 +21,19 @@ test_bisection_diff()
_head=$1
shift 1
_bisection_size=$(git-rev-list $_bisection "$@" | wc -l)
- [ -n "$_list_size" -a -n "$_bisection_size" ] || error "test_bisection_diff failed"
- test_expect_success "bisection diff $_bisect_option $_head $* <= $_max_diff" "[ $(bc_expr "floor(abs($_list_size/2)-$_bisection_size)") -le $_max_diff ]"
+ [ -n "$_list_size" -a -n "$_bisection_size" ] ||
+ error "test_bisection_diff failed"
+
+ # Test if bisection size is close to half of list size within
+ # tolerance.
+ #
+ _bisect_err=`expr $_list_size - $_bisection_size \* 2`
+ test "$_bisect_err" -lt 0 && _bisect_err=`expr 0 - $_bisect_err`
+ _bisect_err=`expr $_bisect_err / 2` ; # floor
+
+ test_expect_success \
+ "bisection diff $_bisect_option $_head $* <= $_max_diff" \
+ 'test $_bisect_err -le $_max_diff'
}
date >path0