On Thu, Aug 02, 2012 at 02:52:56PM -0700, Junio C Hamano wrote:

> > Seq is (unfortunately) not portable. I usually use a perl snippet
> > instead, like:
> >
> >   perl -le 'print for (1..10)'
> >
> > Though I think we are adjusting that to use $PERL_PATH these days.
> t/perf/perf-lib.sh and t/t5551-http-fetch.sh seem to use "seq";
> perhaps we should replace them, then.

Traditionally, BSD did not have seq (they have "jot" instead). However,
my OS X 10.7 box does have seq, and its manpage claims that it appeared
in FreeBSD 9.0. But we should be able to run the test suite on older
versions of both (9.0 is barely 6 months old).

I suspect people on those platforms did not notice because t5551 does
not run by default (not only due to the apache requirement, but you have
to set GIT_TEST_LONG to trigger the particular test that uses it), and
people don't typically run the perf code regularly to look for

-- >8 --
Subject: [PATCH] stop using 'seq' in test scripts

The seq command is GNU-ism, and is missing at least in older
BSD releases and their derivatives, not to mention antique
commercial Unixes.

We already purged it in b3431bc (Don't use seq in tests, not
everyone has it, 2007-05-02), but a few new instances have
crept in. They went unnoticed because they are in scripts
that are not run by default.

Let's replace them with a perl snippet (which we already
assume to be everywhere elsewhere in the test suite).
b3431bc used a while loop with increment to replace it, which we could
also do. I think the perl script is a little easier to read. If we
ever want to drop the perl dependency for the test suite, we could write
a 5-liner test-seq.c replacement.

 t/perf/perf-lib.sh    | 2 +-
 t/t5551-http-fetch.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh
index 5580c22..8bf8d69 100644
--- a/t/perf/perf-lib.sh
+++ b/t/perf/perf-lib.sh
@@ -163,7 +163,7 @@ test_perf () {
                        echo "perf $test_count - $1:"
-               for i in $(seq 1 $GIT_PERF_REPEAT_COUNT); do
+               for i in $("$PERL_PATH" -le "print for 
                        say >&3 "running: $2"
                        if test_run_perf_ "$2"
diff --git a/t/t5551-http-fetch.sh b/t/t5551-http-fetch.sh
index fadf2f2..e858a31 100755
--- a/t/t5551-http-fetch.sh
+++ b/t/t5551-http-fetch.sh
@@ -114,7 +114,7 @@ test -n "$GIT_TEST_LONG" && test_set_prereq EXPENSIVE
 test_expect_success EXPENSIVE 'create 50,000 tags in the repo' '
        cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
-       for i in `seq 50000`
+       for i in `"$PERL_PATH" -le "print for (1..50000)"`
                echo "commit refs/heads/too-many-refs"
                echo "mark :$i"
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to