From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: [PATCH 1/4] test: mark some tests as broken when run as root.
Date: Wed, 4 Jan 2023 08:41:42 -0400 [thread overview]
Message-ID: <20230104124145.2882983-2-david@tethera.net> (raw)
In-Reply-To: <20230104124145.2882983-1-david@tethera.net>
File permission errors e.g., are hard to trigger as root.
---
test/T050-new.sh | 1 +
test/T150-tagging.sh | 1 +
test/test-lib.sh | 6 ++++++
3 files changed, 8 insertions(+)
diff --git a/test/T050-new.sh b/test/T050-new.sh
index cb67889c..240c1810 100755
--- a/test/T050-new.sh
+++ b/test/T050-new.sh
@@ -384,6 +384,7 @@ EOF
test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "Xapian exception: read only files"
+test_subtest_broken_for_root
chmod u-w ${MAIL_DIR}/.notmuch/xapian/*.*
output=$(NOTMUCH_NEW --debug 2>&1 | sed 's/: .*$//' )
chmod u+w ${MAIL_DIR}/.notmuch/xapian/*.*
diff --git a/test/T150-tagging.sh b/test/T150-tagging.sh
index 1a2fd77e..ac3f2539 100755
--- a/test/T150-tagging.sh
+++ b/test/T150-tagging.sh
@@ -320,6 +320,7 @@ test_begin_subtest "Tag name beginning with -"
test_expect_code 1 'notmuch tag +- One'
test_begin_subtest "Xapian exception: read only files"
+test_subtest_broken_for_root
chmod u-w ${MAIL_DIR}/.notmuch/xapian/*.*
output=$(notmuch tag +something '*' 2>&1 | sed 's/: .*$//' )
chmod u+w ${MAIL_DIR}/.notmuch/xapian/*.*
diff --git a/test/test-lib.sh b/test/test-lib.sh
index eec5c5b4..c2b8cd8d 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -740,6 +740,12 @@ test_subtest_known_broken () {
test_subtest_known_broken_=t
}
+test_subtest_broken_for_root () {
+ if [ "$(id -u)" = "0" ]; then
+ test_subtest_known_broken_=t
+ fi
+}
+
test_expect_success () {
exec 1>&6 2>&7 # Restore stdout and stderr
if [ -z "$inside_subtest" ]; then
--
2.39.0
next prev parent reply other threads:[~2023-01-04 12:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-04 12:41 Support testing notmuch as installed David Bremner
2023-01-04 12:41 ` David Bremner [this message]
2023-01-05 10:12 ` [PATCH 1/4] test: mark some tests as broken when run as root Tomi Ollila
2023-01-06 0:38 ` David Bremner
2023-01-04 12:41 ` [PATCH 2/4] test: check for empty/missing files in test_expect_equal_message_body David Bremner
2023-01-04 12:41 ` [PATCH 3/4] test: support testing notmuch as installed David Bremner
2023-01-04 12:41 ` [PATCH 4/4] 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=20230104124145.2882983-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).