From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id IDuwOpkYCGJPywAAgWs5BA (envelope-from ) for ; Sat, 12 Feb 2022 21:29:13 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id GJp+M5kYCGLBcgAAG6o9tA (envelope-from ) for ; Sat, 12 Feb 2022 21:29:13 +0100 Received: from mail.notmuchmail.org (yantan.tethera.net [IPv6:2a01:4f9:c011:7a79::1]) (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 7CB3B2D21F for ; Sat, 12 Feb 2022 21:29:13 +0100 (CET) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id F0B6B5F724; Sat, 12 Feb 2022 20:28:59 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id 79EEA5F73C for ; Sat, 12 Feb 2022 20:28:55 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id E31C55FBD6; Sat, 12 Feb 2022 15:28:54 -0500 (EST) Received: (nullmailer pid 2577354 invoked by uid 1000); Sat, 12 Feb 2022 20:27:56 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH v4 04/11] perf-test: allow running test_emacs from performance test suite. Date: Sat, 12 Feb 2022 16:27:35 -0400 Message-Id: <20220212202742.2577237-5-david@tethera.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220212202742.2577237-1-david@tethera.net> References: <20220212202742.2577237-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: QK64BXX6YK5QHQDO2H3HDO3JA53IGUTN X-Message-ID-Hash: QK64BXX6YK5QHQDO2H3HDO3JA53IGUTN X-MailFrom: bremner@tethera.net 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; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-Country: DE ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1644697753; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post; bh=YoykPERCMX6RDHJ7+jGwQfuafSBcKyzpjSehUqe11jY=; b=NqZ3s9p40CWwFEb1E8r21m/+DUfa2fuePhO6uaqAKj0TlDFqzRkEBfCF+nYFbTe8PirYuB HGflQoXwxhkZB8McX2xkQxaxnz9DFB17wi7hR+gcJ7Js4pyoaYMrt304d2u1i/hV3rXkUb iVdL6ZGs6UisVQsTA4dE+IgyJrzsYfs78QYzSHTDA43M/w+ifOrh/P3Mx465QqHj6lDOJJ w18ypmRMKL47Iw31eCV+PYLxI3lnZrs8C0Es4CRJerHXCiBscg6+frptyiGCzXz3Ph17oO GAlFjjximyc60UsHvWYXT/7bDHwm9kwSakDBaT72AOExTN4DBaiuKznJ7vxzqw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1644697753; a=rsa-sha256; cv=none; b=TLTVQ8LL6sRZxUBD/59pymggSoD37YdWRkgzjh6RuYVM8nn3ExSFELyRPOU8sSQVRkYsHo O8rgrKM+WStaun4z+ZPlgnhWXXrxsRKB4OzKwuHPzr81Y+f/pa0SR4/QxDETy02nuNc4lS axv96jKJ2kzFh8W80RS30xKOjQVaKWE3lpV/ncjS7dDHhqNnTWzLXxNqVM1lIWOM/NBED0 68XTepeesSnLoDq4RaqjLdc7M8hPFvX9LtClWz4vCjOMcsmxHZDWxhdB71TgvSrbtwhVLU fUrU/f3Vpw615XztbXaUpyN9WcKwTRUq+/8Niw968npv+ZLBB55xbDpYineotA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -1.34 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 7CB3B2D21F X-Spam-Score: -1.34 X-Migadu-Scanner: scn1.migadu.com X-TUID: 1STskkZGX8d1 test_require_external prereq has to move to test-lib-common.sh, and the new shell functions print_emacs_header and time_emacs are provided. The somewhat indirect way of printing the output is to avoid the extra "" present on string values from emacsclient. --- performance-test/perf-test-lib.sh | 5 +++++ test/test-lib-common.sh | 14 ++++++++++++++ test/test-lib-emacs.sh | 8 ++++++++ test/test-lib.el | 5 +++++ test/test-lib.sh | 14 -------------- 5 files changed, 32 insertions(+), 14 deletions(-) diff --git a/performance-test/perf-test-lib.sh b/performance-test/perf-test-lib.sh index 0e4915e3..c34f8cd6 100644 --- a/performance-test/perf-test-lib.sh +++ b/performance-test/perf-test-lib.sh @@ -210,6 +210,11 @@ print_header () printf "\t\t\tWall(s)\tUsr(s)\tSys(s)\tRes(K)\tIn/Out(512B)\n" } +print_emacs_header () +{ + printf "\t\t\tWall(s)\tGCs\tGC time(s)\n" +} + time_run () { printf " %-22s" "$1" diff --git a/test/test-lib-common.sh b/test/test-lib-common.sh index ebbf4cdf..18fa29c0 100644 --- a/test/test-lib-common.sh +++ b/test/test-lib-common.sh @@ -29,6 +29,20 @@ if [[ -z "$NOTMUCH_SRCDIR" ]] || [[ -z "$NOTMUCH_BUILDDIR" ]]; then exit 1 fi +# Explicitly require external prerequisite. Useful when binary is +# called indirectly (e.g. from emacs). +# Returns success if dependency is available, failure otherwise. +test_require_external_prereq () { + local binary + binary="$1" + if [[ ${test_missing_external_prereq_["${binary}"]} == t ]]; then + # dependency is missing, call the replacement function to note it + eval "$binary" + else + true + fi +} + backup_database () { test_name=$(basename $0 .sh) rm -rf $TMP_DIRECTORY/notmuch-dir-backup."$test_name" diff --git a/test/test-lib-emacs.sh b/test/test-lib-emacs.sh index a298526d..ad4c4aeb 100644 --- a/test/test-lib-emacs.sh +++ b/test/test-lib-emacs.sh @@ -207,4 +207,12 @@ test_emacs () { ${TEST_EMACSCLIENT} --socket-name="$EMACS_SERVER" --eval "(notmuch-test-progn $*)" } +time_emacs () { + rm -f MESSAGES + printf "%s" "$1" + shift + test_emacs "(test-time $*)" > emacs.out + tail -n 1 MESSAGES +} + emacs_generate_script diff --git a/test/test-lib.el b/test/test-lib.el index 6831b46f..79a9d4d6 100644 --- a/test/test-lib.el +++ b/test/test-lib.el @@ -186,6 +186,11 @@ running, quit if it terminated." (t (message "%s" err))) (with-current-buffer "*Messages*" (test-output "MESSAGES")))) +(defmacro test-time (&rest body) + `(let ((results (mapcar (lambda (x) (/ x 5.0)) (benchmark-run 5 ,@body)))) + (message "\t\t%0.2f\t%0.2f\t%0.2f" (nth 0 results) (nth 1 results) (nth 2 results)) + (with-current-buffer "*Messages*" (test-output "MESSAGES")))) + ;; For historical reasons, we hide deleted tags by default in the test ;; suite (setq notmuch-tag-deleted-formats diff --git a/test/test-lib.sh b/test/test-lib.sh index 89e5c6d8..59b6079d 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -603,20 +603,6 @@ $binary () { fi } -# Explicitly require external prerequisite. Useful when binary is -# called indirectly (e.g. from emacs). -# Returns success if dependency is available, failure otherwise. -test_require_external_prereq () { - local binary - binary="$1" - if [[ ${test_missing_external_prereq_["${binary}"]} == t ]]; then - # dependency is missing, call the replacement function to note it - eval "$binary" - else - true - fi -} - # You are not expected to call test_ok_ and test_failure_ directly, use # the text_expect_* functions instead. -- 2.34.1