From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.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 QIe4Ftvn+2GIJgEAgWs5BA (envelope-from ) for ; Thu, 03 Feb 2022 15:34:03 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id +M1YE9vn+2E/ZAAAauVa8A (envelope-from ) for ; Thu, 03 Feb 2022 15:34:03 +0100 Received: from mail.notmuchmail.org (yantan.tethera.net [135.181.149.255]) (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 1C1F32E3E4 for ; Thu, 3 Feb 2022 15:34:03 +0100 (CET) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 962525F749; Thu, 3 Feb 2022 14:33:14 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id 289285F73A for ; Thu, 3 Feb 2022 14:33:11 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id 852365FBD2; Thu, 3 Feb 2022 09:33:10 -0500 (EST) Received: (nullmailer pid 3348405 invoked by uid 1000); Thu, 03 Feb 2022 14:32:56 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [RFC PATCH v2 05/12] perf-test: allow running test_emacs from performance test suite. Date: Thu, 3 Feb 2022 10:32:47 -0400 Message-Id: <20220203143254.3344753-6-david@tethera.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220203143254.3344753-1-david@tethera.net> References: <20220203143254.3344753-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: 4VIH47LBKIG3IMFQOW3V5HZQOVSFZXIV X-Message-ID-Hash: 4VIH47LBKIG3IMFQOW3V5HZQOVSFZXIV 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=1643898843; 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=P44roM/pvpWavYvRSUenA1kMwYCYh8UdnZ9kCLcoaT4=; b=OoPDTHtGSjGVwuZkQpjsi568Wtci1kcU35Jv2bh9AH/it7TB7WsBGw1b2E0y/hl3YbPfOz xCqmcU3cmtBswoET+IJnkzX7B20mQA2zHDKd3a3YTQDAQEuXCQzVx0sTUhQ/fP/37PgNwd V8Y6Pdl+1xeQVCYHq4VN1YxfJI6lZnXLIteH2LkE11i4cTrSr6LoVLumoRtVEalLirbGRJ fBeF9K9vBARsYr+Hs/yQ4j5BHMiUxUXLpfus0gqnbQTGYvdM5cel4CiU3FvBBrHD5gyf8Z TaM6rrG/4JQdsyHW5Jn1LhAAErDqi/bfV792P/aAaCgsQaYUhRPpXLqxYLEr+g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1643898843; a=rsa-sha256; cv=none; b=PGL94nPJaYnjyv5+pyPRrgutdWhpjlNvY1ILX1jkcusuMtZ+vG6efS5yYIrjmdorsZmO6e 8a+uiOX90k80oz3NQRBL1t/nFCNsTTHxJkduvgZUdJ0UrMdHvdGeawZbQBPWceO+Lfhcen SAqIqF+XbC1VlptbYipy9X+dr4jaN+Cf5p+cqvo8aOCrj8gbiHgMSqf0/JZhc5nw5FOyij 75YncSkCxm5hGmG+4yp0hPAdaTIo6nMRJ+MKt/eVMG8V/vvOt+JGtXUHqFkqWSO0tkwbco YXQ22CLn4GcBPS6zh+C0Vpf7kbHCIX6c9I/a/Cvf2vX0mZoa/iNBqjHvSlLt1A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -1.35 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 1C1F32E3E4 X-Spam-Score: -1.35 X-Migadu-Scanner: scn0.migadu.com X-TUID: whZoS3XwPFNm 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 adabda4a..1b5e8549 100644 --- a/test/test-lib.el +++ b/test/test-lib.el @@ -188,6 +188,11 @@ running, quit if it terminated." (with-current-buffer (get-buffer-create "*Notmuch errors*") (test-output "ERRORS")))) +(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