From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id KO7bA5wzoGBQ2wAAgWs5BA (envelope-from ) for ; Sat, 15 May 2021 22:48:28 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id wC4IO5szoGD5fAAAB5/wlQ (envelope-from ) for ; Sat, 15 May 2021 20:48:27 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [144.217.243.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 48EE6B329 for ; Sat, 15 May 2021 22:48:27 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id C3F7228294; Sat, 15 May 2021 16:48:11 -0400 (EDT) Received: from mail-oi1-x22f.google.com (mail-oi1-x22f.google.com [IPv6:2607:f8b0:4864:20::22f]) by mail.notmuchmail.org (Postfix) with ESMTPS id A62B326BF0 for ; Sat, 15 May 2021 16:48:06 -0400 (EDT) Received: by mail-oi1-x22f.google.com with SMTP id w22so2893313oiw.9 for ; Sat, 15 May 2021 13:48:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=1silrAgePEjIZQupN68fAF8LnbpyEDbEhFUECFUk4ZM=; b=lSwR1rrsZmP9cq78rbuLz4j16X/XGPetaqUhkLel+BcuRf9jEBiN/IJqy6/n6fh2PT qy9LVt3Sn/9NFBfTdBic8P1hp7N7lAy+QD02ALBWK82V1iBqtVXTvNv169WHdPANBPkq czNF03v3w7WMcbDmPLlRh2jw+N1vE9BhZQvnYcPBdGDq6lSNZgURZzExeB5PhZl7fScT v3fx+5Po5wBA6hp7c88J1ViXTtsgGAATThG6CUlaGA0chgre4zltMqnEAXTAEVAHX4aQ tjUV1NSEcmZmdzTVevPQo2DlQi+RaKJxyo2maLKRZa3w/pwkV/a3a2foQhNq6S8ro/M/ o5rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=1silrAgePEjIZQupN68fAF8LnbpyEDbEhFUECFUk4ZM=; b=k5dkNzAZ6Y5XgWmxv2IghvcBlv77BMgsKS0Ca+Vze2V21HOk40vSKj/Mq/IpCiU78e HzOwjAMj3gGLmF1lK6o4Rrla6FHB8g7OIUqq8QaCNv7PO1wzKDq1cfi99qWAsTssSbos 4QNyYDXHaaNEDQ6rSVWDOv8guCcYYTmFcRePoZdwTVrhDBkb73yXnfoemfhXL6aeLcWq V5uKfZC+7VUrVQrcXFBMhbk1//AlLRu1bZ54O0c4HK5aOl6R1Y++deaJ9OfuadAPbV2+ 3OkcifayLaLSmihG4FGyCefT1A8WDoITcfAjX8yy2crAcbsq518w6H/bGDsTIlFAl0mc amFA== X-Gm-Message-State: AOAM530fUQTnwJab6B7YiwbHFCOWvVrp9R4B7U82jtx8am4q1ccnqDpv Yoej8WMXzUAG7XBZfdM+Xbq2S2ygqu7gHw== X-Google-Smtp-Source: ABdhPJwMcZ06ByriTUtkpzsh4SoXJ9uofLpgd+Ov3NpUHZ7wDuiiQRMJPowM31CzIry8FSN3VDg+5A== X-Received: by 2002:a05:6808:8c4:: with SMTP id k4mr38283170oij.40.1621111682151; Sat, 15 May 2021 13:48:02 -0700 (PDT) Received: from localhost (fixed-187-189-165-231.totalplay.net. [187.189.165.231]) by smtp.gmail.com with ESMTPSA id c19sm1848521oiw.7.2021.05.15.13.48.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 May 2021 13:48:01 -0700 (PDT) From: Felipe Contreras To: notmuch@notmuchmail.org Subject: [PATCH v2 0/6] test: several cleanups Date: Sat, 15 May 2021 15:47:38 -0500 Message-Id: <20210515204744.965206-1-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Message-ID-Hash: PBPAKYAQRD6PGYL3ITM76W3BLIQJDGMQ X-Message-ID-Hash: PBPAKYAQRD6PGYL3ITM76W3BLIQJDGMQ X-MailFrom: felipe.contreras@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Daniel Kahn Gillmor X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1621111707; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=qDAXmDrxHlhvR0g1r+PTMAp3OivcZjoOrriGVcgFrgw=; b=f+1J+l5UYvQ880wupoys5DKhv70PDDc7M+QuzFuVPtNrfXad8/2CXqzQx329oAKZ2KSz1j ElkqXKr+qdfynEbMjxmR3r5KoL/nUzxkunJE7qPkg+5ZiePRL4iB8bgohQfDSb+yUo/okl QDv/FIx1Pq5o/IIHG2BmHX+P4xBQ9IbDOlInVlN+fJl6gh3C92zHh/f/ZzmyWF3obs52Of tsHNpsQkUxCmqSFUA8oyt3oPJsDVrmqy0FiqZiN1j3ivm8MkggL6TJnXPn/ZQ39BP2+NEs XNzq4ktQdpZCl4uhNhpYiqLQVAxIIkzusD3OqPQeoRioxydfQDIWKm+nzb5L6w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1621111707; a=rsa-sha256; cv=none; b=kEgEzPIJV33X5GVqtUEWfvtxiQMuh7+TkSgf8CcelP4dg5hiXPMGYHGVi2XHjNre0dGQ+b j5EIWPiDZnl10MYuAJ/+MycaF8lX2irw8bspV8Ea2nbDBa/xoX43WgMeOAb3P/BldXmJGi 5zZCZnbBg/WU3qi2BCQgyBChqFFDq3fob1Rr81jgbaXJ4IOntpjusUGCuhD0PmGwbS7lOH MZWhXB1X+N2Ny4a1JJGiwAOAV0L7VqbExQlX8F9nJuYL9iVLmtB+TJbQPz+ePw2o1lyih9 qbph+PsHBV2zLNdeDyjqT2ZYD0x/H6GrRBk1pOajwbg5LD1mnL27usRHKgBDfQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20161025 header.b=lSwR1rrs; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -0.97 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20161025 header.b=lSwR1rrs; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 48EE6B329 X-Spam-Score: -0.97 X-Migadu-Scanner: scn0.migadu.com X-TUID: RsbFGuuhhaSI 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 - ## 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 - ## 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 - ## 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