unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] test: fix compact backup / restore test
@ 2013-11-02  0:01 David Bremner
  2013-11-02 13:25 ` Tomi Ollila
  2013-11-03 12:30 ` Jani Nikula
  0 siblings, 2 replies; 4+ messages in thread
From: David Bremner @ 2013-11-02  0:01 UTC (permalink / raw)
  To: notmuch

It was looking in completely the wrong place for the backup and the
(test) xapian database. Unfortunately test_begin_subtest hides the
relevant errors.
---

I found this bug because 

  id:9ee3f2334a117b0a1b88650f44432423cbe95fd7.1383315568.git.jani@nikula.org

did _not_ break any tests. Which was puzzling.

 test/compact | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/test/compact b/test/compact
index 5bb5cea..afab537 100755
--- a/test/compact
+++ b/test/compact
@@ -19,10 +19,11 @@ thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag1 unread)
 thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag1 tag2 unread)
 thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Three (inbox tag3 unread)"
 
-test_begin_subtest "Restoring backup"
-rm -Rf ${TEST_TMPDIR}/mail/xapian
-mv ${TEST_TMPDIR}/mail/xapian.old ${TEST_TMPDIR}/mail/xapian
+test_expect_success 'Restoring Backup' \
+    'rm -Rf ${MAIL_DIR}/.notmuch/xapian &&
+     mv ${MAIL_DIR}/xapian.old ${MAIL_DIR}/.notmuch/xapian'
 
+test_begin_subtest "Checking restored backup"
 output=$(notmuch search \* | notmuch_search_sanitize)
 test_expect_equal "$output" "\
 thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag1 unread)
-- 
1.8.4.rc3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] test: fix compact backup / restore test
  2013-11-02  0:01 [PATCH] test: fix compact backup / restore test David Bremner
@ 2013-11-02 13:25 ` Tomi Ollila
  2013-11-02 14:56   ` David Bremner
  2013-11-03 12:30 ` Jani Nikula
  1 sibling, 1 reply; 4+ messages in thread
From: Tomi Ollila @ 2013-11-02 13:25 UTC (permalink / raw)
  To: David Bremner, notmuch

On Sat, Nov 02 2013, David Bremner <david@tethera.net> wrote:

> It was looking in completely the wrong place for the backup and the
> (test) xapian database. Unfortunately test_begin_subtest hides the
> relevant errors.
> ---

LGTM. It took me a while noticing that also ${TEST_TMPDIR}
was changed to ${MAIL_DIR}

Tomi

>
> I found this bug because 
>
>   id:9ee3f2334a117b0a1b88650f44432423cbe95fd7.1383315568.git.jani@nikula.org
>
> did _not_ break any tests. Which was puzzling.
>
>  test/compact | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/test/compact b/test/compact
> index 5bb5cea..afab537 100755
> --- a/test/compact
> +++ b/test/compact
> @@ -19,10 +19,11 @@ thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag1 unread)
>  thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag1 tag2 unread)
>  thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Three (inbox tag3 unread)"
>  
> -test_begin_subtest "Restoring backup"
> -rm -Rf ${TEST_TMPDIR}/mail/xapian
> -mv ${TEST_TMPDIR}/mail/xapian.old ${TEST_TMPDIR}/mail/xapian
> +test_expect_success 'Restoring Backup' \
> +    'rm -Rf ${MAIL_DIR}/.notmuch/xapian &&
> +     mv ${MAIL_DIR}/xapian.old ${MAIL_DIR}/.notmuch/xapian'
>  
> +test_begin_subtest "Checking restored backup"
>  output=$(notmuch search \* | notmuch_search_sanitize)
>  test_expect_equal "$output" "\
>  thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag1 unread)
> -- 
> 1.8.4.rc3
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] test: fix compact backup / restore test
  2013-11-02 13:25 ` Tomi Ollila
@ 2013-11-02 14:56   ` David Bremner
  0 siblings, 0 replies; 4+ messages in thread
From: David Bremner @ 2013-11-02 14:56 UTC (permalink / raw)
  To: Tomi Ollila, notmuch

Tomi Ollila <tomi.ollila@iki.fi> writes:

> On Sat, Nov 02 2013, David Bremner <david@tethera.net> wrote:
>
>> It was looking in completely the wrong place for the backup and the
>> (test) xapian database. Unfortunately test_begin_subtest hides the
>> relevant errors.
>> ---
>
> LGTM. It took me a while noticing that also ${TEST_TMPDIR}
> was changed to ${MAIL_DIR}

Globally it makes me a bit nervous to be doing destructive operations on
${MAIL_DIR}, but that isn't specific to this patch. I wonder if it would
be worth globally replacing the variable with something like
TEST_MAIL_DIR just to make collision with user environment less
likely. Or maybe it's enough just to be careful to override MAIL_DIR.

d

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] test: fix compact backup / restore test
  2013-11-02  0:01 [PATCH] test: fix compact backup / restore test David Bremner
  2013-11-02 13:25 ` Tomi Ollila
@ 2013-11-03 12:30 ` Jani Nikula
  1 sibling, 0 replies; 4+ messages in thread
From: Jani Nikula @ 2013-11-03 12:30 UTC (permalink / raw)
  To: David Bremner, notmuch

On Sat, 02 Nov 2013, David Bremner <david@tethera.net> wrote:
> It was looking in completely the wrong place for the backup and the
> (test) xapian database. Unfortunately test_begin_subtest hides the
> relevant errors.

I included this, unchanged, in my series [1] that depends on it. It
makes no difference which one is pushed.

BR,
Jani.

[1] id:cover.1383481295.git.jani@nikula.org


> ---
>
> I found this bug because 
>
>   id:9ee3f2334a117b0a1b88650f44432423cbe95fd7.1383315568.git.jani@nikula.org
>
> did _not_ break any tests. Which was puzzling.
>
>  test/compact | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/test/compact b/test/compact
> index 5bb5cea..afab537 100755
> --- a/test/compact
> +++ b/test/compact
> @@ -19,10 +19,11 @@ thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag1 unread)
>  thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag1 tag2 unread)
>  thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Three (inbox tag3 unread)"
>  
> -test_begin_subtest "Restoring backup"
> -rm -Rf ${TEST_TMPDIR}/mail/xapian
> -mv ${TEST_TMPDIR}/mail/xapian.old ${TEST_TMPDIR}/mail/xapian
> +test_expect_success 'Restoring Backup' \
> +    'rm -Rf ${MAIL_DIR}/.notmuch/xapian &&
> +     mv ${MAIL_DIR}/xapian.old ${MAIL_DIR}/.notmuch/xapian'
>  
> +test_begin_subtest "Checking restored backup"
>  output=$(notmuch search \* | notmuch_search_sanitize)
>  test_expect_equal "$output" "\
>  thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag1 unread)
> -- 
> 1.8.4.rc3
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-11-03 12:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-02  0:01 [PATCH] test: fix compact backup / restore test David Bremner
2013-11-02 13:25 ` Tomi Ollila
2013-11-02 14:56   ` David Bremner
2013-11-03 12:30 ` Jani Nikula

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).