diff options
author | Junio C Hamano <junio@twinsun.com> | 2005-09-30 13:31:16 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2005-10-01 23:19:48 -0700 |
commit | 455a7f3275d264f6e66045b92c83747ec461dda5 (patch) | |
tree | 566b08d502b5cb82e0a72d485026a6707b2a73c3 /t/t6002-rev-list-bisect.sh | |
parent | 8098a178b26dc7a158d129a092a5b78da6d12b72 (diff) | |
download | git-455a7f3275d264f6e66045b92c83747ec461dda5.tar.gz |
More portability.
- The location of openssl development files got customizable.
- The location of iconv development files got customizable.
- Pass $TAR down to t5000 test so that the user can override with
'gmake TAR=gtar'.
- Solaris 'bc' does not seem to grok "define abs()". There is no
reason to use bc there -- expr would do.
Signed-off-by: Junio C Hamano <junio@twinsun.com>
Diffstat (limited to 't/t6002-rev-list-bisect.sh')
-rwxr-xr-x | t/t6002-rev-list-bisect.sh | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/t/t6002-rev-list-bisect.sh b/t/t6002-rev-list-bisect.sh index d0a4ff29c9..42fcbc60ca 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 |