]> git.notmuchmail.org Git - notmuch/commitdiff
test: treat undefined feature variables as 0
authorDavid Bremner <david@tethera.net>
Sun, 9 Apr 2023 14:26:23 +0000 (11:26 -0300)
committerDavid Bremner <david@tethera.net>
Fri, 21 Jul 2023 09:58:16 +0000 (06:58 -0300)
When running the test suite without building first, it is desirable to
have the tests consider these variables being undefined as equivalent
to the feature not being present, and in particular for the tests not
to generate errors.

17 files changed:
test/T010-help-test.sh
test/T060-count.sh
test/T081-sexpr-search.sh
test/T095-address.sh
test/T150-tagging.sh
test/T160-json.sh
test/T220-reply.sh
test/T240-dump-restore.sh
test/T355-smime.sh
test/T391-python-cffi.sh
test/T392-python-cffi-notmuch.sh
test/T520-show.sh
test/T570-revision-tracking.sh
test/T700-reindex.sh
test/T800-asan.sh
test/T810-tsan.sh
test/T850-git.sh

index da45d3aecf7ae7a0c6e86be06f6d21155c50129b..1fbc46a2dc4a95bbc2f618d8dec606ccee75c788 100755 (executable)
@@ -12,7 +12,7 @@ test_expect_success 'notmuch help'
 test_begin_subtest 'notmuch --version'
 test_expect_success 'notmuch --version'
 
-if [ $NOTMUCH_HAVE_MAN -eq 1 ]; then
+if [ "${NOTMUCH_HAVE_MAN-0}" = "1" ]; then
     test_begin_subtest 'notmuch --help tag'
     test_expect_success 'notmuch --help tag'
 
index 4814670681165322d4769487991ef4f12542ea64..6e855b591af5594677c73d1d0a7271e0eda05ece 100755 (executable)
@@ -157,7 +157,7 @@ print("4: {} messages".format(query.count_messages()))
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
-if [ $NOTMUCH_HAVE_SFSEXP -eq 1 ]; then
+if [ "${NOTMUCH_HAVE_SFSEXP-0}" = "1" ]; then
 
     test_begin_subtest "and of exact terms (query=sexp)"
     output=$(notmuch count --query=sexp '(and "wonderful" "wizard")')
index 0c7db9c248bdfe2e143dab1f9f63d9ceaded9256..8800b545982751c1ac5dc0716fa605f4c72fe77c 100755 (executable)
@@ -2,7 +2,7 @@
 test_description='"notmuch search" in several variations'
 . $(dirname "$0")/test-lib.sh || exit 1
 
-if [ $NOTMUCH_HAVE_SFSEXP -ne 1 ]; then
+if [ "${NOTMUCH_HAVE_SFSEXP-0}" != "1" ]; then
     printf "Skipping due to missing sfsexp library\n"
     test_done
 fi
index 8bb3627ac1f0e39307d134548b4a2122ddcba51d..0cafbe20f11a0140cac8df350d6e9900ec52251e 100755 (executable)
@@ -325,7 +325,7 @@ cat <<EOF >EXPECTED
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
-if [[ NOTMUCH_HAVE_SFSEXP = 1 ]]; then
+if [ "${NOTMUCH_HAVE_SFSEXP-0}" = "1" ]; then
     test_begin_subtest "sexpr query: all messages"
     notmuch address '*' > EXPECTED
     notmuch address --query=sexp '()' > OUTPUT
index ac3f25399dc0e9024c8606c70805703355392ec6..273c0af35927e092c37b7a9c47cacfc9b8aaac89 100755 (executable)
@@ -328,7 +328,7 @@ test_expect_equal "$output" "A Xapian exception occurred opening database"
 
 add_email_corpus
 
-if [ $NOTMUCH_HAVE_SFSEXP -eq 1 ]; then
+if [ "${NOTMUCH_HAVE_SFSEXP-0}" = "1" ]; then
 
     test_query_syntax '(and "wonderful" "wizard")' 'wonderful and wizard'
     test_query_syntax '(or "php" "wizard")' 'php or wizard'
index 4a797f6aad14dfe13c18c8a69d3eac617dcee80e..f61c3f2dfee4ffaf01333ecd084c7582b9e1aa99 100755 (executable)
@@ -66,7 +66,7 @@ test_expect_equal_json "$output" "[{\"thread\": \"XXX\",
  \"unread\"]}]"
 
 test_begin_subtest "Search message: json, 64-bit timestamp"
-if [ $NOTMUCH_HAVE_64BIT_TIME_T -ne 1 ]; then
+if [ "${NOTMUCH_HAVE_64BIT_TIME_T-0}" != "1" ]; then
     test_subtest_known_broken
 fi
 add_message "[subject]=\"json-search-64bit-timestamp-subject\"" "[date]=\"Tue, 01 Jan 2999 12:00:00 -0000\"" "[body]=\"json-search-64bit-timestamp-message\""
index 207f578810133643491dad884fafb879a8e62312..120d7138d61809fd46cb724501bce921de13db87 100755 (executable)
@@ -24,7 +24,7 @@ test_begin_subtest "Basic reply"
 notmuch reply id:${gen_msg_id} >OUTPUT 2>&1 && echo OK >> OUTPUT
 test_expect_equal_file basic.expected OUTPUT
 
-if [ $NOTMUCH_HAVE_SFSEXP -eq 1 ]; then
+if [ "${NOTMUCH_HAVE_SFSEXP-0}" = "1" ]; then
 
     test_begin_subtest "Basic reply (query=sexp)"
     notmuch reply --query=sexp "(id ${gen_msg_id})" >OUTPUT 2>&1 && echo OK >> OUTPUT
index a86f0fb7e8f0440de6268075e91ba3b4262a38b1..80939030eedf0797eb37e49952cdef005a483cca 100755 (executable)
@@ -118,7 +118,7 @@ notmuch dump -- from:cworth > dump-dash-cworth.actual
 test_expect_equal_file dump-cworth.expected dump-dash-cworth.actual
 
 
-if [ $NOTMUCH_HAVE_SFSEXP -eq 1 ]; then
+if [ "${NOTMUCH_HAVE_SFSEXP-0}" = "1" ]; then
 
     test_begin_subtest "dump --query=sexp -- '(from cworth)'"
     notmuch dump --query=sexp -- '(from cworth)' > dump-dash-cworth.actual2
index 809274ce14a2156ab56d68c0d0e524da3baecab6..3bd5a17ed7b323392175c0aab14b9c8e7cc759a4 100755 (executable)
@@ -184,7 +184,7 @@ output=$(notmuch show --format=json id:smime-onepart-signed@protected-headers.ex
 test_valid_json "$output"
 
 test_begin_subtest "Verify signature on PKCS#7 SignedData message"
-if [ $NOTMUCH_HAVE_64BIT_TIME_T -ne 1 ]; then
+if [ "${NOTMUCH_HAVE_64BIT_TIME_T-0}" != "1" ]; then
     test_subtest_known_broken
 fi
 output=$(notmuch show --format=json id:smime-onepart-signed@protected-headers.example)
index 30872af0b9816a4e00da45a5f63b74844bcc84b2..0ef9e0d3c0604ca5f86f2d59180a85cd0c977a65 100755 (executable)
@@ -2,11 +2,10 @@
 test_description="python bindings (pytest)"
 . $(dirname "$0")/test-lib.sh || exit 1
 
-if [ $NOTMUCH_HAVE_PYTHON3_CFFI -eq 0 -o $NOTMUCH_HAVE_PYTHON3_PYTEST -eq 0 ]; then
+if [ "${NOTMUCH_HAVE_PYTHON3_CFFI-0}" = "0" -o "${NOTMUCH_HAVE_PYTHON3_PYTEST-0}" = "0" ]; then
     test_done
 fi
 
-
 test_begin_subtest "python cffi tests (NOTMUCH_CONFIG set)"
 pytest_dir=$NOTMUCH_BUILDDIR/bindings/python-cffi/build/stage
 printf "[pytest]\nminversion = 3.0\naddopts = -ra\n" > $pytest_dir/pytest.ini
index 15c8fc6bbe0b7dd76830df509678ebd35d235228..061612193cbe8d3f8373e7a4fe26bfddc9e41359 100755 (executable)
@@ -2,7 +2,7 @@
 test_description="python bindings (notmuch test suite)"
 . $(dirname "$0")/test-lib.sh || exit 1
 
-if [ $NOTMUCH_HAVE_PYTHON3_CFFI -eq 0 -o $NOTMUCH_HAVE_PYTHON3_PYTEST -eq 0 ]; then
+if [ "${NOTMUCH_HAVE_PYTHON3_CFFI-0}" = "0" -o "${NOTMUCH_HAVE_PYTHON3_PYTEST-0}" = "0" ]; then
     test_done
 fi
 
index c7b73a6d4a2bc2a9f892732f49052e1d97052183..6bcf109c76160c32fa0380fc6d2b68deb4d37474 100755 (executable)
@@ -35,7 +35,7 @@ notmuch show --entire-thread=true --sort=oldest-first $QUERY > OUTPUT
 test_expect_equal_file EXPECTED OUTPUT
 
 
-if [ $NOTMUCH_HAVE_SFSEXP -eq 1 ]; then
+if [ "${NOTMUCH_HAVE_SFSEXP-0}" = "1" ]; then
 
     test_query_syntax '(and "wonderful" "wizard")' 'wonderful and wizard'
     test_query_syntax '(or "php" "wizard")' 'php or wizard'
index a748005056d77c06ff511f8de2bf3d7333081364..bcc97dd9396305c7b984d156e575bdde87198804 100755 (executable)
@@ -95,7 +95,7 @@ subtotal=$(notmuch count lastmod:..$lastmod)
 result=$(($subtotal == $total-1))
 test_expect_equal 1 "$result"
 
-if [ $NOTMUCH_HAVE_SFSEXP -eq 1 ]; then
+if [ "${NOTMUCH_HAVE_SFSEXP-0}" = "1" ]; then
     test_begin_subtest 'exclude one message using negative lastmod (sexp)'
     total=$(notmuch count '*')
     notmuch tag +${RANDOM} id:4EFC743A.3060609@april.org
index 347f84838fa2e7d7310488f460f4ec6344ed405a..af34ad7cb9e756636377604c3f01adff88d0bf6f 100755 (executable)
@@ -5,7 +5,7 @@ test_description='reindexing messages'
 add_email_corpus
 
 
-if [ $NOTMUCH_HAVE_SFSEXP -eq 1 ]; then
+if [ "${NOTMUCH_HAVE_SFSEXP-0}" = "1" ]; then
 
     count=$(notmuch count --lastmod '*' | cut -f 3)
     for query in '()' '(not)' '(and)' '(or ())' '(or (not))' '(or (and))' \
index 5055c93e122b2c82449e5df4cf5d38632d971545..7c28dc7c9b84ac3a5fd7303dce7ac3d1e0d8ff2d 100755 (executable)
@@ -2,7 +2,7 @@
 test_description='run code with ASAN enabled against the library'
 . $(dirname "$0")/test-lib.sh || exit 1
 
-if [ $NOTMUCH_HAVE_ASAN -ne 1 ]; then
+if [ "${NOTMUCH_HAVE_ASAN-0}" != "1" ]; then
     printf "Skipping due to missing ASAN support\n"
     test_done
 fi
index 7e877b27e6132d534209d1517966480a8eb8c07d..4071e2968f2ad62eb6642c68b39f2750327682d0 100755 (executable)
@@ -8,7 +8,7 @@ test_description='run code with TSan enabled against the library'
 
 . "$test_directory"/test-lib.sh || exit 1
 
-if [ $NOTMUCH_HAVE_TSAN -ne 1 ]; then
+if [ "${NOTMUCH_HAVE_TSAN-0}" != "1" ]; then
     printf "Skipping due to missing TSan support\n"
     test_done
 fi
index 55cec78a16391b3f01e4139d5086729ca7f94bfb..be6e0cd41a1083d318a0c5715a4fe46483177759 100755 (executable)
@@ -2,7 +2,7 @@
 test_description='"notmuch git" to save and restore tags'
 . $(dirname "$0")/test-lib.sh || exit 1
 
-if [ $NOTMUCH_HAVE_SFSEXP -ne 1 ]; then
+if [ "${NOTMUCH_HAVE_SFSEXP-0}" != "1" ]; then
     printf "Skipping due to missing sfsexp library\n"
     test_done
 fi