Merge branch 'ew/update-server-info'
[gitweb.git] / t / test-lib-functions.sh
index 788ea1f18b99c5edacd9ae0ee81310141c799c6e..0367cec5fde0514274fbd322bce0a58e1438b3e8 100644 (file)
@@ -309,6 +309,26 @@ test_unset_prereq () {
 }
 
 test_set_prereq () {
+       if test -n "$GIT_TEST_FAIL_PREREQS"
+       then
+               case "$1" in
+               # The "!" case is handled below with
+               # test_unset_prereq()
+               !*)
+                       ;;
+               # (Temporary?) whitelist of things we can't easily
+               # pretend not to support
+               SYMLINKS)
+                       ;;
+               # Inspecting whether GIT_TEST_FAIL_PREREQS is on
+               # should be unaffected.
+               FAIL_PREREQS)
+                       ;;
+               *)
+                       return
+               esac
+       fi
+
        case "$1" in
        !*)
                test_unset_prereq "${1#!}"
@@ -1239,6 +1259,12 @@ depacketize () {
        '
 }
 
+# Converts base-16 data into base-8. The output is given as a sequence of
+# escaped octals, suitable for consumption by 'printf'.
+hex2oct () {
+       perl -ne 'printf "\\%03o", hex for /../g'
+}
+
 # Set the hash algorithm in use to $1.  Only useful when testing the testsuite.
 test_set_hash () {
        test_hash_algo="$1"