[PATCH v3 0/5] Git-based modularization of test suite

Michal Sojka sojkam1 at fel.cvut.cz
Wed Oct 13 05:44:23 PDT 2010


On Wed, 22 Sep 2010, Michal Sojka wrote:
> On Mon, 20 Sep 2010, Carl Worth wrote:
> > I've now pushed this out, along with some changes of my own on top of
> > it. My changes make things in the test suite look more like they did
> > before the git-based modularization, (both output from the test suite
> > and how the tests themselves are written). I couldn't stand the approach
> > of doing long chains of shell commands within strings for the tests, and
> > I also didn't like the numeric filenames.
> > 
> > Take a look at what I've done, and let me know if I defeated any
> > intended benefits of the git-based modularization of the test suite.
> 
> I went through your changes and they seems reasonable to me. I'll try to
> update my tests for maildir synchronization and let you know (or send a
> patch) if I find some problems.

Hi Carl,

here is my experience with test_begin_subtest and test_expect_equal
functions in test-lib.sh. I see there two significant differences from
the git's test_expect_success and similar functions.

First, when the test fails, you only see the differences in the real
output and the expected output. If you use test_expect_success you also
see the actual commands that were executed.

Second, when some command between test_begin_subtest and
test_expect_success fails (e.g. because of segfault) you may not detect
it. You can add "set -e" the test-lib.sh (see the patch bellow), but in
this case when a test fails you would see

  FATAL: Unexpected exit with code 1

without any additional information.

-Michal


diff --git a/test/test-lib.sh b/test/test-lib.sh
index 2036669..c98ea2f 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -395,6 +395,7 @@ add_email_corpus ()
 test_begin_subtest ()
 {
     test_subtest_name="$1"
+    set -e
 }
 
 # Pass test if two arguments match


More information about the notmuch mailing list