diff options
| author | David Bremner <david@tethera.net> | 2021-10-23 10:22:33 -0300 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2021-10-30 13:42:16 -0300 |
| commit | a942cb8ee3f0e20d6cd72d25c432467a5ebfe93c (patch) | |
| tree | 920097d7841b7cec03f42ccffc66064602d159cd /test/T590-libconfig.sh | |
| parent | fb02817943e8cd646641d7f1fe914ce8adb3ecb2 (diff) | |
test: add two known broken tests for missing config files
The documentation claims that the database will be set to NULL in this
case, but it is currently not happening. Based on a reproducer [1]
from Austin Ray.
[1]: id:20211021190401.imirxau2ewke6e2m@athena
Diffstat (limited to 'test/T590-libconfig.sh')
| -rwxr-xr-x | test/T590-libconfig.sh | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh index a9566c13..79bf5805 100755 --- a/test/T590-libconfig.sh +++ b/test/T590-libconfig.sh @@ -849,4 +849,47 @@ zzzafter afterval EOF test_expect_equal_file EXPECTED OUTPUT +cat <<EOF > c_head3 +#include <notmuch-test.h> +int main (int argc, char **argv) { + notmuch_status_t stat; + notmuch_database_t *db = NULL; +EOF + +cat <<EOF > c_tail3 + printf("db == NULL: %d\n", db == NULL); +} +EOF + +test_begin_subtest "open: database set to null on missing config" +test_subtest_known_broken +cat c_head3 - c_tail3 <<'EOF' | test_C ${MAIL_DIR} + notmuch_status_t st = notmuch_database_open_with_config(argv[1], + NOTMUCH_DATABASE_MODE_READ_ONLY, + "/nonexistent", NULL, &db, NULL); +EOF +cat <<EOF> EXPECTED +== stdout == +db == NULL: 1 +== stderr == +EOF +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "open: database set to null on missing config (env)" +test_subtest_known_broken +old_NOTMUCH_CONFIG=${NOTMUCH_CONFIG} +NOTMUCH_CONFIG="/nonexistent" +cat c_head3 - c_tail3 <<'EOF' | test_C ${MAIL_DIR} + notmuch_status_t st = notmuch_database_open_with_config(argv[1], + NOTMUCH_DATABASE_MODE_READ_ONLY, + NULL, NULL, &db, NULL); +EOF +NOTMUCH_CONFIG=${old_NOTMUCH_CONFIG} +cat <<EOF> EXPECTED +== stdout == +db == NULL: 1 +== stderr == +EOF +test_expect_equal_file EXPECTED OUTPUT + test_done |
