X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=test%2FT640-database-modified.sh;h=2c3fa7356134664e37fe04f8148656f495c9ae42;hp=b5b3bc2bd440b13c54267970aac40a691a0bf6b4;hb=HEAD;hpb=ae731c183a64c1b68ceb145417897ae1c32b4971 diff --git a/test/T640-database-modified.sh b/test/T640-database-modified.sh index b5b3bc2b..2c3fa735 100755 --- a/test/T640-database-modified.sh +++ b/test/T640-database-modified.sh @@ -1,21 +1,17 @@ #!/usr/bin/env bash test_description="DatabaseModifiedError handling" -. ./test-lib.sh || exit 1 +. $(dirname "$0")/test-lib.sh || exit 1 # add enough messages to trigger the exception add_email_corpus test_begin_subtest "catching DatabaseModifiedError in _notmuch_message_ensure_metadata" -test_subtest_known_broken # it seems to need to be an early document to trigger the exception first_id=$(notmuch search --output=messages '*'| head -1 | sed s/^id://) test_C ${MAIL_DIR} < -#include #include -#include -#include + int main (int argc, char **argv) { @@ -26,22 +22,31 @@ main (int argc, char **argv) notmuch_message_t *message, *ro_message; notmuch_query_t *query; notmuch_tags_t *tags; + int i; + char* msg = NULL; - EXPECT0 (notmuch_database_open (path, NOTMUCH_DATABASE_MODE_READ_ONLY, &ro_db)); + EXPECT0(notmuch_database_open_with_config (argv[1], + NOTMUCH_DATABASE_MODE_READ_ONLY, + "", NULL, &ro_db, &msg)); + if (msg) fputs (msg, stderr); assert(ro_db); EXPECT0 (notmuch_database_find_message (ro_db, "${first_id}", &ro_message)); assert(ro_message); - EXPECT0 (notmuch_database_open (path, NOTMUCH_DATABASE_MODE_READ_WRITE, &rw_db)); + EXPECT0(notmuch_database_open_with_config (argv[1], + NOTMUCH_DATABASE_MODE_READ_WRITE, + "", NULL, &rw_db, &msg)); + if (msg) fputs (msg, stderr); + query = notmuch_query_create(rw_db, ""); - EXPECT0 (notmuch_query_search_messages_st (query, &messages)); + EXPECT0 (notmuch_query_search_messages (query, &messages)); - for (int count=0; + for (; notmuch_messages_valid (messages); - notmuch_messages_move_to_next (messages), count++) { + notmuch_messages_move_to_next (messages)) { message = notmuch_messages_get (messages); - for (int i=0; i<200; i++) { + for (i=0; i<200; i++) { char *tag_str = talloc_asprintf(rw_db, "%d", i); EXPECT0 (notmuch_message_add_tag (message, tag_str)); talloc_free (tag_str);