From 339ab81f377ccb1d1acd08af0f30e095308c0b42 Mon Sep 17 00:00:00 2001 From: Tomi Ollila Date: Tue, 5 Jan 2016 22:58:43 +0200 Subject: [PATCH] Re: T070 tests portability --- 26/f6ac75f03ab027f27550cc62e20a2c386bd5fa | 116 ++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 26/f6ac75f03ab027f27550cc62e20a2c386bd5fa diff --git a/26/f6ac75f03ab027f27550cc62e20a2c386bd5fa b/26/f6ac75f03ab027f27550cc62e20a2c386bd5fa new file mode 100644 index 000000000..1136dcc77 --- /dev/null +++ b/26/f6ac75f03ab027f27550cc62e20a2c386bd5fa @@ -0,0 +1,116 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id 066896DE13AF + for ; Tue, 5 Jan 2016 12:58:30 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: 0.669 +X-Spam-Level: +X-Spam-Status: No, score=0.669 tagged_above=-999 required=5 tests=[AWL=0.017, + SPF_NEUTRAL=0.652] autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id oKf1xbKqNWtc for ; + Tue, 5 Jan 2016 12:58:27 -0800 (PST) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by arlo.cworth.org (Postfix) with ESMTP id CA5166DE138F + for ; Tue, 5 Jan 2016 12:58:26 -0800 (PST) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id 282CE1000CD; + Tue, 5 Jan 2016 22:58:44 +0200 (EET) +From: Tomi Ollila +To: J Farkas , + notmuch@notmuchmail.org +Subject: Re: T070 tests portability +In-Reply-To: <1451991305.14.acc64b88@201601.l2015aftruuq.dns007.net> +References: <1451991305.14.acc64b88@201601.l2015aftruuq.dns007.net> +User-Agent: Notmuch/0.21+32~g73439f8 (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.20 +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: Tue, 05 Jan 2016 20:58:30 -0000 + +On Tue, Jan 05 2016, J Farkas wrote: + +> I'm in the process of writing insert tests, but it looks like my +> environment is somewhat older than what the current tests are running +> on. The following two trivial changes for the original tests make those +> pass cleanly: +> +> The wc I have from GNU textutils 2.0.22 seems to produce extra +> whitespace that needs to be cleaned: +> +> diff --git a/test/T070-insert.sh b/test/T070-insert.sh +> index e7ec6a6..5864b9b 100755 +> --- a/test/T070-insert.sh +> +++ b/test/T070-insert.sh +> @@ -62,3 +62,3 @@ test_begin_subtest "Insert duplicate message" +> notmuch insert +duptag -unread < "$gen_msg_filename" +> -output=$(notmuch search --output=files "subject:insert-subject" | wc -l) +> +output=$(notmuch search --output=files "subject:insert-subject" | echo $(wc -l)) + +For this we have found solution earlier, unfortunately this did not get it: + + output=$((`notmuch search --output=files "subject:insert-subject" | wc -l`)) + +$ fgrep '$((`' test/*.sh +test/T060-count.sh: "$((`notmuch search --output=messages '*' | wc -l`))" \ +test/T060-count.sh: "$((`notmuch search --output=messages '*' | wc-l`))" \ +test/T060-count.sh: "$((`notmuch search --output=threads '*' | wc -l`))" \ +test/T060-count.sh: "$((`notmuch search '*' | wc -l`))" \ +test/T060-count.sh: "$((`notmuch search --output=files '*' | wc -l`))" \ + +i.e. arithmetic evaluation with just the number removes surrounding whitespace. + +> test_expect_equal "$output" 2 +> +> And without the following cast, gdb 7.4 complains about the return type. +> +> index-file-XAPIAN_EXCEPTION.gdb:7: Error in sourced command file: +> Return value type not available for selected stack frame. +> Please use an explicit cast of the value to return. +> +> diff --git a/test/T070-insert.sh b/test/T070-insert.sh +> index e7ec6a6..5864b9b 100755 +> --- a/test/T070-insert.sh +> +++ b/test/T070-insert.sh +> @@ -196,3 +196,3 @@ break notmuch_database_add_message +> commands +> -return NOTMUCH_STATUS_$code +> +return (int)NOTMUCH_STATUS_$code +> continue + +The page https://sourceware.org/gdb/onlinedocs/gdb/Returning.html +talks something about gdb not knowing the return type if function +was compiled without debug info... well, is this is the reason, +perhaps we should allow testing w/o debug info compiled in. + +> Does any of the above look reasonable to reduce the false positives? +> With the above, the T070 tests all pass on my system. + +1st is to be changed to be consistent w/ other code, second may be good. + + +> Janos + + +Tomi -- 2.26.2