unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Michal Sojka <sojkam1@fel.cvut.cz>
To: notmuch@notmuchmail.org
Subject: Re: A functional (but rudimentary) test suite for notmuch
Date: Mon, 8 Feb 2010 16:14:24 +0100	[thread overview]
Message-ID: <201002081614.24284.sojkam1@fel.cvut.cz> (raw)
In-Reply-To: <5641883d1002060727ia4e6c16lf800a92fc8735430@mail.gmail.com>

On Thursday 04 of February 2010 21:50:18 Carl Worth wrote:
> The test suite is still extremely rudimentary. Here are some things I'd
> like to improve about it:

I converted the actual version of notmuch-test to git test framework.
The result is in the followup patches.

I'd like to know opinion of others. If Carl agrees that it could be
merged I can do additional work as I describe below.

The conversion was not as straightforward as I expected mainly because
of problems with quoting. There are several sources of quotation problems
one being Carl's hashed array parameters. I thing it would be
sufficient to use plain variables for passing additional parameters.
Instead of:
    add_message [from]="\"Sender <sender@example.com>\"" \
                [to]=test_suite@notmuchmail.org \
                [subject]=notmuch-reply-test \
                [date]="\"Tue, 05 Jan 2010 15:43:56 -0800\"" \
                [body]="\"basic reply test\"" &&
I'd do:
    (
    msg_from="Sender <sender@example.com>"
    msg_to=test_suite@notmuchmail.org 
    msg_subject=notmuch-reply-test
    msg_date="Tue, 05 Jan 2010 15:43:56 -0800"
    msg_body="basic reply test"
    add_message
    )

A possible additional improvement is elimination of
execute_expecting(). Combination of action (running notmuch) and
testing of a result in a single function makes it hard to distinguish
whether the problem is in the action or in the output. For example, if
notmuch is killed because of segfault, it would look like that no
output was produced. So instead of:

    execute_expecting new "No new mail. Removed 3 messages."

I'd write something like:

    echo "No new mail. Removed 3 messages." > expected

  test_expect_success 'Run notmuch'    
    'notmuch_filter_output new > actual'
  test_expect_success 'Compare actual and correct output'    
    'test_cmp expected actual'

where test_cmp is basically diff -u. This has also the advantage that
longer output (e.g. as in t0003-reply.sh) is more readable if there is
a difference.

On Thursday 04 of February 2010 22:27:52 Oliver Charles wrote:
> Carl, have you considered outputting the test suite in the same format
> as the test anything protocol? [1] I only mention this because it
> might be a nice way to easily do some reporting (or perhaps even
> continuous integration) notmuch, with trivial effort.

According to http://testanything.org/wiki/index.php/TAP_Producers#Git_Project 
Git test output does not conform to TAP, but from my quick look it could be 
easily changed to conform.


On Friday 05 of February 2010 00:29:27 Carl Worth wrote:
> Looking at TAP, one thing I don't like is that it prints the
> success/failure of the test first, before the description of the
> test. That's not so nice in the case of a long-running (perhaps
> infinitely running) test where you might need to interrupt it, but you'd
> still want to know *what* was running for so long.

Git test framework also outputs first the result and then the test. It can be 
easily changed by -v switch.

To conclude, the output of running make in test/ directory now looks like 
this:
*** t0000-basic.sh ***
*   ok 1: test that mail store was created
*   ok 2: mail store should be empty
*   ok 3: NOTMUCH_CONFIG is set and points to an existing file
*   ok 4: PATH is set to this repository
*   ok 5: success is reported like this
*   still broken 6: pretend we have a known breakage
*   FIXED 7: pretend we have fixed a known breakage
*   ok 8: test runs if prerequisite is satisfied
* skip 9: unmet prerequisite causes test to be skipped
* fixed 1 known breakage(s)
* still have 1 known breakage(s)
* passed all remaining 8 test(s)
*** t0001-new.sh ***
*   ok 1: No new messages
*   ok 2: Single new message
*   ok 3: Multiple new messages
*   ok 4: No new messages (non-empty DB)
*   ok 5: New directories
*   ok 6: Alternate inode order
*   ok 7: Message moved in
*   ok 8: Renamed message
*   ok 9: Deleted message
*   ok 10: Renamed directory
*   ok 11: Deleted directory
*   ok 12: New directory (at end of list)
*   ok 13: Deleted directory (end of list)
*   ok 14: New symlink to directory
*   ok 15: New symlink to a file
*   ok 16: New two-level directory
*   ok 17: Deleted two-level directory
* passed all 17 test(s)
*** t0002-search.sh ***
*   ok 1: Search body
*   ok 2: Search by from:
*   ok 3: Search by to:
*   ok 4: Search by subject:
*   ok 5: Search by id:
*   ok 6: Search by tag:
*   ok 7: Search by thread:
*   ok 8: Search body (phrase)
*   ok 9: Search by from: (address)
*   ok 10: Search by from: (name)
*   ok 11: Search by to: (address)
*   ok 12: Search by to: (name)
*   ok 13: Search by subject: (phrase)
* passed all 13 test(s)
*** t0003-reply.sh ***
*   ok 1: Basic reply
*   ok 2: Multiple recipients
*   ok 3: Reply with CC
*   ok 4: Reply from alternate address
*   ok 5: Support for Reply-To
*   ok 6: Un-munging Reply-To
* passed all 6 test(s)
*** t0004-uuencoded-data.sh ***
*   ok 1: Generate message
*   ok 2: Ensure content before uu data is indexed
*   ok 3: Ensure uu data is not indexed
*   ok 4: Ensure content after uu data is indexed
* passed all 4 test(s)
*** t0005-dump-restore.sh ***
*   ok 1: Generate some message
*   ok 2: Dumping all tags
*   ok 3: Clearing all tags
*   ok 4: Restoring original tags
*   ok 5: Restore with nothing to do
* passed all 5 test(s)
fixed   1
success 51
failed  0
broken  1
total   54

Michal

  reply	other threads:[~2010-02-08 15:14 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-04 20:50 A functional (but rudimentary) test suite for notmuch Carl Worth
2010-02-04 21:27 ` Oliver Charles
2010-02-04 23:29   ` Carl Worth
2010-02-06 15:27     ` Oliver Charles
2010-02-08 15:14       ` Michal Sojka [this message]
2010-02-08 15:16         ` [PATCH 1/3] Copy test framework from Git Michal Sojka
2010-02-08 15:16         ` [PATCH 2/3] Update test framework for use with notmuch Michal Sojka
2010-02-08 15:16         ` [PATCH 3/3] Convert the actual tests to the new framework Michal Sojka
2010-02-11 21:42         ` A functional (but rudimentary) test suite for notmuch Carl Worth
2010-02-12 14:47           ` Michal Sojka
2010-02-12 16:33             ` Carl Worth
2010-02-15  8:39               ` Using test-lib.sh under GPLv3? Michal Sojka
2010-02-16 10:27                 ` Jakub Narebski
2010-02-16 13:06                   ` Michal Sojka
2010-02-16 22:07                     ` Avery Pennarun
2010-02-17  0:26                     ` Jakub Narebski
2010-02-16 20:54                 ` Junio C Hamano
2010-02-19  8:19                   ` Michal Sojka
2010-02-19  8:44                     ` Sverre Rabbelier
2010-02-19 10:39                     ` Johannes Schindelin
2010-02-19 17:15                       ` Pierre Habouzit
2010-02-19 19:01                       ` Carl Worth
2010-02-19 21:04                         ` Johannes Schindelin
2010-02-20 19:55                           ` [PATCH] test-lib.sh: Add explicit license detail, with change from GPLv2 to GPLv2+ Carl Worth
2010-02-20 21:28                             ` Junio C Hamano
2010-02-22 19:26                               ` Carl Worth
2010-02-23  3:42                                 ` Junio C Hamano
2010-02-23  3:51                                   ` Tay Ray Chuan
2010-02-23  9:21                                     ` Johannes Schindelin
2010-02-23  6:48                                   ` Matthieu Moy
2010-02-23 18:23                                   ` Carl Worth
2010-02-20 21:49                             ` Tay Ray Chuan
2010-02-20 22:22                             ` Johannes Schindelin
2010-04-06 17:01                             ` Michal Sojka
2010-04-15 18:08                               ` Carl Worth
2010-02-19 17:36                     ` Using test-lib.sh under GPLv3? Johannes Sixt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201002081614.24284.sojkam1@fel.cvut.cz \
    --to=sojkam1@fel.cvut.cz \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).