aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-08-24 12:05:24 -0700
committerJunio C Hamano <gitster@pobox.com>2012-08-24 12:05:24 -0700
commitc247d76c5419df96db62f6e7c9cf4f672f24a727 (patch)
tree6a6a845bf33526fe5b4250d39944ae08bdf8fb15
parent47bc16b3fa96692102fc840f2d8bbdbbae97dd74 (diff)
parentd17cf5f3a32f07bf8a6b8fb014abfa8e87fd7075 (diff)
downloadgit-c247d76c5419df96db62f6e7c9cf4f672f24a727.tar.gz
git-c247d76c5419df96db62f6e7c9cf4f672f24a727.tar.xz
Merge branch 'mk/test-seq' into maint-1.7.11
Add a compatibility/utility function to the test framework. * mk/test-seq: tests: Introduce test_seq
-rw-r--r--t/perf/perf-lib.sh2
-rwxr-xr-xt/t5551-http-fetch.sh2
-rw-r--r--t/test-lib-functions.sh21
3 files changed, 23 insertions, 2 deletions
diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh
index 5580c2281..a1361e530 100644
--- a/t/perf/perf-lib.sh
+++ b/t/perf/perf-lib.sh
@@ -163,7 +163,7 @@ test_perf () {
else
echo "perf $test_count - $1:"
fi
- for i in $(seq 1 $GIT_PERF_REPEAT_COUNT); do
+ for i in $(test_seq 1 $GIT_PERF_REPEAT_COUNT); do
say >&3 "running: $2"
if test_run_perf_ "$2"
then
diff --git a/t/t5551-http-fetch.sh b/t/t5551-http-fetch.sh
index fadf2f258..91eaf53d1 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 `test_seq 50000`
do
echo "commit refs/heads/too-many-refs"
echo "mark :$i"
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 80daaca78..9096398b1 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -530,6 +530,27 @@ test_cmp() {
$GIT_TEST_CMP "$@"
}
+# Print a sequence of numbers or letters in increasing order. This is
+# similar to GNU seq(1), but the latter might not be available
+# everywhere (and does not do letters). It may be used like:
+#
+# for i in `test_seq 100`; do
+# for j in `test_seq 10 20`; do
+# for k in `test_seq a z`; do
+# echo $i-$j-$k
+# done
+# done
+# done
+
+test_seq () {
+ case $# in
+ 1) set 1 "$@" ;;
+ 2) ;;
+ *) error "bug in the test script: not 1 or 2 parameters to test_seq" ;;
+ esac
+ "$PERL_PATH" -le 'print for $ARGV[0]..$ARGV[1]' -- "$@"
+}
+
# This function can be used to schedule some commands to be run
# unconditionally at the end of the test to restore sanity:
#