[PATCH 01/13] test: define a helper function for defining prereqs on executables
Thomas Jost
schnouki at schnouki.net
Mon Oct 3 09:47:15 PDT 2011
While test_expect_success could be used to define these prereqs, this is
probably not a good idea: if a prereq is not available, using
test_expect_success would result in a test being reported as FAILED at the end
of the test suite (and its dependencies as skipped).
On the contrary, when using test_set_bin_prereq, no test will be reported as
FAILED.
---
test/test-lib.sh | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/test/test-lib.sh b/test/test-lib.sh
index f8df6a5..8e16a7e 100755
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -542,6 +542,19 @@ test_have_prereq () {
esac
}
+test_set_bin_prereq () {
+ bin=$1
+ name=$2
+ prereq=$3
+ if which $bin &>/dev/null
+ then
+ test_set_prereq $prereq
+ else
+ say_color info "%-6s" "INFO"
+ echo " Missing test prerequisite: $name"
+ fi
+}
+
# You are not expected to call test_ok_ and test_failure_ directly, use
# the text_expect_* functions instead.
--
1.7.6.4
More information about the notmuch
mailing list