git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Couder <christian.couder@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>, "Jeff King" <peff@peff.net>,
	"Thomas Rast" <tr@thomasrast.ch>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Christian Couder" <chriscool@tuxfamily.org>,
	"Eric Sunshine" <sunshine@sunshineco.com>,
	"Philip Oakley" <philipoakley@iee.org>
Subject: [PATCH v1 1/2] perf/run: add --subsection option
Date: Sun,  8 Apr 2018 11:35:12 +0200	[thread overview]
Message-ID: <20180408093513.17769-2-chriscool@tuxfamily.org> (raw)
In-Reply-To: <20180408093513.17769-1-chriscool@tuxfamily.org>

This new option makes it possible to run perf tests as defined
in only one subsection of a config file.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 t/perf/run | 56 ++++++++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 46 insertions(+), 10 deletions(-)

diff --git a/t/perf/run b/t/perf/run
index 213da5d6b9..9aaa733c77 100755
--- a/t/perf/run
+++ b/t/perf/run
@@ -1,21 +1,34 @@
 #!/bin/sh
 
-case "$1" in
+die () {
+	echo >&2 "error: $*"
+	exit 1
+}
+
+while [ $# -gt 0 ]; do
+	arg="$1"
+	case "$arg" in
+	--)
+		break ;;
 	--help)
-		echo "usage: $0 [--config file] [other_git_tree...] [--] [test_scripts]"
-		exit 0
-		;;
+		echo "usage: $0 [--config file] [--subsection subsec] [other_git_tree...] [--] [test_scripts]"
+		exit 0 ;;
 	--config)
 		shift
 		GIT_PERF_CONFIG_FILE=$(cd "$(dirname "$1")"; pwd)/$(basename "$1")
 		export GIT_PERF_CONFIG_FILE
 		shift ;;
-esac
-
-die () {
-	echo >&2 "error: $*"
-	exit 1
-}
+	--subsection)
+		shift
+		GIT_PERF_SUBSECTION="$1"
+		export GIT_PERF_SUBSECTION
+		shift ;;
+	--*)
+		die "unrecognised option: '$arg'" ;;
+	*)
+		break ;;
+	esac
+done
 
 run_one_dir () {
 	if test $# -eq 0; then
@@ -172,9 +185,32 @@ get_subsections "perf" >test-results/run_subsections.names
 
 if test $(wc -l <test-results/run_subsections.names) -eq 0
 then
+	if test -n "$GIT_PERF_SUBSECTION"
+	then
+		if test -n "$GIT_PERF_CONFIG_FILE"
+		then
+			die "no subsections are defined in config file '$GIT_PERF_CONFIG_FILE'"
+		else
+			die "subsection '$GIT_PERF_SUBSECTION' defined without a config file"
+		fi
+	fi
 	(
 		run_subsection "$@"
 	)
+elif test -n "$GIT_PERF_SUBSECTION"
+then
+	egrep "^$GIT_PERF_SUBSECTION\$" test-results/run_subsections.names >/dev/null ||
+		die "subsection '$GIT_PERF_SUBSECTION' not found in '$GIT_PERF_CONFIG_FILE'"
+
+	egrep "^$GIT_PERF_SUBSECTION\$" test-results/run_subsections.names | while read -r subsec
+	do
+		(
+			GIT_PERF_SUBSECTION="$subsec"
+			export GIT_PERF_SUBSECTION
+			echo "======== Run for subsection '$GIT_PERF_SUBSECTION' ========"
+			run_subsection "$@"
+		)
+	done
 else
 	while read -r subsec
 	do
-- 
2.17.0.rc1.36.g098d832c9.dirty


  reply	other threads:[~2018-04-08  9:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-08  9:35 [PATCH v1 0/2] t/perf: bisect performance regressions Christian Couder
2018-04-08  9:35 ` Christian Couder [this message]
2018-04-08  9:44   ` [PATCH v1 1/2] perf/run: add --subsection option Eric Sunshine
2018-04-08  9:35 ` [PATCH v1 2/2] t/perf: add scripts to bisect performance regressions Christian Couder

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180408093513.17769-2-chriscool@tuxfamily.org \
    --to=christian.couder@gmail.com \
    --cc=avarab@gmail.com \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=philipoakley@iee.org \
    --cc=sunshine@sunshineco.com \
    --cc=tr@thomasrast.ch \
    /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.
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 NNTP newsgroup(s).