Re: [PATCH 0/9] test: (hopefully) better test prerequisites
authorDmitry Kurochkin <dmitry.kurochkin@gmail.com>
Thu, 17 Nov 2011 13:22:41 +0000 (17:22 +0400)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:40:17 +0000 (09:40 -0800)
dc/e2ce50aa6805a3583ebeee84136b818005ae92 [new file with mode: 0644]

diff --git a/dc/e2ce50aa6805a3583ebeee84136b818005ae92 b/dc/e2ce50aa6805a3583ebeee84136b818005ae92
new file mode 100644 (file)
index 0000000..92f19a3
--- /dev/null
@@ -0,0 +1,149 @@
+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 174F7429E28\r
+       for <notmuch@notmuchmail.org>; Thu, 17 Nov 2011 05:23:01 -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 AxR0puQ31Alj for <notmuch@notmuchmail.org>;\r
+       Thu, 17 Nov 2011 05:23:00 -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 42BCF429E27\r
+       for <notmuch@notmuchmail.org>; Thu, 17 Nov 2011 05:23:00 -0800 (PST)\r
+Received: by bkaq10 with SMTP id q10so2131907bka.26\r
+       for <notmuch@notmuchmail.org>; Thu, 17 Nov 2011 05:22:59 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+       h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
+       :mime-version:content-type;\r
+       bh=AGeJ/BdZFM5VjNJ5Ur3WmLeY9xeEZWq9XMmkWv5SNaE=;\r
+       b=oPphR0gaTUEIzoeBsvyrzh3vZyth8Y1eja/6cQ6ctIBHkTB+MIDn7JgP+CXAow0Jj9\r
+       btMM9V9btEPSThoZwJVcgmfM/4bM+BYrXm1CjPxF0Ld3EcDh/57fghW7kcX1GQoLH5HY\r
+       r2FuF1Jcii9EcXto+kn6PlB8ksHLWO3FjRTj0=\r
+Received: by 10.205.120.145 with SMTP id fy17mr22955868bkc.124.1321536178717; \r
+       Thu, 17 Nov 2011 05:22:58 -0800 (PST)\r
+Received: from localhost ([91.144.186.21])\r
+       by mx.google.com with ESMTPS id j16sm3850622bkv.14.2011.11.17.05.22.56\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Thu, 17 Nov 2011 05:22:57 -0800 (PST)\r
+From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
+To: Tomi Ollila <tomi.ollila@iki.fi>,\r
+       Jameson Graef Rollins <jrollins@finestructure.net>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 0/9] test: (hopefully) better test prerequisites\r
+In-Reply-To: <yf64ny3gcu4.fsf@taco2.nixu.fi>\r
+References: <1321494986-18998-1-git-send-email-dmitry.kurochkin@gmail.com>\r
+       <874ny36rhc.fsf@servo.finestructure.net>\r
+       <yf64ny3gcu4.fsf@taco2.nixu.fi>\r
+User-Agent: Notmuch/0.10_rc1+9~g8270095 (http://notmuchmail.org) Emacs/23.3.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Thu, 17 Nov 2011 17:22:41 +0400\r
+Message-ID: <8739dmopcu.fsf@gmail.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\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:23:01 -0000\r
+\r
+Hi Tomi.\r
+\r
+On Thu, 17 Nov 2011 14:20:19 +0200, Tomi Ollila <tomi.ollila@iki.fi> wrote:\r
+> On Thu, 17 Nov 2011 01:14:07 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:\r
+> > \r
+> > However, when I tried to test the tests with the patch applied I ran\r
+> > into one problem.  If I try to run the test suite with dtach\r
+> > uninstalled, it looks like I'm experiencing a hang on\r
+> > emacs_deliver_message call.  I wonder if either emacs_deliver_message or\r
+> > test_emacs is not doing the right thing in the case of no dtach.  I\r
+> > think emacs_deliver_message should somehow not require dtach, since it's\r
+> > not actually testing any display stuff, but because it's currently using\r
+> > test_emacs, it is somehow implicitly depending on it.  Any thoughts on\r
+> > how to fix that?\r
+> \r
+> Quick thought\r
+> \r
+> mk_skip_test_emacs () \r
+> { test_emacs () \r
+>   { \r
+>      echo SKIPPED\r
+>         false\r
+>   }\r
+>   test_emacs\r
+> }\r
+> \r
+> mk_run_test_emacs () \r
+> { test_emacs () \r
+>   {\r
+>      emacsclient --socket-name="$EMACS_SERVER" --eval "(progn $@)"\r
+>   }\r
+>   test_emacs\r
+> }\r
+> \r
+> test_emacs ()\r
+> {\r
+>         which dtach >/dev/null 2>&1 || { mk_skip_test_emacs; return; }\r
+>         which emacs >/dev/null 2>&1 || { mk_skip_test_emacs; return; }\r
+>         which emacsclient >/dev/null 2>&1 || { mk_skip_test_emacs; return; }\r
+> \r
+>         EMACS_SERVER="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 '(server-start)' \\r
+>                      --eval '(orphan-watchdog $$)'" ||\r
+>                         { mk_skip_test_emacs; return; }\r
+>      # wait until the emacs server is up\r
+>         for _ in 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 20 1 2 3 4 5 6 7 8 9 30\r
+>         do \r
+>              if test_emacs '()' 2>/dev/null\r
+>                 then\r
+>                         mk_run_test_emacs\r
+>                         return\r
+>                 fi\r
+>         done\r
+>         mk_skip_test_emacs\r
+> }\r
+> \r
+> I.e. dynamically, at run-time, re-create test_emacs function...\r
+> \r
+\r
+Could you please add some human-friendly description on what benefits\r
+the code above has? :)\r
+\r
+The only change I see (besides code refactoring) is 30sec timeout (BTW\r
+you can replace the list of numbers with "seq 30") instead of infinite\r
+wait loop.  Which may be a good, but unrelated change.\r
+\r
+As for re-creating functions dynamically, I find the above code more\r
+complex than the existing one.  I think the current code is more\r
+shell-style and easier to understand.  Just IMHO.\r
+\r
+Regards,\r
+  Dmitry\r
+\r
+> > \r
+> > jamie.\r
+> \r
+> Tomi\r