From: Felipe Contreras <felipe.contreras@gmail.com>
To: notmuch@notmuchmail.org
Cc: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Subject: [PATCH v2 0/6] test: several cleanups
Date: Sat, 15 May 2021 15:47:38 -0500 [thread overview]
Message-ID: <20210515204744.965206-1-felipe.contreras@gmail.com> (raw)
Many cleanups from the last time I sent this series were not picked, I've rebased and reordered the
patches so they have a better chance of being picked up.
I only dropped the patch about USER_FULL_NAME, maybe there's a better way to do it, and this way the
entire patch series is about cleanups.
Felipe Contreras (6):
test: trivial style cleanups
test: more style fixes
test: emacs: simplify missing dependencies check
test: emacs: check for configured emacs
test: emacs: fix a couple of shellcheck complaints
test: split emacs functionality to its own file
test/T000-basic.sh | 2 +-
test/T070-insert.sh | 2 +-
test/T140-excludes.sh | 3 +-
test/T160-json.sh | 1 +
test/T170-sexp.sh | 1 +
test/T190-multipart.sh | 3 +-
test/T310-emacs.sh | 1 +
test/T320-emacs-large-search-buffer.sh | 3 +
test/T330-emacs-subject-to-filename.sh | 3 +
test/T350-crypto.sh | 1 +
test/T355-smime.sh | 1 +
test/T357-index-decryption.sh | 1 +
test/T358-emacs-protected-headers.sh | 2 +
test/T420-emacs-test-functions.sh | 1 +
test/T430-emacs-address-cleaning.sh | 3 +
test/T440-emacs-hello.sh | 2 +
test/T450-emacs-show.sh | 1 +
test/T455-emacs-charsets.sh | 3 +
test/T460-emacs-tree.sh | 1 +
test/T490-parse-time-string.sh | 6 +-
test/T510-thread-replies.sh | 1 +
test/T590-thread-breakage.sh | 10 +-
test/T630-emacs-draft.sh | 2 +
test/T720-emacs-attachment-warnings.sh | 3 +
test/T730-emacs-forwarding.sh | 1 +
test/export-dirs.sh | 3 +-
test/test-lib-common.sh | 6 +-
test/test-lib-emacs.sh | 209 +++++++++++++++++++
test/test-lib.sh | 275 +++----------------------
29 files changed, 281 insertions(+), 270 deletions(-)
create mode 100644 test/test-lib-emacs.sh
Range-diff against v1:
1: 9b173076 < -: -------- test: fix passwd_sanitize()
2: c0352e17 < -: -------- test: unset NAME environment variable
3: 5f0c0ee9 < -: -------- test: remove USER_FULL_NAME when not present
4: 2f7df848 < -: -------- test: use correct fqdn in passwd_sanitize()
5: 586acb92 < -: -------- test: fix wrong SKIP messages
6: c6866fdb < -: -------- test: add prereqs check in test_emacs_expect_t
7: 966bfe4f < -: -------- test: add external prereqs to many emacs tests
12: 795cb59a ! 1: 0a66ef17 test: trivial style cleanups
@@ test/test-lib.sh: test_must_fail () {
$GIT_TEST_CMP "$@"
}
-@@ test/test-lib.sh: test_done () {
- fi
+@@ test/test-lib.sh: test_emacs () {
+ ${TEST_EMACSCLIENT} --socket-name="$EMACS_SERVER" --eval "(notmuch-test-progn $*)"
}
-test_python() {
@@ test/test-lib.sh: test_done () {
# Note: if there is need to print debug information from python program,
# use stdout = os.fdopen(6, 'w') or stderr = os.fdopen(7, 'w')
PYTHONPATH="$NOTMUCH_SRCDIR/bindings/python${PYTHONPATH:+:$PYTHONPATH}" \
- $NOTMUCH_PYTHON -B - > OUTPUT
- }
-
--test_ruby() {
-+test_ruby () {
- MAIL_DIR=$MAIL_DIR $NOTMUCH_RUBY -I "$NOTMUCH_BUILDDIR/bindings/ruby"> OUTPUT
- }
-
13: c6235983 ! 2: a273e59e test: more style fixes
@@ test/test-lib-common.sh: EOF
notmuch new > /dev/null
}
- ## test/test-lib-emacs.sh ##
-@@ test/test-lib-emacs.sh: test_require_emacs () {
- # Accepts arbitrary extra emacs/elisp functions to modify the message
- # before sending, which is useful to doing things like attaching files
- # to the message and encrypting/signing.
--emacs_deliver_message ()
--{
-+emacs_deliver_message () {
- local subject body smtp_dummy_pid smtp_dummy_port
- subject="$1"
- body="$2"
-@@ test/test-lib-emacs.sh: emacs_deliver_message ()
- # If any GNU-style long-arguments (like --quiet or --decrypt=true) are
- # at the head of the argument list, they are sent directly to "notmuch
- # new" after message delivery
--emacs_fcc_message ()
--{
-+emacs_fcc_message () {
- local nmn_args subject body
- nmn_args=''
- while [[ "$1" =~ ^-- ]]; do
-
## test/test-lib.sh ##
-@@ test/test-lib.sh: unset ALTERNATE_EDITOR
- unset EMAIL
- unset NAME
+@@ test/test-lib.sh: test_require_emacs () {
+ test_require_external_prereq dtach
+ }
-add_gnupg_home ()
-{
@@ test/test-lib.sh: then
echo
echo $this_test: "Testing ${test_description}"
@@ test/test-lib.sh: trap 'trap_signal' HUP INT TERM
+ # Accepts arbitrary extra emacs/elisp functions to modify the message
+ # before sending, which is useful to doing things like attaching files
+ # to the message and encrypting/signing.
+-emacs_deliver_message ()
+-{
++emacs_deliver_message () {
+ local subject body smtp_dummy_pid smtp_dummy_port
+ subject="$1"
+ body="$2"
+@@ test/test-lib.sh: emacs_deliver_message ()
+ # If any GNU-style long-arguments (like --quiet or --decrypt=true) are
+ # at the head of the argument list, they are sent directly to "notmuch
+ # new" after message delivery
+-emacs_fcc_message ()
+-{
++emacs_fcc_message () {
+ local nmn_args subject body
+ nmn_args=''
+ while [[ "$1" =~ ^-- ]]; do
+@@ test/test-lib.sh: emacs_fcc_message ()
# history of the notmuch mailing list, which allows for reliably
# testing commands that need to operate on a not-totally-trivial
# number of messages.
@@ test/test-lib.sh: test_expect_equal ()
local file1 file2 testname basename1 basename2
exec 1>&6 2>&7 # Restore stdout and stderr
if [ -z "$inside_subtest" ]; then
-@@ test/test-lib.sh: test_json_nodes () {
+@@ test/test-lib.sh: test_emacs_expect_t () {
fi
}
9: 5d6bbf5a ! 3: 33d8e18f test: emacs: simplify missing dependencies check
@@ Commit message
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
- ## test/test-lib-emacs.sh ##
-@@
- # along with this program. If not, see https://www.gnu.org/licenses/ .
+ ## test/test-lib.sh ##
+@@ test/test-lib.sh: unset EMAIL
+ unset NAME
test_require_emacs () {
- test_require_external_prereq emacs
@@ test/test-lib-emacs.sh
+ return $ret
}
- # Deliver a message with emacs and add it to the database
-@@ test/test-lib-emacs.sh: EOF
+ add_gnupg_home () {
+@@ test/test-lib.sh: EOF
test_emacs () {
# test dependencies beforehand to avoid the waiting loop below
10: 140222f5 ! 4: 2367f688 test: emacs: check for configured emacs
@@ Commit message
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
- ## test/test-lib-emacs.sh ##
-@@
+ ## test/test-lib.sh ##
+@@ test/test-lib.sh: unset NAME
test_require_emacs () {
local ret=0
11: 7c304f65 ! 5: 99fd015f test: emacs: fix a couple of shellcheck complaints
@@ Commit message
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
- ## test/test-lib-emacs.sh ##
-@@
+ ## test/test-lib.sh ##
+@@ test/test-lib.sh: unset NAME
test_require_emacs () {
local ret=0
8: 7cc9e859 ! 6: df69ddb2 test: split emacs functionality to its own file
@@ test/test-lib-emacs.sh (new)
+# along with this program. If not, see https://www.gnu.org/licenses/ .
+
+test_require_emacs () {
-+ test_require_external_prereq emacs
-+ test_require_external_prereq ${TEST_EMACSCLIENT}
-+ test_require_external_prereq dtach
++ local ret=0
++ test_require_external_prereq "$TEST_EMACS" || ret=1
++ test_require_external_prereq "$TEST_EMACSCLIENT" || ret=1
++ test_require_external_prereq dtach || ret=1
++ return $ret
+}
+
+# Deliver a message with emacs and add it to the database
@@ test/test-lib-emacs.sh (new)
+# Accepts arbitrary extra emacs/elisp functions to modify the message
+# before sending, which is useful to doing things like attaching files
+# to the message and encrypting/signing.
-+emacs_deliver_message ()
-+{
++emacs_deliver_message () {
+ local subject body smtp_dummy_pid smtp_dummy_port
+ subject="$1"
+ body="$2"
@@ test/test-lib-emacs.sh (new)
+# If any GNU-style long-arguments (like --quiet or --decrypt=true) are
+# at the head of the argument list, they are sent directly to "notmuch
+# new" after message delivery
-+emacs_fcc_message ()
-+{
++emacs_fcc_message () {
+ local nmn_args subject body
+ nmn_args=''
+ while [[ "$1" =~ ^-- ]]; do
@@ test/test-lib-emacs.sh (new)
+
+test_emacs () {
+ # test dependencies beforehand to avoid the waiting loop below
-+ missing_dependencies=
-+ test_require_external_prereq dtach || missing_dependencies=1
-+ test_require_external_prereq emacs || missing_dependencies=1
-+ test_require_external_prereq ${TEST_EMACSCLIENT} || missing_dependencies=1
-+ test -z "$missing_dependencies" || return
++ test_require_emacs || return
+
+ if [ -z "$EMACS_SERVER" ]; then
+ emacs_tests="$NOTMUCH_SRCDIR/test/${this_test_bare}.el"
@@ test/test-lib.sh: unset ALTERNATE_EDITOR
unset NAME
-test_require_emacs () {
-- test_require_external_prereq emacs
-- test_require_external_prereq ${TEST_EMACSCLIENT}
-- test_require_external_prereq dtach
+- local ret=0
+- test_require_external_prereq "$TEST_EMACS" || ret=1
+- test_require_external_prereq "$TEST_EMACSCLIENT" || ret=1
+- test_require_external_prereq dtach || ret=1
+- return $ret
-}
-
- add_gnupg_home ()
- {
+ add_gnupg_home () {
[ -e "${GNUPGHOME}/gpg.conf" ] && return
+ _gnupg_exit () { gpgconf --kill all 2>/dev/null || true; }
@@ test/test-lib.sh: export GNUPGHOME="${TEST_TMPDIR}/gnupg"
trap 'trap_exit' EXIT
trap 'trap_signal' HUP INT TERM
@@ test/test-lib.sh: export GNUPGHOME="${TEST_TMPDIR}/gnupg"
-# Accepts arbitrary extra emacs/elisp functions to modify the message
-# before sending, which is useful to doing things like attaching files
-# to the message and encrypting/signing.
--emacs_deliver_message ()
--{
+-emacs_deliver_message () {
- local subject body smtp_dummy_pid smtp_dummy_port
- subject="$1"
- body="$2"
@@ test/test-lib.sh: export GNUPGHOME="${TEST_TMPDIR}/gnupg"
-# If any GNU-style long-arguments (like --quiet or --decrypt=true) are
-# at the head of the argument list, they are sent directly to "notmuch
-# new" after message delivery
--emacs_fcc_message ()
--{
+-emacs_fcc_message () {
- local nmn_args subject body
- nmn_args=''
- while [[ "$1" =~ ^-- ]]; do
@@ test/test-lib.sh: test_json_nodes () {
- fi
-}
-
- NOTMUCH_NEW ()
- {
+ NOTMUCH_NEW () {
notmuch new "${@}" | grep -v -E -e '^Processed [0-9]*( total)? file|Found [0-9]* total file'
+ }
@@ test/test-lib.sh: test_done () {
fi
}
@@ test/test-lib.sh: test_done () {
-
-test_emacs () {
- # test dependencies beforehand to avoid the waiting loop below
-- missing_dependencies=
-- test_require_external_prereq dtach || missing_dependencies=1
-- test_require_external_prereq emacs || missing_dependencies=1
-- test_require_external_prereq ${TEST_EMACSCLIENT} || missing_dependencies=1
-- test -z "$missing_dependencies" || return
+- test_require_emacs || return
-
- if [ -z "$EMACS_SERVER" ]; then
- emacs_tests="$NOTMUCH_SRCDIR/test/${this_test_bare}.el"
@@ test/test-lib.sh: test_done () {
- ${TEST_EMACSCLIENT} --socket-name="$EMACS_SERVER" --eval "(notmuch-test-progn $*)"
-}
-
- test_python() {
+ test_python () {
# Note: if there is need to print debug information from python program,
# use stdout = os.fdopen(6, 'w') or stderr = os.fdopen(7, 'w')
@@ test/test-lib.sh: TEST_DIRECTORY=$NOTMUCH_BUILDDIR/test
--
2.31.1
next reply other threads:[~2021-05-15 20:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-15 20:47 Felipe Contreras [this message]
2021-05-15 20:47 ` [PATCH v2 1/6] test: trivial style cleanups Felipe Contreras
2021-05-15 20:47 ` [PATCH v2 2/6] test: more style fixes Felipe Contreras
2021-05-16 12:08 ` David Bremner
2021-05-16 18:16 ` Felipe Contreras
2021-05-17 11:16 ` David Bremner
2021-05-15 20:47 ` [PATCH v2 3/6] test: emacs: simplify missing dependencies check Felipe Contreras
2021-05-15 20:47 ` [PATCH v2 4/6] test: emacs: check for configured emacs Felipe Contreras
2021-05-15 20:47 ` [PATCH v2 5/6] test: emacs: fix a couple of shellcheck complaints Felipe Contreras
2021-05-15 20:47 ` [PATCH v2 6/6] test: split emacs functionality to its own file Felipe Contreras
2021-05-17 11:17 ` [PATCH v2 0/6] test: several cleanups 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=20210515204744.965206-1-felipe.contreras@gmail.com \
--to=felipe.contreras@gmail.com \
--cc=dkg@fifthhorseman.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).