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