2 test_description="locking"
3 . $(dirname "$0")/test-lib.sh || exit 1
7 test_begin_subtest "blocking open"
8 if [ $NOTMUCH_HAVE_XAPIAN_DB_RETRY_LOCK -ne 1 ]; then
9 test_subtest_known_broken
11 test_C ${MAIL_DIR} <<'EOF'
12 #include <notmuch-test.h>
15 taggit (notmuch_database_t *db, const char *tag)
17 notmuch_message_t *message;
19 EXPECT0 (notmuch_database_find_message (db, "4EFC743A.3060609@april.org", &message));
20 if (message == NULL) {
21 fprintf (stderr, "unable to find message");
25 EXPECT0 (notmuch_message_add_tag (message, tag));
26 notmuch_message_destroy (message);
30 main (int argc, char **argv)
33 const char *path = argv[1];
37 fprintf (stderr, "fork failed\n");
42 notmuch_database_t *db2;
47 EXPECT0(notmuch_database_open_with_config (argv[1],
48 NOTMUCH_DATABASE_MODE_READ_WRITE,
49 "", NULL, &db2, &msg));
50 if (msg) fputs (msg, stderr);
52 taggit (db2, "child");
53 EXPECT0 (notmuch_database_close (db2));
55 notmuch_database_t *db;
58 EXPECT0(notmuch_database_open_with_config (argv[1],
59 NOTMUCH_DATABASE_MODE_READ_WRITE,
60 "", NULL, &db, &msg));
61 if (msg) fputs (msg, stderr);
62 taggit (db, "parent");
64 EXPECT0 (notmuch_database_close (db));
70 notmuch search --output=tags id:4EFC743A.3060609@april.org >> OUTPUT
79 if [ $NOTMUCH_HAVE_XAPIAN_DB_RETRY_LOCK -ne 1 ]; then
80 test_subtest_known_broken
82 test_expect_equal_file EXPECTED OUTPUT