]> git.cworth.org Git - notmuch-old/blob - test/T800-asan.sh
CLI/git: cache git indices
[notmuch-old] / test / T800-asan.sh
1 #!/usr/bin/env bash
2 test_description='run code with ASAN enabled against the library'
3 . $(dirname "$0")/test-lib.sh || exit 1
4
5 if [ $NOTMUCH_HAVE_ASAN -ne 1 ]; then
6     printf "Skipping due to missing ASAN support\n"
7     test_done
8 fi
9
10 add_email_corpus
11
12 TEST_CFLAGS="-fsanitize=address"
13
14 test_begin_subtest "open and destroy"
15 test_C ${MAIL_DIR} ${NOTMUCH_CONFIG} <<EOF
16 #include <notmuch.h>
17 #include <stdio.h>
18
19 int main(int argc, char **argv) {
20   notmuch_database_t *db = NULL;
21
22   notmuch_status_t st = notmuch_database_open_with_config(argv[1],
23                                                           NOTMUCH_DATABASE_MODE_READ_ONLY,
24                                                           argv[2], NULL, &db, NULL);
25
26   printf("db != NULL: %d\n", db != NULL);
27   if (db != NULL)
28     notmuch_database_destroy(db);
29   return 0;
30 }
31 EOF
32 cat <<EOF > EXPECTED
33 == stdout ==
34 db != NULL: 1
35 == stderr ==
36 EOF
37 test_expect_equal_file EXPECTED OUTPUT
38
39 test_done