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 6D427431FB6 for ; Mon, 30 May 2011 05:40:13 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.789 X-Spam-Level: X-Spam-Status: No, score=-0.789 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, T_MIME_NO_TEXT=0.01] 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 LQMFa6WE-na1 for ; Mon, 30 May 2011 05:40:11 -0700 (PDT) Received: from mail-fx0-f53.google.com (mail-fx0-f53.google.com [209.85.161.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 84F9D431FD0 for ; Mon, 30 May 2011 05:40:11 -0700 (PDT) Received: by fxm8 with SMTP id 8so2746626fxm.26 for ; Mon, 30 May 2011 05:40:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:subject:in-reply-to:references :user-agent:date:message-id:mime-version:content-type; bh=kZrMu10rZ8dD7L16vWyOokLfPez1mE8ukSa3h47zLVU=; b=pwOPciuCJyU17BkZKQ8ZKTU/kjoKHvMV+bmbWaBoS/ld6Fc2V0NJ8MYIqnJEiPUOMR TP2yxe/i2qB1V46PF7TRpYbkB6wa0t+UsM4E8EDp1CkMI81jkBByQrPqXjA3ubjQGMU1 0EFgCI69vH4B3xLASL+b732W2kogUo/6wH5G0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:in-reply-to:references:user-agent:date:message-id :mime-version:content-type; b=XSt4MJsXudFWN7MLHTceh3apNwfHy9Pomw6Xso/ATve9MxOy/esKu4zwwqIuhdB7pb ReLfcZWebrQG0X2wYyGXWSg9l6PxUCjBm8HEsYM3C8btQcWt4PItEIf1wbrfV5jIx8Gy 68ISJn/xcCtAjV4eAd8HNi+2RfUYBgQ4auJN0= Received: by 10.223.73.139 with SMTP id q11mr5537928faj.56.1306759209760; Mon, 30 May 2011 05:40:09 -0700 (PDT) Received: from localhorst.example.com (brln-4d0c70e5.pool.mediaWays.net [77.12.112.229]) by mx.google.com with ESMTPS id r10sm729237fah.2.2011.05.30.05.40.06 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 30 May 2011 05:40:08 -0700 (PDT) Received: by localhorst.example.com (Postfix, from userid 501) id 2667942036A9; Mon, 30 May 2011 14:40:04 +0200 (CEST) From: Felix Geller To: Carl Worth , notmuch@notmuchmail.org Subject: Re: [PATCH] Change in increment_mtime for BSD compatibility of test suite In-Reply-To: <87boypcdrw.fsf@yoom.home.cworth.org> References: <87boypcdrw.fsf@yoom.home.cworth.org> User-Agent: Emacs/23.3.1 (x86_64-apple-darwin10.7.0) Date: Mon, 30 May 2011 14:40:04 +0200 Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" 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: Mon, 30 May 2011 12:40:13 -0000 --=-=-= Content-Transfer-Encoding: quoted-printable Another try :) [...] Support for platform-specific test configuration - Platform-specific functionality is stored in test-config-PLATFORM.sh= files - configure script creates a test/test-config.sh depending on the plat= form - test-lib.sh loads test-config.sh file - Some platform-specific functionality included for gnu/bsd: - Work-around for touch -d on BSD - Variable to store sed command for extended expressions diff --git a/configure b/configure index bbf30cd..053a4a1 100755 =2D-- a/configure +++ b/configure @@ -16,6 +16,13 @@ if [ "$srcdir" !=3D "." ]; then # whole thing into the build directory. cp -a "$srcdir"/test/* test =20 + # Platform specific test configuration + if [ $platform =3D MACOSX ] ; then + cp test/test-config-bsd.sh test/test-config.sh + else + cp test/test-config-gnu.sh test/test-config.sh + fi + # Emacs only likes to generate compiled files next to the .el files # by default so copy these as well (which is not ideal0. cp -a "$srcdir"/emacs/*.el emacs diff --git a/test/basic b/test/basic index 808c968..5fbedfe 100755 =2D-- a/test/basic +++ b/test/basic @@ -54,13 +54,14 @@ test_begin_subtest 'Ensure that all available tests wil= l be run by notmuch-test' eval $(sed -n -e '/^TESTS=3D"$/,/^"$/p' notmuch-test ../notmuch-test) tests_in_suite=3D$(for i in $TESTS; do echo $i; done | sort) available=3D$(ls -1 ../ | \ =2D sed -r -e "/^(aggregate-results.sh|Makefile|Makefile.local|notmuch-t= est)/d" \ =2D -e "/^(README|test-lib.sh|test-lib.el|test-results|tmp.*|valgrind|co= rpus*)/d" \ =2D -e "/^(emacs.expected-output|smtp-dummy|smtp-dummy.c|test-verbose)/d= " \ =2D -e "/^(test.expected-output|.*~)/d" \ =2D -e "/^(gnupg-secret-key.asc)/d" \ =2D -e "/^(gnupg-secret-key.NOTE)/d" \ =2D | sort) + $SED_EXTENDED -e "/^(aggregate-results.sh|Makefile|Makefile.local|notm= uch-test)/d" \ + -e "/^(README|test-lib.sh|test-lib.el|test-results|tmp.*|valgrind|= corpus*)/d" \ + -e "/^(emacs.expected-output|smtp-dummy|smtp-dummy.c|test-verbose)= /d" \ + -e "/^(test.expected-output|.*~)/d" \ + -e "/^(gnupg-secret-key.asc)/d" \ + -e "/^(gnupg-secret-key.NOTE)/d" \ + -e "/^(test-config*)/d" \ + | sort) test_expect_equal "$tests_in_suite" "$available" =20 EXPECTED=3D../test.expected-output diff --git a/test/test-config-bsd.sh b/test/test-config-bsd.sh new file mode 100644 index 0000000..e35d2fa =2D-- /dev/null +++ b/test/test-config-bsd.sh @@ -0,0 +1,23 @@ +# This file contains helper functions and other values that are +# require platform-specific functionality (e.g., differing between GNU +# and BSD). The configure script is used to identify the appropriate +# file for a given platform, and copies the file test-config-FOO.sh to +# test-config.sh, where FOO is the respective platform (bsd or gnu). +# +# This file is BSD-specific. + +# Syntax for extended expressions +SED_EXTENDED=3D"sed -E" + +# There is no touch -d on BSD, therefore we have to use a more tedious +# version that uses date/stat to increment a date by a single second. +increment_mtime_amount=3D0 +increment_mtime () +{ + dir=3D"$1" +=20=20=20=20 + last_mod_date=3D`date -j -f %Y%m%d%H%M%S \`stat -f %Sm -t %Y%m%d%H%M%S= ${dir}\` +%s` + increment_mtime_amount=3D$((increment_mtime_amount + 1)) + new_date=3D`date -j -r ${last_mod_date} -v+${increment_mtime_amount}S = +%Y%m%d%H%M.%S` + touch -t ${new_date} ${dir} +} diff --git a/test/test-config-gnu.sh b/test/test-config-gnu.sh new file mode 100644 index 0000000..596505a =2D-- /dev/null +++ b/test/test-config-gnu.sh @@ -0,0 +1,20 @@ +# This file contains helper functions and other values that are +# require platform-specific functionality (e.g., differing between GNU +# and BSD). The configure script is used to identify the appropriate +# file for a given platform, and copies the file test-config-FOO.sh to +# test-config.sh, where FOO is the respective platform (bsd or gnu). +# +# This file is GNU-specific. + +# Syntax for extended expressions +SED_EXTENDED=3D"sed -r" + +# Use touch to increment the modification date by a single second. +increment_mtime_amount=3D0 +increment_mtime () +{ + dir=3D"$1" + + increment_mtime_amount=3D$((increment_mtime_amount + 1)) + touch -d "+${increment_mtime_amount} seconds" "$dir" +} diff --git a/test/test-lib.sh b/test/test-lib.sh index 922b1ef..1aa3a1c 100755 =2D-- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -23,6 +23,9 @@ if [ ${BASH_VERSINFO[0]} -lt 4 ]; then exit 1 fi =20 +# Load platform-specific values +. ./test-config.sh + # if --tee was passed, write the output not only to the terminal, but # additionally to the file test-results/$BASENAME.out, too. case "$GIT_TEST_TEE_STARTED, $* " in @@ -214,14 +217,6 @@ remove_cr () { } =20 # Notmuch helper functions =2Dincrement_mtime_amount=3D0 =2Dincrement_mtime () =2D{ =2D dir=3D"$1" =2D =2D increment_mtime_amount=3D$((increment_mtime_amount + 1)) =2D touch -d "+${increment_mtime_amount} seconds" "$dir" =2D} =20 # Generate a new message in the mail directory, with a unique message # ID and subject. The message is not added to the index. @@ -514,7 +509,7 @@ NOTMUCH_NEW () =20 notmuch_search_sanitize () { =2D sed -r -e 's/("?thread"?: ?)("?)................("?)/\1\2XXX\3/' + $SED_EXTENDED 's/("?thread"?: ?)("?)................("?)/\1\2XXX\3/' } =20 NOTMUCH_SHOW_FILENAME_SQUELCH=3D's,filename:.*/mail,filename:/XXX/mail,' --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) iEYEARECAAYFAk3jkCQACgkQMxgKfMb9y5amNACfU35yBvIF2S0VB8Tx9u0MWJqN ij4AoLmczzcV6N67MnTcqKIp4dO8SAQt =n/ID -----END PGP SIGNATURE----- --=-=-=--