t/t7005-editor: change from skip_all=* to prereq skip
[gitweb.git] / t / test-lib.sh
index 0b9969ccf7e8f45e68abd522c501ded2bb861492..46179988a393761afed8013c67533658bdda657b 100644 (file)
@@ -332,15 +332,30 @@ test_have_prereq () {
        IFS=,
        set -- $*
        IFS=$save_IFS
+
+       total_prereq=0
+       ok_prereq=0
+       missing_prereq=
+
        for prerequisite
        do
+               total_prereq=$(($total_prereq + 1))
                case $satisfied in
                *" $prerequisite "*)
-                       : yes, have it ;;
+                       ok_prereq=$(($ok_prereq + 1))
+                       ;;
                *)
-                       ! : nope ;;
+                       # Keep a list of missing prerequisites
+                       if test -z "$missing_prereq"
+                       then
+                               missing_prereq=$prerequisite
+                       else
+                               missing_prereq="$prerequisite,$missing_prereq"
+                       fi
                esac
        done
+
+       test $total_prereq = $ok_prereq
 }
 
 # You are not expected to call test_ok_ and test_failure_ directly, use
@@ -403,7 +418,7 @@ test_skip () {
        case "$to_skip" in
        t)
                say_color skip >&3 "skipping test: $@"
-               say_color skip "ok $test_count # skip $1"
+               say_color skip "ok $test_count # skip $1 (missing $missing_prereq of $prereq)"
                : true
                ;;
        *)
@@ -897,3 +912,7 @@ test -z "$NO_PYTHON" && test_set_prereq PYTHON
 # test whether the filesystem supports symbolic links
 ln -s x y 2>/dev/null && test -h y 2>/dev/null && test_set_prereq SYMLINKS
 rm -f y
+
+# When the tests are run as root, permission tests will report that
+# things are writable when they shouldn't be.
+test -w / || test_set_prereq SANITY