about summary refs log tree commit homepage
path: root/t/test-lib.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/test-lib.sh')
-rw-r--r--t/test-lib.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 9e67d1d..d28eaa0 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -134,6 +134,16 @@ rainbows_wait_start () {
         rainbows_pid=$(cat $pid)
 }
 
+rsha1 () {
+        _cmd="$(which sha1sum 2>/dev/null || :)"
+        test -n "$_cmd" || _cmd="$(which openssl 2>/dev/null || :) sha1"
+        test "$_cmd" != " sha1" || _cmd="$(which gsha1sum 2>/dev/null || :)"
+
+        # last resort, see comments in sha1sum.rb for reasoning
+        test -n "$_cmd" || _cmd=sha1sum.rb
+        expr "$($_cmd < random_blob)" : '\([a-f0-9]\{40\}\)'
+}
+
 case $model in
 Rev) require_check rev Rev::VERSION ;;
 Revactor) require_check revactor Revactor::VERSION ;;