2012-02-17 10:25:09 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2018-04-08 09:35:12 +00:00
|
|
|
die () {
|
|
|
|
echo >&2 "error: $*"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
arg="$1"
|
|
|
|
case "$arg" in
|
|
|
|
--)
|
|
|
|
break ;;
|
2012-02-17 10:25:09 +00:00
|
|
|
--help)
|
2018-04-08 09:35:12 +00:00
|
|
|
echo "usage: $0 [--config file] [--subsection subsec] [other_git_tree...] [--] [test_scripts]"
|
|
|
|
exit 0 ;;
|
2017-09-23 19:55:56 +00:00
|
|
|
--config)
|
|
|
|
shift
|
|
|
|
GIT_PERF_CONFIG_FILE=$(cd "$(dirname "$1")"; pwd)/$(basename "$1")
|
|
|
|
export GIT_PERF_CONFIG_FILE
|
|
|
|
shift ;;
|
2018-04-08 09:35:12 +00:00
|
|
|
--subsection)
|
|
|
|
shift
|
|
|
|
GIT_PERF_SUBSECTION="$1"
|
|
|
|
export GIT_PERF_SUBSECTION
|
|
|
|
shift ;;
|
|
|
|
--*)
|
|
|
|
die "unrecognised option: '$arg'" ;;
|
|
|
|
*)
|
|
|
|
break ;;
|
|
|
|
esac
|
|
|
|
done
|
2012-02-17 10:25:09 +00:00
|
|
|
|
|
|
|
run_one_dir () {
|
|
|
|
if test $# -eq 0; then
|
|
|
|
set -- p????-*.sh
|
|
|
|
fi
|
|
|
|
echo "=== Running $# tests in ${GIT_TEST_INSTALLED:-this tree} ==="
|
|
|
|
for t in "$@"; do
|
|
|
|
./$t $GIT_TEST_OPTS
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
unpack_git_rev () {
|
|
|
|
rev=$1
|
2017-05-20 21:42:19 +00:00
|
|
|
echo "=== Unpacking $rev in build/$rev ==="
|
2012-02-17 10:25:09 +00:00
|
|
|
mkdir -p build/$rev
|
|
|
|
(cd "$(git rev-parse --show-cdup)" && git archive --format=tar $rev) |
|
|
|
|
(cd build/$rev && tar x)
|
|
|
|
}
|
2017-09-23 19:55:56 +00:00
|
|
|
|
2012-02-17 10:25:09 +00:00
|
|
|
build_git_rev () {
|
|
|
|
rev=$1
|
2017-09-23 19:55:56 +00:00
|
|
|
name="$2"
|
2016-09-13 06:58:00 +00:00
|
|
|
for config in config.mak config.mak.autogen config.status
|
|
|
|
do
|
|
|
|
if test -e "../../$config"
|
|
|
|
then
|
|
|
|
cp "../../$config" "build/$rev/"
|
|
|
|
fi
|
|
|
|
done
|
2017-09-23 19:55:56 +00:00
|
|
|
echo "=== Building $rev ($name) ==="
|
2017-05-20 21:42:18 +00:00
|
|
|
(
|
|
|
|
cd build/$rev &&
|
|
|
|
if test -n "$GIT_PERF_MAKE_COMMAND"
|
|
|
|
then
|
|
|
|
sh -c "$GIT_PERF_MAKE_COMMAND"
|
|
|
|
else
|
|
|
|
make $GIT_PERF_MAKE_OPTS
|
|
|
|
fi
|
|
|
|
) || die "failed to build revision '$mydir'"
|
2012-02-17 10:25:09 +00:00
|
|
|
}
|
|
|
|
|
perf-lib.sh: remove GIT_TEST_INSTALLED from perf-lib.sh
Follow-up my preceding change which fixed the immediate "./run
<revisions>" regression in 0baf78e7bc ("perf-lib.sh: rely on
test-lib.sh for --tee handling", 2019-03-15) and entirely get rid of
GIT_TEST_INSTALLED from perf-lib.sh (and aggregate.perl).
As noted in that change the dance we're doing with GIT_TEST_INSTALLED
perf-lib.sh isn't necessary, but there I was doing the most minimal
set of changes to quickly fix a regression.
But it's much simpler to never deal with the "GIT_TEST_INSTALLED" we
were setting in perf-lib.sh at all. Instead the run_dirs_helper() sets
the previously inferred $PERF_RESULTS_PREFIX directly.
Setting this at the callsite that's already best positioned to
exhaustively know about all the different cases we need to handle
where PERF_RESULTS_PREFIX isn't what we want already (the empty
string) makes the most sense. In one-off cases like:
./run ./p0000-perf-lib-sanity.sh
./p0000-perf-lib-sanity.sh
We'll just do the right thing because PERF_RESULTS_PREFIX will be
empty, and test-lib.sh takes care of finding where our git is.
Any refactoring of this code needs to change both the shell code and
the Perl code in aggregate.perl, because when running e.g.:
./run ../../ -- <test>
The "../../" path to a relative bindir needs to be munged to a
filename containing the results, and critically aggregate.perl does
not get passed the path to those aggregations, just "../..".
Let's fix cases where aggregate.perl would print e.g. ".." in its
report output for this, and "git" for "/home/avar/g/git", i.e. it
would always pick the last element. Now'll always print the full path
instead.
This also makes the code sturdier, e.g. you can feed "../.." to
"./run" and then an absolute path to the aggregate.perl script, as
long as the absolute path and "../.." resolved to the same directory
printing the aggregation will work.
Also simplify the "[_*]" on the RHS of "tr -c", we're trimming
everything to "_", so we don't need that.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
2019-05-07 10:54:32 +00:00
|
|
|
set_git_test_installed () {
|
|
|
|
mydir=$1
|
|
|
|
|
|
|
|
mydir_abs=$(cd $mydir && pwd)
|
2021-09-21 15:46:12 +00:00
|
|
|
mydir_abs_wrappers="$mydir_abs/bin-wrappers"
|
perf-lib.sh: remove GIT_TEST_INSTALLED from perf-lib.sh
Follow-up my preceding change which fixed the immediate "./run
<revisions>" regression in 0baf78e7bc ("perf-lib.sh: rely on
test-lib.sh for --tee handling", 2019-03-15) and entirely get rid of
GIT_TEST_INSTALLED from perf-lib.sh (and aggregate.perl).
As noted in that change the dance we're doing with GIT_TEST_INSTALLED
perf-lib.sh isn't necessary, but there I was doing the most minimal
set of changes to quickly fix a regression.
But it's much simpler to never deal with the "GIT_TEST_INSTALLED" we
were setting in perf-lib.sh at all. Instead the run_dirs_helper() sets
the previously inferred $PERF_RESULTS_PREFIX directly.
Setting this at the callsite that's already best positioned to
exhaustively know about all the different cases we need to handle
where PERF_RESULTS_PREFIX isn't what we want already (the empty
string) makes the most sense. In one-off cases like:
./run ./p0000-perf-lib-sanity.sh
./p0000-perf-lib-sanity.sh
We'll just do the right thing because PERF_RESULTS_PREFIX will be
empty, and test-lib.sh takes care of finding where our git is.
Any refactoring of this code needs to change both the shell code and
the Perl code in aggregate.perl, because when running e.g.:
./run ../../ -- <test>
The "../../" path to a relative bindir needs to be munged to a
filename containing the results, and critically aggregate.perl does
not get passed the path to those aggregations, just "../..".
Let's fix cases where aggregate.perl would print e.g. ".." in its
report output for this, and "git" for "/home/avar/g/git", i.e. it
would always pick the last element. Now'll always print the full path
instead.
This also makes the code sturdier, e.g. you can feed "../.." to
"./run" and then an absolute path to the aggregate.perl script, as
long as the absolute path and "../.." resolved to the same directory
printing the aggregation will work.
Also simplify the "[_*]" on the RHS of "tr -c", we're trimming
everything to "_", so we don't need that.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
2019-05-07 10:54:32 +00:00
|
|
|
if test -d "$mydir_abs_wrappers"
|
|
|
|
then
|
|
|
|
GIT_TEST_INSTALLED=$mydir_abs_wrappers
|
|
|
|
else
|
|
|
|
# Older versions of git lacked bin-wrappers;
|
|
|
|
# fallback to the files in the root.
|
|
|
|
GIT_TEST_INSTALLED=$mydir_abs
|
|
|
|
fi
|
|
|
|
export GIT_TEST_INSTALLED
|
2019-05-07 10:54:34 +00:00
|
|
|
PERF_SET_GIT_TEST_INSTALLED=true
|
|
|
|
export PERF_SET_GIT_TEST_INSTALLED
|
perf-lib.sh: remove GIT_TEST_INSTALLED from perf-lib.sh
Follow-up my preceding change which fixed the immediate "./run
<revisions>" regression in 0baf78e7bc ("perf-lib.sh: rely on
test-lib.sh for --tee handling", 2019-03-15) and entirely get rid of
GIT_TEST_INSTALLED from perf-lib.sh (and aggregate.perl).
As noted in that change the dance we're doing with GIT_TEST_INSTALLED
perf-lib.sh isn't necessary, but there I was doing the most minimal
set of changes to quickly fix a regression.
But it's much simpler to never deal with the "GIT_TEST_INSTALLED" we
were setting in perf-lib.sh at all. Instead the run_dirs_helper() sets
the previously inferred $PERF_RESULTS_PREFIX directly.
Setting this at the callsite that's already best positioned to
exhaustively know about all the different cases we need to handle
where PERF_RESULTS_PREFIX isn't what we want already (the empty
string) makes the most sense. In one-off cases like:
./run ./p0000-perf-lib-sanity.sh
./p0000-perf-lib-sanity.sh
We'll just do the right thing because PERF_RESULTS_PREFIX will be
empty, and test-lib.sh takes care of finding where our git is.
Any refactoring of this code needs to change both the shell code and
the Perl code in aggregate.perl, because when running e.g.:
./run ../../ -- <test>
The "../../" path to a relative bindir needs to be munged to a
filename containing the results, and critically aggregate.perl does
not get passed the path to those aggregations, just "../..".
Let's fix cases where aggregate.perl would print e.g. ".." in its
report output for this, and "git" for "/home/avar/g/git", i.e. it
would always pick the last element. Now'll always print the full path
instead.
This also makes the code sturdier, e.g. you can feed "../.." to
"./run" and then an absolute path to the aggregate.perl script, as
long as the absolute path and "../.." resolved to the same directory
printing the aggregation will work.
Also simplify the "[_*]" on the RHS of "tr -c", we're trimming
everything to "_", so we don't need that.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
2019-05-07 10:54:32 +00:00
|
|
|
}
|
|
|
|
|
2012-02-17 10:25:09 +00:00
|
|
|
run_dirs_helper () {
|
|
|
|
mydir=${1%/}
|
|
|
|
shift
|
|
|
|
while test $# -gt 0 -a "$1" != -- -a ! -f "$1"; do
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
if test $# -gt 0 -a "$1" = --; then
|
|
|
|
shift
|
|
|
|
fi
|
perf-lib.sh: remove GIT_TEST_INSTALLED from perf-lib.sh
Follow-up my preceding change which fixed the immediate "./run
<revisions>" regression in 0baf78e7bc ("perf-lib.sh: rely on
test-lib.sh for --tee handling", 2019-03-15) and entirely get rid of
GIT_TEST_INSTALLED from perf-lib.sh (and aggregate.perl).
As noted in that change the dance we're doing with GIT_TEST_INSTALLED
perf-lib.sh isn't necessary, but there I was doing the most minimal
set of changes to quickly fix a regression.
But it's much simpler to never deal with the "GIT_TEST_INSTALLED" we
were setting in perf-lib.sh at all. Instead the run_dirs_helper() sets
the previously inferred $PERF_RESULTS_PREFIX directly.
Setting this at the callsite that's already best positioned to
exhaustively know about all the different cases we need to handle
where PERF_RESULTS_PREFIX isn't what we want already (the empty
string) makes the most sense. In one-off cases like:
./run ./p0000-perf-lib-sanity.sh
./p0000-perf-lib-sanity.sh
We'll just do the right thing because PERF_RESULTS_PREFIX will be
empty, and test-lib.sh takes care of finding where our git is.
Any refactoring of this code needs to change both the shell code and
the Perl code in aggregate.perl, because when running e.g.:
./run ../../ -- <test>
The "../../" path to a relative bindir needs to be munged to a
filename containing the results, and critically aggregate.perl does
not get passed the path to those aggregations, just "../..".
Let's fix cases where aggregate.perl would print e.g. ".." in its
report output for this, and "git" for "/home/avar/g/git", i.e. it
would always pick the last element. Now'll always print the full path
instead.
This also makes the code sturdier, e.g. you can feed "../.." to
"./run" and then an absolute path to the aggregate.perl script, as
long as the absolute path and "../.." resolved to the same directory
printing the aggregation will work.
Also simplify the "[_*]" on the RHS of "tr -c", we're trimming
everything to "_", so we don't need that.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
2019-05-07 10:54:32 +00:00
|
|
|
|
|
|
|
PERF_RESULTS_PREFIX=
|
|
|
|
if test "$mydir" = "."
|
|
|
|
then
|
|
|
|
unset GIT_TEST_INSTALLED
|
|
|
|
elif test -d "$mydir"
|
|
|
|
then
|
2019-05-07 10:54:33 +00:00
|
|
|
PERF_RESULTS_PREFIX=bindir$(cd $mydir && printf "%s" "$(pwd)" | tr -c "[a-zA-Z0-9]" "_").
|
perf-lib.sh: remove GIT_TEST_INSTALLED from perf-lib.sh
Follow-up my preceding change which fixed the immediate "./run
<revisions>" regression in 0baf78e7bc ("perf-lib.sh: rely on
test-lib.sh for --tee handling", 2019-03-15) and entirely get rid of
GIT_TEST_INSTALLED from perf-lib.sh (and aggregate.perl).
As noted in that change the dance we're doing with GIT_TEST_INSTALLED
perf-lib.sh isn't necessary, but there I was doing the most minimal
set of changes to quickly fix a regression.
But it's much simpler to never deal with the "GIT_TEST_INSTALLED" we
were setting in perf-lib.sh at all. Instead the run_dirs_helper() sets
the previously inferred $PERF_RESULTS_PREFIX directly.
Setting this at the callsite that's already best positioned to
exhaustively know about all the different cases we need to handle
where PERF_RESULTS_PREFIX isn't what we want already (the empty
string) makes the most sense. In one-off cases like:
./run ./p0000-perf-lib-sanity.sh
./p0000-perf-lib-sanity.sh
We'll just do the right thing because PERF_RESULTS_PREFIX will be
empty, and test-lib.sh takes care of finding where our git is.
Any refactoring of this code needs to change both the shell code and
the Perl code in aggregate.perl, because when running e.g.:
./run ../../ -- <test>
The "../../" path to a relative bindir needs to be munged to a
filename containing the results, and critically aggregate.perl does
not get passed the path to those aggregations, just "../..".
Let's fix cases where aggregate.perl would print e.g. ".." in its
report output for this, and "git" for "/home/avar/g/git", i.e. it
would always pick the last element. Now'll always print the full path
instead.
This also makes the code sturdier, e.g. you can feed "../.." to
"./run" and then an absolute path to the aggregate.perl script, as
long as the absolute path and "../.." resolved to the same directory
printing the aggregation will work.
Also simplify the "[_*]" on the RHS of "tr -c", we're trimming
everything to "_", so we don't need that.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
2019-05-07 10:54:32 +00:00
|
|
|
set_git_test_installed "$mydir"
|
|
|
|
else
|
2012-02-17 10:25:09 +00:00
|
|
|
rev=$(git rev-parse --verify "$mydir" 2>/dev/null) ||
|
|
|
|
die "'$mydir' is neither a directory nor a valid revision"
|
|
|
|
if [ ! -d build/$rev ]; then
|
|
|
|
unpack_git_rev $rev
|
|
|
|
fi
|
2017-09-23 19:55:56 +00:00
|
|
|
build_git_rev $rev "$mydir"
|
2012-02-17 10:25:09 +00:00
|
|
|
mydir=build/$rev
|
perf-lib.sh: make "./run <revisions>" use the correct gits
Fix a really bad regression in 0baf78e7bc ("perf-lib.sh: rely on
test-lib.sh for --tee handling", 2019-03-15). Since that change all
runs of different <revisions> of git have used the git found in the
user's $PATH, e.g. /usr/bin/git instead of the <revision> we just
built and wanted to performance test.
The problem starts with GIT_TEST_INSTALLED not working like our
non-perf tests with the "run" script. I.e. you can't run performance
tests against a given installed git. Instead we expect to use it
ourselves to point GIT_TEST_INSTALLED to the <revision> we just built.
However, we had been relying on '$(cd "$GIT_TEST_INSTALLED" && pwd)'
to resolve that relative $GIT_TEST_INSTALLED to an absolute
path *before* test-lib.sh was loaded, in cases where it was
e.g. "build/<rev>/bin-wrappers" and we wanted "<abs_path>build/...".
This change post-dates another proposed solution by a few days[1], I
didn't notice that version when I initially wrote this. I'm doing the
most minimal thing to solve the regression here, a follow-up change
will move this result prefix selection logic entirely into the "run"
script.
This makes e.g. these cases all work:
./run . $PWD/../../ origin/master origin/next HEAD -- <tests>
As well as just a plain one-off:
./run <tests>
And, since we're passing down the new GIT_PERF_DIR_MYDIR_REL we make
sure the bug relating to aggregate.perl not finding our files as
described in 0baf78e7bc doesn't happen again.
What *doesn't* work is setting GIT_TEST_INSTALLED to a relative path,
this will subtly fail in test-lib.sh. This has always been the case
even before 0baf78e7bc, and as documented in t/README the
GIT_TEST_INSTALLED variable should be set to an absolute path (needs
to be set "to the bindir", which is always absolute), and the "perf"
framework expects to munge it itself.
Perhaps that should be dealt with in the future to allow manually
setting GIT_TEST_INSTALLED, but as a preceding commit showed the user
can just use the "run" script, which'll also pick the right output
directory for the test results as expected by aggregate.perl.
1. https://public-inbox.org/git/20190502222409.GA15631@sigill.intra.peff.net/
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
2019-05-07 10:54:31 +00:00
|
|
|
|
perf-lib.sh: remove GIT_TEST_INSTALLED from perf-lib.sh
Follow-up my preceding change which fixed the immediate "./run
<revisions>" regression in 0baf78e7bc ("perf-lib.sh: rely on
test-lib.sh for --tee handling", 2019-03-15) and entirely get rid of
GIT_TEST_INSTALLED from perf-lib.sh (and aggregate.perl).
As noted in that change the dance we're doing with GIT_TEST_INSTALLED
perf-lib.sh isn't necessary, but there I was doing the most minimal
set of changes to quickly fix a regression.
But it's much simpler to never deal with the "GIT_TEST_INSTALLED" we
were setting in perf-lib.sh at all. Instead the run_dirs_helper() sets
the previously inferred $PERF_RESULTS_PREFIX directly.
Setting this at the callsite that's already best positioned to
exhaustively know about all the different cases we need to handle
where PERF_RESULTS_PREFIX isn't what we want already (the empty
string) makes the most sense. In one-off cases like:
./run ./p0000-perf-lib-sanity.sh
./p0000-perf-lib-sanity.sh
We'll just do the right thing because PERF_RESULTS_PREFIX will be
empty, and test-lib.sh takes care of finding where our git is.
Any refactoring of this code needs to change both the shell code and
the Perl code in aggregate.perl, because when running e.g.:
./run ../../ -- <test>
The "../../" path to a relative bindir needs to be munged to a
filename containing the results, and critically aggregate.perl does
not get passed the path to those aggregations, just "../..".
Let's fix cases where aggregate.perl would print e.g. ".." in its
report output for this, and "git" for "/home/avar/g/git", i.e. it
would always pick the last element. Now'll always print the full path
instead.
This also makes the code sturdier, e.g. you can feed "../.." to
"./run" and then an absolute path to the aggregate.perl script, as
long as the absolute path and "../.." resolved to the same directory
printing the aggregation will work.
Also simplify the "[_*]" on the RHS of "tr -c", we're trimming
everything to "_", so we don't need that.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
2019-05-07 10:54:32 +00:00
|
|
|
PERF_RESULTS_PREFIX=build_$rev.
|
|
|
|
set_git_test_installed "$mydir"
|
2012-02-17 10:25:09 +00:00
|
|
|
fi
|
perf-lib.sh: remove GIT_TEST_INSTALLED from perf-lib.sh
Follow-up my preceding change which fixed the immediate "./run
<revisions>" regression in 0baf78e7bc ("perf-lib.sh: rely on
test-lib.sh for --tee handling", 2019-03-15) and entirely get rid of
GIT_TEST_INSTALLED from perf-lib.sh (and aggregate.perl).
As noted in that change the dance we're doing with GIT_TEST_INSTALLED
perf-lib.sh isn't necessary, but there I was doing the most minimal
set of changes to quickly fix a regression.
But it's much simpler to never deal with the "GIT_TEST_INSTALLED" we
were setting in perf-lib.sh at all. Instead the run_dirs_helper() sets
the previously inferred $PERF_RESULTS_PREFIX directly.
Setting this at the callsite that's already best positioned to
exhaustively know about all the different cases we need to handle
where PERF_RESULTS_PREFIX isn't what we want already (the empty
string) makes the most sense. In one-off cases like:
./run ./p0000-perf-lib-sanity.sh
./p0000-perf-lib-sanity.sh
We'll just do the right thing because PERF_RESULTS_PREFIX will be
empty, and test-lib.sh takes care of finding where our git is.
Any refactoring of this code needs to change both the shell code and
the Perl code in aggregate.perl, because when running e.g.:
./run ../../ -- <test>
The "../../" path to a relative bindir needs to be munged to a
filename containing the results, and critically aggregate.perl does
not get passed the path to those aggregations, just "../..".
Let's fix cases where aggregate.perl would print e.g. ".." in its
report output for this, and "git" for "/home/avar/g/git", i.e. it
would always pick the last element. Now'll always print the full path
instead.
This also makes the code sturdier, e.g. you can feed "../.." to
"./run" and then an absolute path to the aggregate.perl script, as
long as the absolute path and "../.." resolved to the same directory
printing the aggregation will work.
Also simplify the "[_*]" on the RHS of "tr -c", we're trimming
everything to "_", so we don't need that.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
2019-05-07 10:54:32 +00:00
|
|
|
export PERF_RESULTS_PREFIX
|
|
|
|
|
2012-02-17 10:25:09 +00:00
|
|
|
run_one_dir "$@"
|
|
|
|
}
|
|
|
|
|
|
|
|
run_dirs () {
|
|
|
|
while test $# -gt 0 -a "$1" != -- -a ! -f "$1"; do
|
|
|
|
run_dirs_helper "$@"
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2017-09-23 19:55:56 +00:00
|
|
|
get_subsections () {
|
|
|
|
section="$1"
|
|
|
|
test -z "$GIT_PERF_CONFIG_FILE" && return
|
|
|
|
git config -f "$GIT_PERF_CONFIG_FILE" --name-only --get-regex "$section\..*\.[^.]+" |
|
|
|
|
sed -e "s/$section\.\(.*\)\..*/\1/" | sort | uniq
|
|
|
|
}
|
|
|
|
|
2017-09-23 19:55:56 +00:00
|
|
|
get_var_from_env_or_config () {
|
|
|
|
env_var="$1"
|
2017-09-23 19:55:56 +00:00
|
|
|
conf_sec="$2"
|
|
|
|
conf_var="$3"
|
2018-01-05 09:12:23 +00:00
|
|
|
conf_opts="$4" # optional
|
2017-09-23 19:55:56 +00:00
|
|
|
|
|
|
|
# Do nothing if the env variable is already set
|
|
|
|
eval "test -z \"\${$env_var+x}\"" || return
|
|
|
|
|
2017-09-23 19:55:56 +00:00
|
|
|
test -z "$GIT_PERF_CONFIG_FILE" && return
|
|
|
|
|
2017-09-23 19:55:56 +00:00
|
|
|
# Check if the variable is in the config file
|
2017-09-23 19:55:56 +00:00
|
|
|
if test -n "$GIT_PERF_SUBSECTION"
|
|
|
|
then
|
|
|
|
var="$conf_sec.$GIT_PERF_SUBSECTION.$conf_var"
|
2018-01-05 09:12:23 +00:00
|
|
|
conf_value=$(git config $conf_opts -f "$GIT_PERF_CONFIG_FILE" "$var") &&
|
2017-09-23 19:55:56 +00:00
|
|
|
eval "$env_var=\"$conf_value\"" && return
|
|
|
|
fi
|
|
|
|
var="$conf_sec.$conf_var"
|
2018-01-05 09:12:23 +00:00
|
|
|
conf_value=$(git config $conf_opts -f "$GIT_PERF_CONFIG_FILE" "$var") &&
|
2018-02-25 13:18:05 +00:00
|
|
|
eval "$env_var=\"$conf_value\""
|
2017-09-23 19:55:56 +00:00
|
|
|
}
|
|
|
|
|
2017-09-23 19:55:56 +00:00
|
|
|
run_subsection () {
|
2018-02-25 13:18:05 +00:00
|
|
|
get_var_from_env_or_config "GIT_PERF_REPEAT_COUNT" "perf" "repeatCount" "--int"
|
|
|
|
: ${GIT_PERF_REPEAT_COUNT:=3}
|
2017-09-23 19:55:56 +00:00
|
|
|
export GIT_PERF_REPEAT_COUNT
|
2017-09-23 19:55:56 +00:00
|
|
|
|
2017-09-23 19:55:56 +00:00
|
|
|
get_var_from_env_or_config "GIT_PERF_DIRS_OR_REVS" "perf" "dirsOrRevs"
|
|
|
|
set -- $GIT_PERF_DIRS_OR_REVS "$@"
|
2017-09-23 19:55:56 +00:00
|
|
|
|
2017-09-23 19:55:56 +00:00
|
|
|
get_var_from_env_or_config "GIT_PERF_MAKE_COMMAND" "perf" "makeCommand"
|
|
|
|
get_var_from_env_or_config "GIT_PERF_MAKE_OPTS" "perf" "makeOpts"
|
2017-09-23 19:55:56 +00:00
|
|
|
|
2018-01-05 09:12:26 +00:00
|
|
|
get_var_from_env_or_config "GIT_PERF_REPO_NAME" "perf" "repoName"
|
|
|
|
export GIT_PERF_REPO_NAME
|
|
|
|
|
2017-09-23 19:55:56 +00:00
|
|
|
GIT_PERF_AGGREGATING_LATER=t
|
|
|
|
export GIT_PERF_AGGREGATING_LATER
|
|
|
|
|
|
|
|
if test $# = 0 -o "$1" = -- -o -f "$1"; then
|
|
|
|
set -- . "$@"
|
|
|
|
fi
|
|
|
|
|
2018-01-05 09:12:24 +00:00
|
|
|
codespeed_opt=
|
|
|
|
test "$GIT_PERF_CODESPEED_OUTPUT" = "true" && codespeed_opt="--codespeed"
|
|
|
|
|
2017-09-23 19:55:56 +00:00
|
|
|
run_dirs "$@"
|
2018-01-05 09:12:25 +00:00
|
|
|
|
|
|
|
if test -z "$GIT_PERF_SEND_TO_CODESPEED"
|
|
|
|
then
|
2021-06-18 13:56:08 +00:00
|
|
|
./aggregate.perl --results-dir="$TEST_RESULTS_DIR" $codespeed_opt "$@"
|
2018-01-05 09:12:25 +00:00
|
|
|
else
|
2021-06-18 13:56:08 +00:00
|
|
|
json_res_file=""$TEST_RESULTS_DIR"/$GIT_PERF_SUBSECTION/aggregate.json"
|
|
|
|
./aggregate.perl --results-dir="$TEST_RESULTS_DIR" --codespeed "$@" | tee "$json_res_file"
|
2018-01-05 09:12:25 +00:00
|
|
|
send_data_url="$GIT_PERF_SEND_TO_CODESPEED/result/add/json/"
|
|
|
|
curl -v --request POST --data-urlencode "json=$(cat "$json_res_file")" "$send_data_url"
|
|
|
|
fi
|
2017-09-23 19:55:56 +00:00
|
|
|
}
|
2012-02-17 10:25:09 +00:00
|
|
|
|
2018-01-05 09:12:24 +00:00
|
|
|
get_var_from_env_or_config "GIT_PERF_CODESPEED_OUTPUT" "perf" "codespeedOutput" "--bool"
|
2018-01-05 09:12:25 +00:00
|
|
|
get_var_from_env_or_config "GIT_PERF_SEND_TO_CODESPEED" "perf" "sendToCodespeed"
|
2018-01-05 09:12:24 +00:00
|
|
|
|
2012-02-17 10:25:09 +00:00
|
|
|
cd "$(dirname $0)"
|
|
|
|
. ../../GIT-BUILD-OPTIONS
|
|
|
|
|
2021-06-18 13:56:08 +00:00
|
|
|
if test -n "$TEST_OUTPUT_DIRECTORY"
|
|
|
|
then
|
|
|
|
TEST_RESULTS_DIR="$TEST_OUTPUT_DIRECTORY/test-results"
|
|
|
|
else
|
|
|
|
TEST_RESULTS_DIR=test-results
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p "$TEST_RESULTS_DIR"
|
|
|
|
get_subsections "perf" >"$TEST_RESULTS_DIR"/run_subsections.names
|
2017-09-23 19:55:56 +00:00
|
|
|
|
2021-06-18 13:56:08 +00:00
|
|
|
if test $(wc -l <"$TEST_RESULTS_DIR"/run_subsections.names) -eq 0
|
2017-09-23 19:55:56 +00:00
|
|
|
then
|
2018-04-08 09:35:12 +00:00
|
|
|
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
|
2017-09-23 19:55:56 +00:00
|
|
|
(
|
|
|
|
run_subsection "$@"
|
|
|
|
)
|
2018-04-08 09:35:12 +00:00
|
|
|
elif test -n "$GIT_PERF_SUBSECTION"
|
|
|
|
then
|
2021-06-18 13:56:08 +00:00
|
|
|
egrep "^$GIT_PERF_SUBSECTION\$" "$TEST_RESULTS_DIR"/run_subsections.names >/dev/null ||
|
2018-04-08 09:35:12 +00:00
|
|
|
die "subsection '$GIT_PERF_SUBSECTION' not found in '$GIT_PERF_CONFIG_FILE'"
|
|
|
|
|
2021-06-18 13:56:08 +00:00
|
|
|
egrep "^$GIT_PERF_SUBSECTION\$" "$TEST_RESULTS_DIR"/run_subsections.names | while read -r subsec
|
2018-04-08 09:35:12 +00:00
|
|
|
do
|
|
|
|
(
|
|
|
|
GIT_PERF_SUBSECTION="$subsec"
|
|
|
|
export GIT_PERF_SUBSECTION
|
|
|
|
echo "======== Run for subsection '$GIT_PERF_SUBSECTION' ========"
|
|
|
|
run_subsection "$@"
|
|
|
|
)
|
|
|
|
done
|
2017-09-23 19:55:56 +00:00
|
|
|
else
|
|
|
|
while read -r subsec
|
|
|
|
do
|
|
|
|
(
|
|
|
|
GIT_PERF_SUBSECTION="$subsec"
|
|
|
|
export GIT_PERF_SUBSECTION
|
|
|
|
echo "======== Run for subsection '$GIT_PERF_SUBSECTION' ========"
|
|
|
|
run_subsection "$@"
|
|
|
|
)
|
2021-06-18 13:56:08 +00:00
|
|
|
done <"$TEST_RESULTS_DIR"/run_subsections.names
|
2012-02-17 10:25:09 +00:00
|
|
|
fi
|