[PATCH v2 02/10] test: set EMACS_SERVER variable only after dtach(1) was successfully...
authorDmitry Kurochkin <dmitry.kurochkin@gmail.com>
Thu, 17 Nov 2011 13:05:55 +0000 (17:05 +0400)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:40:17 +0000 (09:40 -0800)
01/c70eb860fe4dc043cf1c8fb2b4c1535e6db989 [new file with mode: 0644]

diff --git a/01/c70eb860fe4dc043cf1c8fb2b4c1535e6db989 b/01/c70eb860fe4dc043cf1c8fb2b4c1535e6db989
new file mode 100644 (file)
index 0000000..5d09aa1
--- /dev/null
@@ -0,0 +1,126 @@
+Return-Path: <dmitry.kurochkin@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 00D1E429E37\r
+       for <notmuch@notmuchmail.org>; Thu, 17 Nov 2011 05:06:30 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id NFTGMsL9jdtD for <notmuch@notmuchmail.org>;\r
+       Thu, 17 Nov 2011 05:06:29 -0800 (PST)\r
+Received: from mail-bw0-f53.google.com (mail-bw0-f53.google.com\r
+       [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id EEB14429E28\r
+       for <notmuch@notmuchmail.org>; Thu, 17 Nov 2011 05:06:28 -0800 (PST)\r
+Received: by mail-bw0-f53.google.com with SMTP id q10so2108290bka.26\r
+       for <notmuch@notmuchmail.org>; Thu, 17 Nov 2011 05:06:28 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+       h=from:to:subject:date:message-id:x-mailer:in-reply-to:references;\r
+       bh=zIFBh11+2n2NCyUwB6pKZvOchxenrFQQGCqoekohCMM=;\r
+       b=d2zWyoKDBnsuErTszyfbZEThkDKqVUE/bbcNE+bkmelHFJL1t/7MK5khclEmJMLB6x\r
+       LtAOS5yK5PVp3GEAyJswqQJDIHOezSScutE1+HJBQKF5B9Z49l/sgxb1cTLM6b0ictDA\r
+       UADNnA24PqI5PzrJRTWyd/UAyOkQJfCjE20tA=\r
+Received: by 10.204.37.79 with SMTP id w15mr33517702bkd.4.1321535188690;\r
+       Thu, 17 Nov 2011 05:06:28 -0800 (PST)\r
+Received: from localhost ([91.144.186.21])\r
+       by mx.google.com with ESMTPS id e18sm20413112bkr.15.2011.11.17.05.06.27\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Thu, 17 Nov 2011 05:06:27 -0800 (PST)\r
+From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 02/10] test: set EMACS_SERVER variable only after dtach(1)\r
+       was successfully started\r
+Date: Thu, 17 Nov 2011 17:05:55 +0400\r
+Message-Id: <1321535163-4895-3-git-send-email-dmitry.kurochkin@gmail.com>\r
+X-Mailer: git-send-email 1.7.7.2\r
+In-Reply-To: <1321535163-4895-1-git-send-email-dmitry.kurochkin@gmail.com>\r
+References: <1321535163-4895-1-git-send-email-dmitry.kurochkin@gmail.com>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 17 Nov 2011 13:06:30 -0000\r
+\r
+Otherwise, we can set the EMACS_SERVER and return with an error.  And\r
+subsequent calls to test_emacs would assume that emacs server is running.\r
+---\r
+ test/test-lib.sh |    5 +++--\r
+ 1 files changed, 3 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/test/test-lib.sh b/test/test-lib.sh\r
+index 222b5e4..ff85848 100755\r
+--- a/test/test-lib.sh\r
++++ b/test/test-lib.sh\r
+@@ -823,50 +823,51 @@ export NOTMUCH_CONFIG=$NOTMUCH_CONFIG\r
+ # Here's what we are using here:\r
+ #\r
+ # --no-init-file      Don't load users ~/.emacs\r
+ #\r
+ # --no-site-file      Don't load the site-wide startup stuff\r
+ #\r
+ # --directory         Ensure that the local elisp sources are found\r
+ #\r
+ # --load              Force loading of notmuch.el and test-lib.el\r
\r
+ exec emacs --no-init-file --no-site-file \\r
+       --directory "$TEST_DIRECTORY/../emacs" --load notmuch.el \\r
+       --directory "$TEST_DIRECTORY" --load test-lib.el \\r
+       "\$@"\r
+ EOF\r
+       chmod a+x "$TMP_DIRECTORY/run_emacs"\r
+ }\r
\r
+ test_emacs () {\r
+       if [ -z "$EMACS_SERVER" ]; then\r
+-              EMACS_SERVER="notmuch-test-suite-$$"\r
++              server_name="notmuch-test-suite-$$"\r
+               # start a detached session with an emacs server\r
+               # user's TERM is given to dtach which assumes a minimally\r
+               # VT100-compatible terminal -- and emacs inherits that\r
+               TERM=$ORIGINAL_TERM dtach -n "$TMP_DIRECTORY/emacs-dtach-socket.$$" \\r
+                       sh -c "stty rows 24 cols 80; exec '$TMP_DIRECTORY/run_emacs' \\r
+                               --no-window-system \\r
+-                              --eval '(setq server-name \"$EMACS_SERVER\")' \\r
++                              --eval '(setq server-name \"$server_name\")' \\r
+                               --eval '(server-start)' \\r
+                               --eval '(orphan-watchdog $$)'" || return\r
++              EMACS_SERVER="$server_name"\r
+               # wait until the emacs server is up\r
+               until test_emacs '()' 2>/dev/null; do\r
+                       sleep 1\r
+               done\r
+       fi\r
\r
+       emacsclient --socket-name="$EMACS_SERVER" --eval "(progn $@)"\r
+ }\r
\r
+ test_reset_state_ () {\r
+       test_subtest_known_broken_=\r
+ }\r
\r
\r
+ find_notmuch_path ()\r
+ {\r
+     dir="$1"\r
\r
+     while [ -n "$dir" ]; do\r
+       bin="$dir/notmuch"\r
+-- \r
+1.7.7.2\r
+\r