unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: [PATCH v3 1/5] test: use bash specific test for feature tests
Date: Sun,  9 Apr 2023 11:26:23 -0300	[thread overview]
Message-ID: <20230409142627.2216080-2-david@tethera.net> (raw)
In-Reply-To: <20230409142627.2216080-1-david@tethera.net>

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.

We know the test suite is tied to bash anyway, so this is a simple
fix.
---
 test/T060-count.sh               | 2 +-
 test/T081-sexpr-search.sh        | 2 +-
 test/T150-tagging.sh             | 2 +-
 test/T160-json.sh                | 2 +-
 test/T220-reply.sh               | 2 +-
 test/T240-dump-restore.sh        | 2 +-
 test/T391-python-cffi.sh         | 3 +--
 test/T392-python-cffi-notmuch.sh | 2 +-
 test/T520-show.sh                | 2 +-
 test/T570-revision-tracking.sh   | 2 +-
 test/T700-reindex.sh             | 2 +-
 test/T800-asan.sh                | 2 +-
 test/T810-tsan.sh                | 2 +-
 test/T850-git.sh                 | 2 +-
 14 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/test/T060-count.sh b/test/T060-count.sh
index 48146706..4499b4cb 100755
--- a/test/T060-count.sh
+++ b/test/T060-count.sh
@@ -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 -eq 1 ]]; then
 
     test_begin_subtest "and of exact terms (query=sexp)"
     output=$(notmuch count --query=sexp '(and "wonderful" "wizard")')
diff --git a/test/T081-sexpr-search.sh b/test/T081-sexpr-search.sh
index 0c7db9c2..17b02e06 100755
--- a/test/T081-sexpr-search.sh
+++ b/test/T081-sexpr-search.sh
@@ -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 -ne 1 ]]; then
     printf "Skipping due to missing sfsexp library\n"
     test_done
 fi
diff --git a/test/T150-tagging.sh b/test/T150-tagging.sh
index ac3f2539..af0b8448 100755
--- a/test/T150-tagging.sh
+++ b/test/T150-tagging.sh
@@ -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 -eq 1 ]]; then
 
     test_query_syntax '(and "wonderful" "wizard")' 'wonderful and wizard'
     test_query_syntax '(or "php" "wizard")' 'php or wizard'
diff --git a/test/T160-json.sh b/test/T160-json.sh
index 4a797f6a..6f637a21 100755
--- a/test/T160-json.sh
+++ b/test/T160-json.sh
@@ -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 -ne 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\""
diff --git a/test/T220-reply.sh b/test/T220-reply.sh
index 207f5788..a5a9a1df 100755
--- a/test/T220-reply.sh
+++ b/test/T220-reply.sh
@@ -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 -eq 1 ]]; then
 
     test_begin_subtest "Basic reply (query=sexp)"
     notmuch reply --query=sexp "(id ${gen_msg_id})" >OUTPUT 2>&1 && echo OK >> OUTPUT
diff --git a/test/T240-dump-restore.sh b/test/T240-dump-restore.sh
index a86f0fb7..b99a303e 100755
--- a/test/T240-dump-restore.sh
+++ b/test/T240-dump-restore.sh
@@ -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 -eq 1 ]]; then
 
     test_begin_subtest "dump --query=sexp -- '(from cworth)'"
     notmuch dump --query=sexp -- '(from cworth)' > dump-dash-cworth.actual2
diff --git a/test/T391-python-cffi.sh b/test/T391-python-cffi.sh
index 30872af0..59ad087f 100755
--- a/test/T391-python-cffi.sh
+++ b/test/T391-python-cffi.sh
@@ -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 -eq 0 || $NOTMUCH_HAVE_PYTHON3_PYTEST -eq 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
diff --git a/test/T392-python-cffi-notmuch.sh b/test/T392-python-cffi-notmuch.sh
index 15c8fc6b..c97da9b5 100755
--- a/test/T392-python-cffi-notmuch.sh
+++ b/test/T392-python-cffi-notmuch.sh
@@ -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 -eq 0 || $NOTMUCH_HAVE_PYTHON3_PYTEST -eq 0 ]]; then
     test_done
 fi
 
diff --git a/test/T520-show.sh b/test/T520-show.sh
index c7b73a6d..77620099 100755
--- a/test/T520-show.sh
+++ b/test/T520-show.sh
@@ -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 -eq 1 ]]; then
 
     test_query_syntax '(and "wonderful" "wizard")' 'wonderful and wizard'
     test_query_syntax '(or "php" "wizard")' 'php or wizard'
diff --git a/test/T570-revision-tracking.sh b/test/T570-revision-tracking.sh
index a7480050..168cecbc 100755
--- a/test/T570-revision-tracking.sh
+++ b/test/T570-revision-tracking.sh
@@ -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 -eq 1 ]]; then
     test_begin_subtest 'exclude one message using negative lastmod (sexp)'
     total=$(notmuch count '*')
     notmuch tag +${RANDOM} id:4EFC743A.3060609@april.org
diff --git a/test/T700-reindex.sh b/test/T700-reindex.sh
index 347f8483..a884d89f 100755
--- a/test/T700-reindex.sh
+++ b/test/T700-reindex.sh
@@ -5,7 +5,7 @@ test_description='reindexing messages'
 add_email_corpus
 
 
-if [ $NOTMUCH_HAVE_SFSEXP -eq 1 ]; then
+if [[ $NOTMUCH_HAVE_SFSEXP -eq 1 ]]; then
 
     count=$(notmuch count --lastmod '*' | cut -f 3)
     for query in '()' '(not)' '(and)' '(or ())' '(or (not))' '(or (and))' \
diff --git a/test/T800-asan.sh b/test/T800-asan.sh
index 5055c93e..463bd386 100755
--- a/test/T800-asan.sh
+++ b/test/T800-asan.sh
@@ -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 -ne 1 ]]; then
     printf "Skipping due to missing ASAN support\n"
     test_done
 fi
diff --git a/test/T810-tsan.sh b/test/T810-tsan.sh
index 7e877b27..c27ba167 100755
--- a/test/T810-tsan.sh
+++ b/test/T810-tsan.sh
@@ -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 -ne 1 ]]; then
     printf "Skipping due to missing TSan support\n"
     test_done
 fi
diff --git a/test/T850-git.sh b/test/T850-git.sh
index 55cec78a..d3d05b51 100755
--- a/test/T850-git.sh
+++ b/test/T850-git.sh
@@ -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 -ne 1 ]]; then
     printf "Skipping due to missing sfsexp library\n"
     test_done
 fi
-- 
2.39.2

  reply	other threads:[~2023-04-09 14:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-09 14:26 v3 test notmuch as installed David Bremner
2023-04-09 14:26 ` David Bremner [this message]
2023-04-13 12:22   ` [PATCH v3 1/5] test: use bash specific test for feature tests Felipe Contreras
2023-04-13 18:56     ` Tomi Ollila
2023-04-13 19:24   ` Tomi Ollila
2023-04-14  0:30     ` Felipe Contreras
2023-04-09 14:26 ` [PATCH v3 2/5] test: check for empty/missing files in test_expect_equal_message_body David Bremner
2023-04-09 14:26 ` [PATCH v3 3/5] test: Guess a value for NOTMUCH_PYTHON David Bremner
2023-04-09 14:26 ` [PATCH v3 4/5] test: support testing notmuch as installed David Bremner
2023-04-09 14:26 ` [PATCH v3 5/5] debian: add autopkgtests David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230409142627.2216080-2-david@tethera.net \
    --to=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).