From 21dcc45a0e035299c067dff309e29b712768e5cd Mon Sep 17 00:00:00 2001
Message-ID: <21dcc45a0e035299c067dff309e29b712768e5cd.1690117903.git.git@grubix.eu>
From: Michael J Gruber <git@grubix.eu>
Date: Tue, 15 Feb 2022 17:38:02 +0100
Subject: [PATCH 1/2] test: allow to use --full-scan
Some build infrastructure appears to have problems with mtime/stat,
leading to spurious failures (noticed on s390x and aarch64 with epel8).
Allow the test suite to be run with --full-scan so that release builds
can use the test suite while avoiding spurious failures.
---
test/README | 8 ++++++++
test/test-lib-common.sh | 7 ++++++-
test/test-lib.sh | 2 +-
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/test/README b/test/README
index a81808b1..d817672a 100644
--- a/test/README
+++ b/test/README
@@ -110,6 +110,14 @@ printed on screen. This printing can be disabled by setting the
NOTMUCH_TEST_QUIET variable to a non-null value. Message on test
failures and skips are still printed.
+File system/mtime issues
+------------------------
+Normally, `notmuch new` uses directory modification times, and the test
+suite checks that this works. If you encounter spurious test failures
+where messages added by one subtest appear to show up in the next subtest
+only (indicating mtime/stat problems) you can set NOTMUCH_TEST_FULLSCAN
+so that the test suite uses the --full-scan option of notmuch new.
+
Skipping Tests
--------------
If, for any reason, you need to skip one or more tests, you can do so
diff --git a/test/test-lib-common.sh b/test/test-lib-common.sh
index f5d72e12..6105f591 100644
--- a/test/test-lib-common.sh
+++ b/test/test-lib-common.sh
@@ -43,6 +43,11 @@ test_require_external_prereq () {
fi
}
+if test -n "$NOTMUCH_TEST_FULLSCAN"
+then
+ NOTMUCH_NEW_OPTIONS="--full-scan"
+fi
+
backup_database () {
test_name=$(basename $0 .sh)
rm -rf $TMP_DIRECTORY/notmuch-dir-backup."$test_name"
@@ -242,7 +247,7 @@ EOF
# are also supported here, so see that function for details.
add_message () {
generate_message "$@" &&
- notmuch new > /dev/null
+ notmuch new $NOTMUCH_NEW_OPTIONS > /dev/null
}
if test -n "$valgrind"
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 059e110c..8af291b2 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -476,7 +476,7 @@ test_json_nodes () {
}
NOTMUCH_NEW () {
- notmuch new "${@}" | grep -v -E -e '^Processed [0-9]*( total)? file|Found [0-9]* total file'
+ notmuch new $NOTMUCH_NEW_OPTIONS "${@}" | grep -v -E -e '^Processed [0-9]*( total)? file|Found [0-9]* total file'
}
NOTMUCH_DUMP_TAGS () {
--
2.41.0.602.g6d7d117f0f