From e5d2ed90ef2beb5ceb421b6d440387ea8fb51857 Mon Sep 17 00:00:00 2001 From: Dmitry Kurochkin Date: Thu, 2 Feb 2012 04:04:10 +0400 Subject: [PATCH] [PATCH 2/2] test: fix order and format of test_expect_equal_file arguments --- 24/28e82eec58e6587d206323b1e25fe4796ff2a6 | 387 ++++++++++++++++++++++ 1 file changed, 387 insertions(+) create mode 100644 24/28e82eec58e6587d206323b1e25fe4796ff2a6 diff --git a/24/28e82eec58e6587d206323b1e25fe4796ff2a6 b/24/28e82eec58e6587d206323b1e25fe4796ff2a6 new file mode 100644 index 000000000..ba2b70a17 --- /dev/null +++ b/24/28e82eec58e6587d206323b1e25fe4796ff2a6 @@ -0,0 +1,387 @@ +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 8B26E431FAF + for ; Wed, 1 Feb 2012 16:05:36 -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 Fv2aFVDq+UYw for ; + Wed, 1 Feb 2012 16:05:35 -0800 (PST) +Received: from mail-bk0-f53.google.com (mail-bk0-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 E2937431FAE + for ; Wed, 1 Feb 2012 16:05:34 -0800 (PST) +Received: by mail-bk0-f53.google.com with SMTP id 11so1737569bke.26 + for ; Wed, 01 Feb 2012 16:05:34 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; + h=from:to:subject:date:message-id:x-mailer:in-reply-to:references; + bh=vAMIyUQKhwcWoisgfuf+tZP/+34DTu4LLfQJJYW7kDs=; + b=gYblaVD3kLsxSPL+uxmTKj8qVCAWF48p0SEuUFsNeNgWjEe6SLDEXYfXcxJeNXG1EQ + YWQJUkRct70Q4GbM2/PxtMHOTYe0BlNpit/nF71o2Mu7zazAk4Rerkr5opvYAeii372e + 4sTrhW329ZiTeMCkH6HyrX3NpiogK1nRkxEfU= +Received: by 10.204.133.219 with SMTP id g27mr310284bkt.47.1328141130624; + Wed, 01 Feb 2012 16:05:30 -0800 (PST) +Received: from localhost ([91.144.186.21]) + by mx.google.com with ESMTPS id ga13sm1587085bkc.5.2012.02.01.16.05.29 + (version=TLSv1/SSLv3 cipher=OTHER); + Wed, 01 Feb 2012 16:05:30 -0800 (PST) +From: Dmitry Kurochkin +To: notmuch@notmuchmail.org +Subject: [PATCH 2/2] test: fix order and format of test_expect_equal_file + arguments +Date: Thu, 2 Feb 2012 04:04:10 +0400 +Message-Id: <1328141050-30356-3-git-send-email-dmitry.kurochkin@gmail.com> +X-Mailer: git-send-email 1.7.9 +In-Reply-To: <1328141050-30356-1-git-send-email-dmitry.kurochkin@gmail.com> +References: <1328141050-30356-1-git-send-email-dmitry.kurochkin@gmail.com> +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, 02 Feb 2012 00:05:36 -0000 + +The patch fixes tests which were broken by the new +test_expect_equal_file() argument check. Some tests have correct +filename format, but wrong argument order. Others require files to be +renamed. +--- + test/crypto | 10 +++++----- + test/dump-restore | 10 +++++----- + test/hooks | 8 ++++---- + test/multipart | 20 ++++++++++---------- + test/search-limiting | 22 +++++++++++----------- + test/symbol-hiding | 4 ++-- + 6 files changed, 37 insertions(+), 37 deletions(-) + +diff --git a/test/crypto b/test/crypto +index 446a58b..9fdf710 100755 +--- a/test/crypto ++++ b/test/crypto +@@ -140,14 +140,14 @@ test_expect_equal \ + mv "${GNUPGHOME}"{.bak,} + + # create a test encrypted message with attachment +-cat <TESTATTACHMENT ++cat <TESTATTACHMENT.expected + This is a test file. + EOF + test_expect_success 'emacs delivery of encrypted message with attachment' \ + 'emacs_deliver_message \ + "test encrypted message 001" \ + "This is a test encrypted message.\n" \ +- "(mml-attach-file \"TESTATTACHMENT\") (mml-secure-message-encrypt)"' ++ "(mml-attach-file \"TESTATTACHMENT.expected\") (mml-secure-message-encrypt)"' + + test_begin_subtest "decryption, --format=text" + output=$(notmuch show --format=text --decrypt subject:"test encrypted message 001" \ +@@ -170,7 +170,7 @@ Non-text part: application/pgp-encrypted + +part{ ID: 4, Content-type: text/plain + This is a test encrypted message. + +part} +- +attachment{ ID: 5, Filename: TESTATTACHMENT, Content-type: application/octet-stream ++ +attachment{ ID: 5, Filename: TESTATTACHMENT.expected, Content-type: application/octet-stream + Non-text part: application/octet-stream + +attachment} + +part} +@@ -210,7 +210,7 @@ expected='[[[{"id": "XXXXX", + "content": "This is a test encrypted message.\n"}, + {"id": 5, + "content-type": "application/octet-stream", +- "filename": "TESTATTACHMENT"}]}]}]}, ++ "filename": "TESTATTACHMENT.expected"}]}]}]}, + []]]]' + test_expect_equal \ + "$output" \ +@@ -233,7 +233,7 @@ notmuch show \ + --part=5 \ + --decrypt \ + subject:"test encrypted message 001" >OUTPUT +-test_expect_equal_file OUTPUT TESTATTACHMENT ++test_expect_equal_file OUTPUT TESTATTACHMENT.expected + + test_begin_subtest "decryption failure with missing key" + mv "${GNUPGHOME}"{,.bak} +diff --git a/test/dump-restore b/test/dump-restore +index 439e998..a6cfce2 100755 +--- a/test/dump-restore ++++ b/test/dump-restore +@@ -55,7 +55,7 @@ test_expect_success 'Invalid restore invocation' \ + + test_begin_subtest "dump outfile" + notmuch dump dump-outfile.actual +-test_expect_equal_file dump.expected dump-outfile.actual ++test_expect_equal_file dump-outfile.actual dump.expected + + test_begin_subtest "dump outfile # deprecated" + test_expect_equal "Warning: the output file argument of dump is deprecated."\ +@@ -63,7 +63,7 @@ test_expect_equal "Warning: the output file argument of dump is deprecated."\ + + test_begin_subtest "dump outfile --" + notmuch dump dump-1-arg-dash.actual -- +-test_expect_equal_file dump.expected dump-1-arg-dash.actual ++test_expect_equal_file dump-1-arg-dash.actual dump.expected + + # Note, we assume all messages from cworth have a message-id + # containing cworth.org +@@ -72,14 +72,14 @@ grep 'cworth[.]org' dump.expected > dump-cworth.expected + + test_begin_subtest "dump -- from:cworth" + notmuch dump -- from:cworth > dump-dash-cworth.actual +-test_expect_equal_file dump-cworth.expected dump-dash-cworth.actual ++test_expect_equal_file dump-dash-cworth.actual dump-cworth.expected + + test_begin_subtest "dump outfile from:cworth" + notmuch dump dump-outfile-cworth.actual from:cworth +-test_expect_equal_file dump-cworth.expected dump-outfile-cworth.actual ++test_expect_equal_file dump-outfile-cworth.actual dump-cworth.expected + + test_begin_subtest "dump outfile -- from:cworth" + notmuch dump dump-outfile-dash-inbox.actual -- from:cworth +-test_expect_equal_file dump-cworth.expected dump-outfile-dash-inbox.actual ++test_expect_equal_file dump-outfile-dash-inbox.actual dump-cworth.expected + + test_done +diff --git a/test/hooks b/test/hooks +index 77e8569..d084d1f 100755 +--- a/test/hooks ++++ b/test/hooks +@@ -36,14 +36,14 @@ rm_hooks + generate_message + create_echo_hook "pre-new" expected output + notmuch new > /dev/null +-test_expect_equal_file expected output ++test_expect_equal_file output expected + + test_begin_subtest "post-new is run" + rm_hooks + generate_message + create_echo_hook "post-new" expected output + notmuch new > /dev/null +-test_expect_equal_file expected output ++test_expect_equal_file output expected + + test_begin_subtest "pre-new is run before post-new" + rm_hooks +@@ -51,7 +51,7 @@ generate_message + create_echo_hook "pre-new" pre-new.expected pre-new.output + create_echo_hook "post-new" post-new.expected post-new.output + notmuch new > /dev/null +-test_expect_equal_file post-new.expected post-new.output ++test_expect_equal_file post-new.output post-new.expected + + test_begin_subtest "pre-new non-zero exit status (hook status)" + rm_hooks +@@ -77,7 +77,7 @@ NOTMUCH_NEW 2>output.stderr >output + cat output.stderr >> output + echo "Added 1 new message to the database." > expected + echo "Error: post-new hook failed with status 13" >> expected +-test_expect_equal_file expected output ++test_expect_equal_file output expected + + # depends on the previous subtest leaving broken hook behind + test_expect_code 1 "post-new non-zero exit status (notmuch status)" "notmuch new" +diff --git a/test/multipart b/test/multipart +index 2dd73f5..c25cdf6 100755 +--- a/test/multipart ++++ b/test/multipart +@@ -2,7 +2,7 @@ + test_description="output of multipart message" + . ./test-lib.sh + +-cat < embedded_message ++cat < embedded_message.expected + From: Carl Worth + To: cworth@cworth.org + Subject: html message +@@ -25,7 +25,7 @@ This is an embedded message, with a multipart/alternative part. + --==-=-==-- + EOF + +-cat < ${MAIL_DIR}/multipart ++cat < ${MAIL_DIR}/multipart.expected + From: Carl Worth + To: cworth@cworth.org + Subject: Multipart message +@@ -44,8 +44,8 @@ Content-Type: message/rfc822 + Content-Disposition: inline + + EOF +-cat embedded_message >> ${MAIL_DIR}/multipart +-cat <> ${MAIL_DIR}/multipart ++cat embedded_message.expected >> ${MAIL_DIR}/multipart.expected ++cat <> ${MAIL_DIR}/multipart.expected + --=-=-= + Content-Disposition: attachment; filename=attachment + +@@ -108,7 +108,7 @@ notmuch new > /dev/null + test_begin_subtest "--format=text --part=0, full message" + notmuch show --format=text --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT + cat <EXPECTED +- +message{ id:87liy5ap00.fsf@yoom.home.cworth.org depth:0 match:1 filename:${MAIL_DIR}/multipart ++ +message{ id:87liy5ap00.fsf@yoom.home.cworth.org depth:0 match:1 filename:${MAIL_DIR}/multipart.expected + +header{ + Carl Worth (2001-01-05) (attachment inbox signed unread) + Subject: Multipart message +@@ -322,7 +322,7 @@ notmuch show --format=json --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org' | s + echo >>OUTPUT # expect *no* newline at end of output + cat <EXPECTED + +-{"id": "87liy5ap00.fsf@yoom.home.cworth.org", "match": true, "filename": "${MAIL_DIR}/multipart", "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["attachment","inbox","signed","unread"], "headers": {"Subject": "Multipart message", "From": "Carl Worth ", "To": "cworth@cworth.org", "Cc": "", "Bcc": "", "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [ ++{"id": "87liy5ap00.fsf@yoom.home.cworth.org", "match": true, "filename": "${MAIL_DIR}/multipart.expected", "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["attachment","inbox","signed","unread"], "headers": {"Subject": "Multipart message", "From": "Carl Worth ", "To": "cworth@cworth.org", "Cc": "", "Bcc": "", "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [ + {"id": 1, "content-type": "multipart/signed", "content": [ + {"id": 2, "content-type": "multipart/mixed", "content": [ + {"id": 3, "content-type": "message/rfc822", "content": [{"headers": {"From": "Carl Worth ", "To": "cworth@cworth.org", "Subject": "html message", "Date": "Fri, 05 Jan 2001 15:42:57 +0000"}, "body": [ +@@ -441,11 +441,11 @@ test_expect_success \ + + test_begin_subtest "--format=raw" + notmuch show --format=raw 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT +-test_expect_equal_file OUTPUT "${MAIL_DIR}"/multipart ++test_expect_equal_file OUTPUT "${MAIL_DIR}"/multipart.expected + + test_begin_subtest "--format=raw --part=0, full message" + notmuch show --format=raw --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT +-test_expect_equal_file OUTPUT "${MAIL_DIR}"/multipart ++test_expect_equal_file OUTPUT "${MAIL_DIR}"/multipart.expected + + test_begin_subtest "--format=raw --part=1, message body" + notmuch show --format=raw --part=1 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT +@@ -494,7 +494,7 @@ test_begin_subtest "--format=raw --part=3, rfc822 part" + test_subtest_known_broken + + notmuch show --format=raw --part=3 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT +-test_expect_equal_file OUTPUT embedded_message ++test_expect_equal_file OUTPUT embedded_message.expected + + test_begin_subtest "--format=raw --part=4, rfc822's html part" + notmuch show --format=raw --part=4 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT +@@ -556,7 +556,7 @@ test_expect_success \ + test_begin_subtest "--format=mbox" + notmuch show --format=mbox 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT + printf "From cworth@cworth.org Fri Jan 5 15:43:57 2001\n" >EXPECTED +-cat "${MAIL_DIR}"/multipart >>EXPECTED ++cat "${MAIL_DIR}"/multipart.expected >>EXPECTED + # mbox output is expected to include a blank line + echo >>EXPECTED + test_expect_equal_file OUTPUT EXPECTED +diff --git a/test/search-limiting b/test/search-limiting +index 303762c..e93c76a 100755 +--- a/test/search-limiting ++++ b/test/search-limiting +@@ -8,19 +8,19 @@ for outp in messages threads; do + test_begin_subtest "${outp}: limit does the right thing" + notmuch search --output=${outp} "*" | head -n 20 >expected + notmuch search --output=${outp} --limit=20 "*" >output +- test_expect_equal_file expected output ++ test_expect_equal_file output expected + + test_begin_subtest "${outp}: concatenation of limited searches" + notmuch search --output=${outp} "*" | head -n 20 >expected + notmuch search --output=${outp} --limit=10 "*" >output + notmuch search --output=${outp} --limit=10 --offset=10 "*" >>output +- test_expect_equal_file expected output ++ test_expect_equal_file output expected + + test_begin_subtest "${outp}: limit larger than result set" + N=`notmuch count --output=${outp} "*"` + notmuch search --output=${outp} "*" >expected + notmuch search --output=${outp} --limit=$((1 + ${N})) "*" >output +- test_expect_equal_file expected output ++ test_expect_equal_file output expected + + test_begin_subtest "${outp}: limit = 0" + test_expect_equal "`notmuch search --output=${outp} --limit=0 "*"`" "" +@@ -29,43 +29,43 @@ for outp in messages threads; do + # note: tail -n +N is 1-based + notmuch search --output=${outp} "*" | tail -n +21 >expected + notmuch search --output=${outp} --offset=20 "*" >output +- test_expect_equal_file expected output ++ test_expect_equal_file output expected + + test_begin_subtest "${outp}: offset = 0" + notmuch search --output=${outp} "*" >expected + notmuch search --output=${outp} --offset=0 "*" >output +- test_expect_equal_file expected output ++ test_expect_equal_file output expected + + test_begin_subtest "${outp}: negative offset" + notmuch search --output=${outp} "*" | tail -n 20 >expected + notmuch search --output=${outp} --offset=-20 "*" >output +- test_expect_equal_file expected output ++ test_expect_equal_file output expected + + test_begin_subtest "${outp}: negative offset" + notmuch search --output=${outp} "*" | tail -n 1 >expected + notmuch search --output=${outp} --offset=-1 "*" >output +- test_expect_equal_file expected output ++ test_expect_equal_file output expected + + test_begin_subtest "${outp}: negative offset combined with limit" + notmuch search --output=${outp} "*" | tail -n 20 | head -n 10 >expected + notmuch search --output=${outp} --offset=-20 --limit=10 "*" >output +- test_expect_equal_file expected output ++ test_expect_equal_file output expected + + test_begin_subtest "${outp}: negative offset combined with equal limit" + notmuch search --output=${outp} "*" | tail -n 20 >expected + notmuch search --output=${outp} --offset=-20 --limit=20 "*" >output +- test_expect_equal_file expected output ++ test_expect_equal_file output expected + + test_begin_subtest "${outp}: negative offset combined with large limit" + notmuch search --output=${outp} "*" | tail -n 20 >expected + notmuch search --output=${outp} --offset=-20 --limit=50 "*" >output +- test_expect_equal_file expected output ++ test_expect_equal_file output expected + + test_begin_subtest "${outp}: negative offset larger then results" + N=`notmuch count --output=${outp} "*"` + notmuch search --output=${outp} "*" >expected + notmuch search --output=${outp} --offset=-$((1 + ${N})) "*" >output +- test_expect_equal_file expected output ++ test_expect_equal_file output expected + done + + test_done +diff --git a/test/symbol-hiding b/test/symbol-hiding +index 636ec91..e6d896c 100755 +--- a/test/symbol-hiding ++++ b/test/symbol-hiding +@@ -27,7 +27,7 @@ test_expect_equal "$result" "$output" + + test_begin_subtest 'comparing existing to exported symbols' + objdump -t $TEST_DIRECTORY/../lib/*.o | awk '$4 == ".text" && $6 ~ "^notmuch" {print $6}' | sort | uniq > ACTUAL +-sed -n 's/[[:blank:]]*\(notmuch_[^;]*\);/\1/p' $TEST_DIRECTORY/../notmuch.sym | sort | uniq > EXPORTED +-test_expect_equal_file EXPORTED ACTUAL ++sed -n 's/[[:blank:]]*\(notmuch_[^;]*\);/\1/p' $TEST_DIRECTORY/../notmuch.sym | sort | uniq > EXPECTED ++test_expect_equal_file ACTUAL EXPECTED + + test_done +-- +1.7.9 + -- 2.26.2