Skip to content

Commit 0397bdf

Browse files
committedJun 3, 2015
Merge pull request #1329 from ipfs/implement-test-seq
ipfs-test-lib: implement test_seq()
2 parents 238fac5 + 59cac0a commit 0397bdf

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed
 

‎test/ipfs-test-lib.sh

+13
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,16 @@ test_sort_cmp() {
2222
sort "$2" >"$2_sorted" &&
2323
test_cmp "$1_sorted" "$2_sorted"
2424
}
25+
26+
# Depending on GNU seq availability is not nice.
27+
# Git also has test_seq but it uses Perl.
28+
test_seq() {
29+
test "$1" -le "$2" || return
30+
i="$1"
31+
j="$2"
32+
while test "$i" -le "$j"
33+
do
34+
echo "$i"
35+
i=$(expr "$i" + 1)
36+
done
37+
}

‎test/sharness/lib/test-lib.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ fi
5252
. ../../ipfs-test-lib.sh
5353

5454
test_cmp_repeat_10_sec() {
55-
for i in `seq 1 100`
55+
for i in $(test_seq 1 100)
5656
do
5757
test_cmp "$1" "$2" >/dev/null && return
5858
sleep 0.1
@@ -245,7 +245,7 @@ test_launch_ipfs_daemon_and_mount() {
245245
test_kill_repeat_10_sec() {
246246
# try to shut down once + wait for graceful exit
247247
kill $1
248-
for i in `seq 1 100`
248+
for i in $(test_seq 1 100)
249249
do
250250
sleep 0.1
251251
! kill -0 $1 2>/dev/null && return

0 commit comments

Comments
 (0)
Please sign in to comment.