Re: [PATCH] test: run emacs inside tmux if screen is not available
[notmuch-archives.git] / ad / 8de51510f96ba71ce55074539188abfb44651e
1 Return-Path: <dmitry.kurochkin@gmail.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 18A35429E21\r
6         for <notmuch@notmuchmail.org>; Wed, 20 Jul 2011 06:37:45 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id nqyHMDMZU6mR for <notmuch@notmuchmail.org>;\r
17         Wed, 20 Jul 2011 06:37:42 -0700 (PDT)\r
18 Received: from mail-ew0-f53.google.com (mail-ew0-f53.google.com\r
19         [209.85.215.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 76AEF431FB6\r
22         for <notmuch@notmuchmail.org>; Wed, 20 Jul 2011 06:37:42 -0700 (PDT)\r
23 Received: by ewy8 with SMTP id 8so614462ewy.26\r
24         for <notmuch@notmuchmail.org>; Wed, 20 Jul 2011 06:37:41 -0700 (PDT)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
26         h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
27         :mime-version:content-type;\r
28         bh=MFwI0sifZiBXIp6MtaKmOgIdlqX8JXhxLGWA5NGWIvE=;\r
29         b=kcM1YDoFYqERdcdk81k7ReA8KBIB4OpjqH90VX/5Nw/T3Mt5pT5RAOfS+/hDrYR0aj\r
30         rSNwUKuQf6CIxnETYTMs10/PvwLVu5MmPmTXyoVsAiOZMS2ImTYxmb5fcf/mpnyg6hZx\r
31         vf/rbxCquz73SEY6nTdV544V4KoOJQffL/S4A=\r
32 Received: by 10.213.9.201 with SMTP id m9mr637988ebm.64.1311169060958;\r
33         Wed, 20 Jul 2011 06:37:40 -0700 (PDT)\r
34 Received: from localhost ([91.144.186.21])\r
35         by mx.google.com with ESMTPS id n42sm554697eef.36.2011.07.20.06.37.39\r
36         (version=TLSv1/SSLv3 cipher=OTHER);\r
37         Wed, 20 Jul 2011 06:37:40 -0700 (PDT)\r
38 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
39 To: Thomas Jost <schnouki@schnouki.net>, notmuch@notmuchmail.org\r
40 Subject: Re: [PATCH] test: run emacs inside tmux if screen is not available\r
41 In-Reply-To: <1311165396-12268-1-git-send-email-schnouki@schnouki.net>\r
42 References: <1309496122-4965-2-git-send-email-dmitry.kurochkin@gmail.com>\r
43         <1311165396-12268-1-git-send-email-schnouki@schnouki.net>\r
44 User-Agent: Notmuch/0.5-321-g41686e2 (http://notmuchmail.org) Emacs/23.3.1\r
45         (x86_64-pc-linux-gnu)\r
46 Date: Wed, 20 Jul 2011 17:37:35 +0400\r
47 Message-ID: <87d3h5ul7k.fsf@gmail.com>\r
48 MIME-Version: 1.0\r
49 Content-Type: text/plain; charset=us-ascii\r
50 X-BeenThere: notmuch@notmuchmail.org\r
51 X-Mailman-Version: 2.1.13\r
52 Precedence: list\r
53 List-Id: "Use and development of the notmuch mail system."\r
54         <notmuch.notmuchmail.org>\r
55 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
56         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
57 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
58 List-Post: <mailto:notmuch@notmuchmail.org>\r
59 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
60 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
61         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
62 X-List-Received-Date: Wed, 20 Jul 2011 13:37:45 -0000\r
63 \r
64 Hi Thomas.\r
65 \r
66 On Wed, 20 Jul 2011 14:36:36 +0200, Thomas Jost <schnouki@schnouki.net> wrote:\r
67 > Before this change, the test suite reported many failed tests on machines where\r
68 > screen is not installed (which is the case of many *BSD systems). This patch\r
69 > makes the test suite try to use tmux, another terminal multiplexer, if screen is\r
70 > not available.\r
71 \r
72 This is a nice improvement.  But I think we should make it even better :)\r
73 There are more terminal emulators besides screen and tmux (dtach comes\r
74 to mind).  We need a more general mechanism for trying them.  There\r
75 should be a list of commands for running terminal emulators in the order\r
76 of preference (I think that is dtach, tmux, screen), and we should try\r
77 each one in a loop (this would also avoid repeating the long emacs\r
78 command).\r
79 \r
80 Regards,\r
81   Dmitry\r
82 \r
83 > ---\r
84 >  test/test-lib.sh |   13 +++++++++++--\r
85 >  1 files changed, 11 insertions(+), 2 deletions(-)\r
86\r
87 > diff --git a/test/test-lib.sh b/test/test-lib.sh\r
88 > index 0608e42..5851b3d 100755\r
89 > --- a/test/test-lib.sh\r
90 > +++ b/test/test-lib.sh\r
91 > @@ -860,12 +860,21 @@ EOF\r
92 >  test_emacs () {\r
93 >       if [ -z "$EMACS_SERVER" ]; then\r
94 >               EMACS_SERVER="notmuch-test-suite-$$"\r
95 > -             # start a detached screen session with an emacs server\r
96 > +             # start a detached screen or tmux session with an emacs server\r
97 >               screen -S "$EMACS_SERVER" -d -m "$TMP_DIRECTORY/run_emacs" \\r
98 >                       --no-window-system \\r
99 >                       --eval "(setq server-name \"$EMACS_SERVER\")" \\r
100 >                       --eval '(server-start)' \\r
101 > -                     --eval "(orphan-watchdog $$)" || return\r
102 > +                     --eval "(orphan-watchdog $$)"\r
103 > +             if [ "$?" != 0 ]\r
104 > +             then\r
105 > +                     tmux -f /dev/null -L "$EMACS_SERVER" new-session -d "$TMP_DIRECTORY/run_emacs \\r
106 > +                             --no-window-system \\r
107 > +                             --eval \"(setq server-name \\\"$EMACS_SERVER\\\")\" \\r
108 > +                             --eval '(server-start)' \\r
109 > +                             --eval \"(orphan-watchdog $$)\"" || return\r
110 > +             fi\r
111 > +\r
112 >               # wait until the emacs server is up\r
113 >               until test_emacs '()' 2>/dev/null; do\r
114 >                       sleep 1\r
115 > -- \r
116 > 1.7.6\r
117\r