From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id B76B6418C25 for ; Wed, 9 Jun 2010 23:48:50 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.9 X-Spam-Level: X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9] autolearn=ham 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 44G3za31DQta for ; Wed, 9 Jun 2010 23:48:35 -0700 (PDT) Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36]) by olra.theworths.org (Postfix) with ESMTP id 59F2F4196F0 for ; Wed, 9 Jun 2010 23:48:35 -0700 (PDT) Received: from localhost (unknown [192.168.200.4]) by max.feld.cvut.cz (Postfix) with ESMTP id A48C119F33D8; Thu, 10 Jun 2010 08:48:34 +0200 (CEST) X-Virus-Scanned: IMAP AMAVIS Received: from max.feld.cvut.cz ([192.168.200.1]) by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new, port 10044) with ESMTP id kKrIc4EXjRKi; Thu, 10 Jun 2010 08:48:33 +0200 (CEST) Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34]) by max.feld.cvut.cz (Postfix) with ESMTP id 7D81A19F35E2; Thu, 10 Jun 2010 08:48:32 +0200 (CEST) Received: from steelpick.2x.cz (k335-30.felk.cvut.cz [147.32.86.30]) (Authenticated sender: sojkam1) by imap.feld.cvut.cz (Postfix) with ESMTPSA id 743DE15C062; Thu, 10 Jun 2010 08:48:32 +0200 (CEST) Received: from wsh by steelpick.2x.cz with local (Exim 4.72) (envelope-from ) id 1OMbZ2-0000Jb-65; Thu, 10 Jun 2010 08:48:32 +0200 From: Michal Sojka To: notmuch@notmuchmail.org Subject: [PATCH v3 3/5] test: Update helper functions Date: Thu, 10 Jun 2010 08:48:02 +0200 Message-Id: <1276152484-1164-4-git-send-email-sojkam1@fel.cvut.cz> X-Mailer: git-send-email 1.7.1.3.g75e44 In-Reply-To: <1276152484-1164-1-git-send-email-sojkam1@fel.cvut.cz> References: <1276152484-1164-1-git-send-email-sojkam1@fel.cvut.cz> 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, 10 Jun 2010 06:48:52 -0000 Modify the helper functions to work with git-based test suite i.e. 1) Quote arguments where it is necessary. 2) Do not use $NOTMUCH. It is equal to "notmuch" since $PATH is set to the build tree. 3) Modify pass_if_equal to fit into the git-based test suite. Signed-off-by: Michal Sojka --- test/test-lib.sh | 33 +++++++++++++-------------------- 1 files changed, 13 insertions(+), 20 deletions(-) diff --git a/test/test-lib.sh b/test/test-lib.sh index 7684c2e..d045820 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -221,10 +221,10 @@ remove_cr () { increment_mtime_amount=0 increment_mtime () { - dir=$1 + dir="$1" increment_mtime_amount=$((increment_mtime_amount + 1)) - touch -d "+${increment_mtime_amount} seconds" $dir + touch -d "+${increment_mtime_amount} seconds" "$dir" } # Generate a new message in the mail directory, with a unique message @@ -291,7 +291,7 @@ generate_message () gen_msg_filename="${MAIL_DIR}/$gen_msg_name" else gen_msg_filename="${MAIL_DIR}/${template[dir]}/$gen_msg_name" - mkdir -p $(dirname $gen_msg_filename) + mkdir -p "$(dirname "$gen_msg_filename")" fi if [ -z "${template[body]}" ]; then @@ -346,7 +346,7 @@ ${additional_headers}" fi -cat <$gen_msg_filename +cat <"$gen_msg_filename" From: ${template[from]} To: ${template[to]} Message-Id: <${gen_msg_id}> @@ -357,7 +357,7 @@ ${template[body]} EOF # Ensure that the mtime of the containing directory is updated - increment_mtime $(dirname ${gen_msg_filename}) + increment_mtime "$(dirname "${gen_msg_filename}")" } # Generate a new message and add it to the index. @@ -366,41 +366,34 @@ EOF # are also supported here, so see that function for details. add_message () { - generate_message "$@" - - $NOTMUCH new > /dev/null + generate_message "$@" && + notmuch new > /dev/null } -tests=0 -test_failures=0 - pass_if_equal () { output=$1 expected=$2 - tests=$((tests + 1)) - if [ "$output" = "$expected" ]; then - echo " PASS" + true else - echo " FAIL" - testname=test-$(printf "%03d" $tests) + testname=$this_test.$test_count echo "$expected" > $testname.expected echo "$output" > $testname.output - diff -u $testname.expected $testname.output || true - test_failures=$((test_failures + 1)) + diff -u $testname.expected $testname.output + false fi } TEST_DIR=$(pwd)/test.$$ MAIL_DIR=${TEST_DIR}/mail export NOTMUCH_CONFIG=${TEST_DIR}/notmuch-config -NOTMUCH=$(find_notmuch_binary $(pwd)) +NOTMUCH=notmuch NOTMUCH_NEW () { - $NOTMUCH new | grep -v -E -e '^Processed [0-9]*( total)? file|Found [0-9]* total file' + notmuch new | grep -v -E -e '^Processed [0-9]*( total)? file|Found [0-9]* total file' } notmuch_search_sanitize () -- 1.7.1.3.g75e44