aboutsummaryrefslogtreecommitdiff
path: root/test/test-lib.sh
diff options
context:
space:
mode:
authorDmitry Kurochkin <dmitry.kurochkin@gmail.com>2011-11-27 22:36:15 +0400
committerDavid Bremner <bremner@debian.org>2011-11-27 11:32:11 -0800
commitf3254667283bc51b97a2d35aa8438420528ba9b3 (patch)
tree5ed004994e0d3efd4e59d3f4fd5153243e89ce89 /test/test-lib.sh
parent5b37fb1e25aafc97edfe12850980febc2e32312c (diff)
test: skip all subtests if external dependencies are missing during init
Some tests (e.g. crypto) do a common initialization required for all subtests. The patch adds a check for missing external dependencies during this initialization. If any prerequisites are missing, all subtests are skipped. The check is run on the first call of test_reset_state_ function, so no changes for the tests are needed.
Diffstat (limited to 'test/test-lib.sh')
-rw-r--r--test/test-lib.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/test-lib.sh b/test/test-lib.sh
index df867a5..99b9e8b 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -902,10 +902,20 @@ test_emacs () {
}
test_reset_state_ () {
+ test -z "$test_init_done_" && test_init_
+
test_subtest_known_broken_=
test_subtest_missing_external_prereqs_=
}
+# called once before the first subtest
+test_init_ () {
+ test_init_done_=t
+
+ # skip all tests if there were external prerequisites missing during init
+ test_check_missing_external_prereqs_ "all tests in $this_test" && test_done
+}
+
find_notmuch_path ()
{