From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 3D1C8429E36 for ; Thu, 17 Nov 2011 05:06:40 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bUdZB6RgIQdR for ; Thu, 17 Nov 2011 05:06:39 -0800 (PST) Received: from mail-fx0-f53.google.com (mail-fx0-f53.google.com [209.85.161.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 53A67429E2F for ; Thu, 17 Nov 2011 05:06:39 -0800 (PST) Received: by faan15 with SMTP id n15so3326105faa.26 for ; Thu, 17 Nov 2011 05:06:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:x-mailer:in-reply-to:references; bh=wuThNI7vv8goKWzsdP9yQ1hr/34FKbmHpX9NrigUlXo=; b=cATBJZPQb95IqINeyaeHQycYvNQ0QRSxxBx/l6XzUmVBGmtmydWS4ebwyklTy3twAC tmFQ4scObihiCBHHdqKCmVfXoK4VB2G+sKvHSyMLOoiRDZT1Lzd5F3s03pF8ANxsQCru rEyPsezXwQfYZZ86RqdcYql6xp1ZFsIqX3LwE= Received: by 10.204.157.27 with SMTP id z27mr33506983bkw.8.1321535198121; Thu, 17 Nov 2011 05:06:38 -0800 (PST) Received: from localhost ([91.144.186.21]) by mx.google.com with ESMTPS id j9sm41234603bkd.2.2011.11.17.05.06.36 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 17 Nov 2011 05:06:37 -0800 (PST) From: Dmitry Kurochkin To: notmuch@notmuchmail.org Subject: [PATCH v2 06/10] test: skip all subtests if external dependencies are missing during init Date: Thu, 17 Nov 2011 17:05:59 +0400 Message-Id: <1321535163-4895-7-git-send-email-dmitry.kurochkin@gmail.com> X-Mailer: git-send-email 1.7.7.2 In-Reply-To: <1321535163-4895-1-git-send-email-dmitry.kurochkin@gmail.com> References: <1321535163-4895-1-git-send-email-dmitry.kurochkin@gmail.com> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Nov 2011 13:06:40 -0000 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. --- test/test-lib.sh | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/test/test-lib.sh b/test/test-lib.sh index ce7576a..4c73437 100755 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -880,44 +880,54 @@ test_emacs () { # start a detached session with an emacs server # user's TERM is given to dtach which assumes a minimally # VT100-compatible terminal -- and emacs inherits that TERM=$ORIGINAL_TERM dtach -n "$TMP_DIRECTORY/emacs-dtach-socket.$$" \ sh -c "stty rows 24 cols 80; exec '$TMP_DIRECTORY/run_emacs' \ --no-window-system \ --eval '(setq server-name \"$server_name\")' \ --eval '(server-start)' \ --eval '(orphan-watchdog $$)'" || return EMACS_SERVER="$server_name" # wait until the emacs server is up until test_emacs '()' 2>/dev/null; do sleep 1 done fi emacsclient --socket-name="$EMACS_SERVER" --eval "(progn $@)" } 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 () { dir="$1" while [ -n "$dir" ]; do bin="$dir/notmuch" if [ -x "$bin" ]; then echo "$dir" return fi dir="$(dirname "$dir")" if [ "$dir" = "/" ]; then break fi done } # Test the binaries we have just built. The tests are kept in # test/ subdirectory and are run in 'trash directory' subdirectory. -- 1.7.7.2