test-lib: abort when can't remove trash directory
[gitweb.git] / t / test-lib.sh
index b021329e03eeef257afb8fb36a40644e000079b5..cb0766b9ee1e0f7fee4c3b1b1b983c06aa8b4908 100644 (file)
@@ -760,9 +760,12 @@ test_done () {
                        say "1..$test_count$skip_all"
                fi
 
-               test -d "$remove_trash" &&
+               test -d "$remove_trash" ||
+               error "Tests passed but trash directory already removed before test cleanup; aborting"
+
                cd "$(dirname "$remove_trash")" &&
-               rm -rf "$(basename "$remove_trash")"
+               rm -rf "$(basename "$remove_trash")" ||
+               error "Tests passed but test cleanup failed; aborting"
 
                test_at_end_hook_
 
@@ -1106,6 +1109,10 @@ test_lazy_prereq NOT_ROOT '
        test "$uid" != 0
 '
 
+test_lazy_prereq JGIT '
+       type jgit
+'
+
 # SANITY is about "can you correctly predict what the filesystem would
 # do by only looking at the permission bits of the files and
 # directories?"  A typical example of !SANITY is running the test