perf/run: add --subsection option
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
2e3efd0613
commit
8796b307ea
60
t/perf/run
60
t/perf/run
@ -1,22 +1,35 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
--help)
|
|
||||||
echo "usage: $0 [--config file] [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 () {
|
die () {
|
||||||
echo >&2 "error: $*"
|
echo >&2 "error: $*"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
arg="$1"
|
||||||
|
case "$arg" in
|
||||||
|
--)
|
||||||
|
break ;;
|
||||||
|
--help)
|
||||||
|
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 ;;
|
||||||
|
--subsection)
|
||||||
|
shift
|
||||||
|
GIT_PERF_SUBSECTION="$1"
|
||||||
|
export GIT_PERF_SUBSECTION
|
||||||
|
shift ;;
|
||||||
|
--*)
|
||||||
|
die "unrecognised option: '$arg'" ;;
|
||||||
|
*)
|
||||||
|
break ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
run_one_dir () {
|
run_one_dir () {
|
||||||
if test $# -eq 0; then
|
if test $# -eq 0; then
|
||||||
set -- p????-*.sh
|
set -- p????-*.sh
|
||||||
@ -172,9 +185,32 @@ get_subsections "perf" >test-results/run_subsections.names
|
|||||||
|
|
||||||
if test $(wc -l <test-results/run_subsections.names) -eq 0
|
if test $(wc -l <test-results/run_subsections.names) -eq 0
|
||||||
then
|
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 "$@"
|
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
|
else
|
||||||
while read -r subsec
|
while read -r subsec
|
||||||
do
|
do
|
||||||
|
Reference in New Issue
Block a user