mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 18:38:08 +01:00
test: treat undefined feature variables as 0
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.
This commit is contained in:
parent
e9ff896f84
commit
dfa43a1921
17 changed files with 17 additions and 18 deletions
|
@ -12,7 +12,7 @@ test_expect_success 'notmuch help'
|
||||||
test_begin_subtest 'notmuch --version'
|
test_begin_subtest 'notmuch --version'
|
||||||
test_expect_success '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_begin_subtest 'notmuch --help tag'
|
||||||
test_expect_success 'notmuch --help tag'
|
test_expect_success 'notmuch --help tag'
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,7 @@ print("4: {} messages".format(query.count_messages()))
|
||||||
EOF
|
EOF
|
||||||
test_expect_equal_file EXPECTED OUTPUT
|
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)"
|
test_begin_subtest "and of exact terms (query=sexp)"
|
||||||
output=$(notmuch count --query=sexp '(and "wonderful" "wizard")')
|
output=$(notmuch count --query=sexp '(and "wonderful" "wizard")')
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
test_description='"notmuch search" in several variations'
|
test_description='"notmuch search" in several variations'
|
||||||
. $(dirname "$0")/test-lib.sh || exit 1
|
. $(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"
|
printf "Skipping due to missing sfsexp library\n"
|
||||||
test_done
|
test_done
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -325,7 +325,7 @@ cat <<EOF >EXPECTED
|
||||||
EOF
|
EOF
|
||||||
test_expect_equal_file EXPECTED OUTPUT
|
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"
|
test_begin_subtest "sexpr query: all messages"
|
||||||
notmuch address '*' > EXPECTED
|
notmuch address '*' > EXPECTED
|
||||||
notmuch address --query=sexp '()' > OUTPUT
|
notmuch address --query=sexp '()' > OUTPUT
|
||||||
|
|
|
@ -328,7 +328,7 @@ test_expect_equal "$output" "A Xapian exception occurred opening database"
|
||||||
|
|
||||||
add_email_corpus
|
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 '(and "wonderful" "wizard")' 'wonderful and wizard'
|
||||||
test_query_syntax '(or "php" "wizard")' 'php or wizard'
|
test_query_syntax '(or "php" "wizard")' 'php or wizard'
|
||||||
|
|
|
@ -66,7 +66,7 @@ test_expect_equal_json "$output" "[{\"thread\": \"XXX\",
|
||||||
\"unread\"]}]"
|
\"unread\"]}]"
|
||||||
|
|
||||||
test_begin_subtest "Search message: json, 64-bit timestamp"
|
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
|
test_subtest_known_broken
|
||||||
fi
|
fi
|
||||||
add_message "[subject]=\"json-search-64bit-timestamp-subject\"" "[date]=\"Tue, 01 Jan 2999 12:00:00 -0000\"" "[body]=\"json-search-64bit-timestamp-message\""
|
add_message "[subject]=\"json-search-64bit-timestamp-subject\"" "[date]=\"Tue, 01 Jan 2999 12:00:00 -0000\"" "[body]=\"json-search-64bit-timestamp-message\""
|
||||||
|
|
|
@ -24,7 +24,7 @@ test_begin_subtest "Basic reply"
|
||||||
notmuch reply id:${gen_msg_id} >OUTPUT 2>&1 && echo OK >> OUTPUT
|
notmuch reply id:${gen_msg_id} >OUTPUT 2>&1 && echo OK >> OUTPUT
|
||||||
test_expect_equal_file basic.expected 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)"
|
test_begin_subtest "Basic reply (query=sexp)"
|
||||||
notmuch reply --query=sexp "(id ${gen_msg_id})" >OUTPUT 2>&1 && echo OK >> OUTPUT
|
notmuch reply --query=sexp "(id ${gen_msg_id})" >OUTPUT 2>&1 && echo OK >> OUTPUT
|
||||||
|
|
|
@ -118,7 +118,7 @@ notmuch dump -- from:cworth > dump-dash-cworth.actual
|
||||||
test_expect_equal_file dump-cworth.expected 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)'"
|
test_begin_subtest "dump --query=sexp -- '(from cworth)'"
|
||||||
notmuch dump --query=sexp -- '(from cworth)' > dump-dash-cworth.actual2
|
notmuch dump --query=sexp -- '(from cworth)' > dump-dash-cworth.actual2
|
||||||
|
|
|
@ -184,7 +184,7 @@ output=$(notmuch show --format=json id:smime-onepart-signed@protected-headers.ex
|
||||||
test_valid_json "$output"
|
test_valid_json "$output"
|
||||||
|
|
||||||
test_begin_subtest "Verify signature on PKCS#7 SignedData message"
|
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
|
test_subtest_known_broken
|
||||||
fi
|
fi
|
||||||
output=$(notmuch show --format=json id:smime-onepart-signed@protected-headers.example)
|
output=$(notmuch show --format=json id:smime-onepart-signed@protected-headers.example)
|
||||||
|
|
|
@ -2,11 +2,10 @@
|
||||||
test_description="python bindings (pytest)"
|
test_description="python bindings (pytest)"
|
||||||
. $(dirname "$0")/test-lib.sh || exit 1
|
. $(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
|
test_done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
test_begin_subtest "python cffi tests (NOTMUCH_CONFIG set)"
|
test_begin_subtest "python cffi tests (NOTMUCH_CONFIG set)"
|
||||||
pytest_dir=$NOTMUCH_BUILDDIR/bindings/python-cffi/build/stage
|
pytest_dir=$NOTMUCH_BUILDDIR/bindings/python-cffi/build/stage
|
||||||
printf "[pytest]\nminversion = 3.0\naddopts = -ra\n" > $pytest_dir/pytest.ini
|
printf "[pytest]\nminversion = 3.0\naddopts = -ra\n" > $pytest_dir/pytest.ini
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
test_description="python bindings (notmuch test suite)"
|
test_description="python bindings (notmuch test suite)"
|
||||||
. $(dirname "$0")/test-lib.sh || exit 1
|
. $(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
|
test_done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ notmuch show --entire-thread=true --sort=oldest-first $QUERY > OUTPUT
|
||||||
test_expect_equal_file EXPECTED 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 '(and "wonderful" "wizard")' 'wonderful and wizard'
|
||||||
test_query_syntax '(or "php" "wizard")' 'php or wizard'
|
test_query_syntax '(or "php" "wizard")' 'php or wizard'
|
||||||
|
|
|
@ -95,7 +95,7 @@ subtotal=$(notmuch count lastmod:..$lastmod)
|
||||||
result=$(($subtotal == $total-1))
|
result=$(($subtotal == $total-1))
|
||||||
test_expect_equal 1 "$result"
|
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)'
|
test_begin_subtest 'exclude one message using negative lastmod (sexp)'
|
||||||
total=$(notmuch count '*')
|
total=$(notmuch count '*')
|
||||||
notmuch tag +${RANDOM} id:4EFC743A.3060609@april.org
|
notmuch tag +${RANDOM} id:4EFC743A.3060609@april.org
|
||||||
|
|
|
@ -5,7 +5,7 @@ test_description='reindexing messages'
|
||||||
add_email_corpus
|
add_email_corpus
|
||||||
|
|
||||||
|
|
||||||
if [ $NOTMUCH_HAVE_SFSEXP -eq 1 ]; then
|
if [ "${NOTMUCH_HAVE_SFSEXP-0}" = "1" ]; then
|
||||||
|
|
||||||
count=$(notmuch count --lastmod '*' | cut -f 3)
|
count=$(notmuch count --lastmod '*' | cut -f 3)
|
||||||
for query in '()' '(not)' '(and)' '(or ())' '(or (not))' '(or (and))' \
|
for query in '()' '(not)' '(and)' '(or ())' '(or (not))' '(or (and))' \
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
test_description='run code with ASAN enabled against the library'
|
test_description='run code with ASAN enabled against the library'
|
||||||
. $(dirname "$0")/test-lib.sh || exit 1
|
. $(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"
|
printf "Skipping due to missing ASAN support\n"
|
||||||
test_done
|
test_done
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -8,7 +8,7 @@ test_description='run code with TSan enabled against the library'
|
||||||
|
|
||||||
. "$test_directory"/test-lib.sh || exit 1
|
. "$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"
|
printf "Skipping due to missing TSan support\n"
|
||||||
test_done
|
test_done
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
test_description='"notmuch git" to save and restore tags'
|
test_description='"notmuch git" to save and restore tags'
|
||||||
. $(dirname "$0")/test-lib.sh || exit 1
|
. $(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"
|
printf "Skipping due to missing sfsexp library\n"
|
||||||
test_done
|
test_done
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue