summaryrefslogtreecommitdiff
path: root/t/test-lib-functions.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/test-lib-functions.sh')
-rw-r--r--t/test-lib-functions.sh45
1 files changed, 45 insertions, 0 deletions
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index eef2262a36..c3d38aaccb 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -680,6 +680,17 @@ test_have_prereq () {
# Keep a list of missing prerequisites; restore
# the negative marker if necessary.
prerequisite=${negative_prereq:+!}$prerequisite
+
+ # Abort if this prereq was marked as required
+ if test -n "$GIT_TEST_REQUIRE_PREREQ"
+ then
+ case " $GIT_TEST_REQUIRE_PREREQ " in
+ *" $prerequisite "*)
+ BAIL_OUT "required prereq $prerequisite failed"
+ ;;
+ esac
+ fi
+
if test -z "$missing_prereq"
then
missing_prereq=$prerequisite
@@ -1749,6 +1760,40 @@ test_subcommand () {
}
# Check that the given command was invoked as part of the
+# trace2-format trace on stdin, but without an exact set of
+# arguments.
+#
+# test_subcommand [!] <command> <args>... < <trace>
+#
+# For example, to look for an invocation of "git pack-objects"
+# with the "--honor-pack-keep" argument, use
+#
+# GIT_TRACE2_EVENT=event.log git repack ... &&
+# test_subcommand git pack-objects --honor-pack-keep <event.log
+#
+# If the first parameter passed is !, this instead checks that
+# the given command was not called.
+#
+test_subcommand_inexact () {
+ local negate=
+ if test "$1" = "!"
+ then
+ negate=t
+ shift
+ fi
+
+ local expr=$(printf '"%s".*' "$@")
+ expr="${expr%,}"
+
+ if test -n "$negate"
+ then
+ ! grep "\"event\":\"child_start\".*\[$expr\]"
+ else
+ grep "\"event\":\"child_start\".*\[$expr\]"
+ fi
+}
+
+# Check that the given command was invoked as part of the
# trace2-format trace on stdin.
#
# test_region [!] <category> <label> git <command> <args>...