Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 00D1E429E37 for ; Thu, 17 Nov 2011 05:06:30 -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 NFTGMsL9jdtD for ; Thu, 17 Nov 2011 05:06:29 -0800 (PST) Received: from mail-bw0-f53.google.com (mail-bw0-f53.google.com [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id EEB14429E28 for ; Thu, 17 Nov 2011 05:06:28 -0800 (PST) Received: by mail-bw0-f53.google.com with SMTP id q10so2108290bka.26 for ; Thu, 17 Nov 2011 05:06:28 -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=zIFBh11+2n2NCyUwB6pKZvOchxenrFQQGCqoekohCMM=; b=d2zWyoKDBnsuErTszyfbZEThkDKqVUE/bbcNE+bkmelHFJL1t/7MK5khclEmJMLB6x LtAOS5yK5PVp3GEAyJswqQJDIHOezSScutE1+HJBQKF5B9Z49l/sgxb1cTLM6b0ictDA UADNnA24PqI5PzrJRTWyd/UAyOkQJfCjE20tA= Received: by 10.204.37.79 with SMTP id w15mr33517702bkd.4.1321535188690; Thu, 17 Nov 2011 05:06:28 -0800 (PST) Received: from localhost ([91.144.186.21]) by mx.google.com with ESMTPS id e18sm20413112bkr.15.2011.11.17.05.06.27 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 17 Nov 2011 05:06:27 -0800 (PST) From: Dmitry Kurochkin To: notmuch@notmuchmail.org Subject: [PATCH v2 02/10] test: set EMACS_SERVER variable only after dtach(1) was successfully started Date: Thu, 17 Nov 2011 17:05:55 +0400 Message-Id: <1321535163-4895-3-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:30 -0000 Otherwise, we can set the EMACS_SERVER and return with an error. And subsequent calls to test_emacs would assume that emacs server is running. --- test/test-lib.sh | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/test/test-lib.sh b/test/test-lib.sh index 222b5e4..ff85848 100755 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -823,50 +823,51 @@ export NOTMUCH_CONFIG=$NOTMUCH_CONFIG # Here's what we are using here: # # --no-init-file Don't load users ~/.emacs # # --no-site-file Don't load the site-wide startup stuff # # --directory Ensure that the local elisp sources are found # # --load Force loading of notmuch.el and test-lib.el exec emacs --no-init-file --no-site-file \ --directory "$TEST_DIRECTORY/../emacs" --load notmuch.el \ --directory "$TEST_DIRECTORY" --load test-lib.el \ "\$@" EOF chmod a+x "$TMP_DIRECTORY/run_emacs" } test_emacs () { if [ -z "$EMACS_SERVER" ]; then - EMACS_SERVER="notmuch-test-suite-$$" + server_name="notmuch-test-suite-$$" # 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 \"$EMACS_SERVER\")' \ + --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_subtest_known_broken_= } find_notmuch_path () { dir="$1" while [ -n "$dir" ]; do bin="$dir/notmuch" -- 1.7.7.2