mirror of
https://github.com/git/git
synced 2024-08-25 02:35:46 +00:00
Merge branch 'ab/perf-installed-fix'
Performance test framework has been broken and measured the version
of Git that happens to be on $PATH, not the specified one to
measure, for a while, which has been corrected.
* ab/perf-installed-fix:
perf-lib.sh: forbid the use of GIT_TEST_INSTALLED
perf tests: add "bindir" prefix to git tree test results
perf-lib.sh: remove GIT_TEST_INSTALLED from perf-lib.sh
perf-lib.sh: make "./run <revisions>" use the correct gits
perf aggregate: remove GIT_TEST_INSTALLED from --codespeed
perf README: correct docs for 3c8f12c96c
regression
This commit is contained in:
commit
82dca958dd
|
@ -45,7 +45,7 @@ call the aggregation script to summarize the results:
|
|||
|
||||
$ ./p0001-rev-list.sh
|
||||
[...]
|
||||
$ GIT_BUILD_DIR=/path/to/other/git ./p0001-rev-list.sh
|
||||
$ ./run /path/to/other/git -- ./p0001-rev-list.sh
|
||||
[...]
|
||||
$ ./aggregate.perl . /path/to/other/git ./p0001-rev-list.sh
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
use warnings;
|
||||
use Getopt::Long;
|
||||
use Git;
|
||||
use Cwd qw(realpath);
|
||||
|
||||
sub get_times {
|
||||
my $name = shift;
|
||||
|
@ -98,18 +99,21 @@ sub format_size {
|
|||
while (scalar @ARGV) {
|
||||
my $arg = $ARGV[0];
|
||||
my $dir;
|
||||
my $prefix = '';
|
||||
last if -f $arg or $arg eq "--";
|
||||
if (! -d $arg) {
|
||||
my $rev = Git::command_oneline(qw(rev-parse --verify), $arg);
|
||||
$dir = "build/".$rev;
|
||||
} elsif ($arg eq '.') {
|
||||
$dir = '.';
|
||||
} else {
|
||||
$arg =~ s{/*$}{};
|
||||
$dir = $arg;
|
||||
$dirabbrevs{$dir} = $dir;
|
||||
$dir = realpath($arg);
|
||||
$dirnames{$dir} = $dir;
|
||||
$prefix .= 'bindir';
|
||||
}
|
||||
push @dirs, $dir;
|
||||
$dirnames{$dir} = $arg;
|
||||
my $prefix = $dir;
|
||||
$dirnames{$dir} ||= $arg;
|
||||
$prefix .= $dir;
|
||||
$prefix =~ tr/^a-zA-Z0-9/_/c;
|
||||
$prefixes{$dir} = $prefix . '.';
|
||||
shift @ARGV;
|
||||
|
@ -311,9 +315,6 @@ sub print_codespeed_results {
|
|||
$environment = $reponame;
|
||||
} elsif (exists $ENV{GIT_PERF_REPO_NAME} and $ENV{GIT_PERF_REPO_NAME} ne "") {
|
||||
$environment = $ENV{GIT_PERF_REPO_NAME};
|
||||
} elsif (exists $ENV{GIT_TEST_INSTALLED} and $ENV{GIT_TEST_INSTALLED} ne "") {
|
||||
$environment = $ENV{GIT_TEST_INSTALLED};
|
||||
$environment =~ s|/bin-wrappers$||;
|
||||
} else {
|
||||
$environment = `uname -r`;
|
||||
chomp $environment;
|
||||
|
|
|
@ -21,19 +21,21 @@
|
|||
# because it will change our working directory.
|
||||
TEST_DIRECTORY=$(pwd)/..
|
||||
TEST_OUTPUT_DIRECTORY=$(pwd)
|
||||
ABSOLUTE_GIT_TEST_INSTALLED=$(
|
||||
test -n "$GIT_TEST_INSTALLED" && cd "$GIT_TEST_INSTALLED" && pwd)
|
||||
|
||||
TEST_NO_CREATE_REPO=t
|
||||
TEST_NO_MALLOC_CHECK=t
|
||||
|
||||
. ../test-lib.sh
|
||||
|
||||
if test -z "$GIT_TEST_INSTALLED"; then
|
||||
perf_results_prefix=
|
||||
else
|
||||
perf_results_prefix=$(printf "%s" "${GIT_TEST_INSTALLED%/bin-wrappers}" | tr -c "[a-zA-Z0-9]" "[_*]")"."
|
||||
GIT_TEST_INSTALLED=$ABSOLUTE_GIT_TEST_INSTALLED
|
||||
if test -n "$GIT_TEST_INSTALLED" -a -z "$PERF_SET_GIT_TEST_INSTALLED"
|
||||
then
|
||||
error "Do not use GIT_TEST_INSTALLED with the perf tests.
|
||||
|
||||
Instead use:
|
||||
|
||||
./run <path-to-git> -- <tests>
|
||||
|
||||
See t/perf/README for details."
|
||||
fi
|
||||
|
||||
# Variables from test-lib that are normally internal to the tests; we
|
||||
|
@ -179,7 +181,7 @@ test_wrapper_ () {
|
|||
base=$(basename "$0" .sh)
|
||||
echo "$test_count" >>"$perf_results_dir"/$base.subtests
|
||||
echo "$1" >"$perf_results_dir"/$base.$test_count.descr
|
||||
base="$perf_results_dir"/"$perf_results_prefix$(basename "$0" .sh)"."$test_count"
|
||||
base="$perf_results_dir"/"$PERF_RESULTS_PREFIX$(basename "$0" .sh)"."$test_count"
|
||||
"$test_wrapper_func_" "$@"
|
||||
fi
|
||||
|
||||
|
|
43
t/perf/run
43
t/perf/run
|
@ -70,6 +70,24 @@ build_git_rev () {
|
|||
) || die "failed to build revision '$mydir'"
|
||||
}
|
||||
|
||||
set_git_test_installed () {
|
||||
mydir=$1
|
||||
|
||||
mydir_abs=$(cd $mydir && pwd)
|
||||
mydir_abs_wrappers="$mydir_abs_wrappers/bin-wrappers"
|
||||
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
|
||||
PERF_SET_GIT_TEST_INSTALLED=true
|
||||
export PERF_SET_GIT_TEST_INSTALLED
|
||||
}
|
||||
|
||||
run_dirs_helper () {
|
||||
mydir=${1%/}
|
||||
shift
|
||||
|
@ -79,7 +97,16 @@ run_dirs_helper () {
|
|||
if test $# -gt 0 -a "$1" = --; then
|
||||
shift
|
||||
fi
|
||||
if [ ! -d "$mydir" ]; then
|
||||
|
||||
PERF_RESULTS_PREFIX=
|
||||
if test "$mydir" = "."
|
||||
then
|
||||
unset GIT_TEST_INSTALLED
|
||||
elif test -d "$mydir"
|
||||
then
|
||||
PERF_RESULTS_PREFIX=bindir$(cd $mydir && printf "%s" "$(pwd)" | tr -c "[a-zA-Z0-9]" "_").
|
||||
set_git_test_installed "$mydir"
|
||||
else
|
||||
rev=$(git rev-parse --verify "$mydir" 2>/dev/null) ||
|
||||
die "'$mydir' is neither a directory nor a valid revision"
|
||||
if [ ! -d build/$rev ]; then
|
||||
|
@ -87,16 +114,12 @@ run_dirs_helper () {
|
|||
fi
|
||||
build_git_rev $rev "$mydir"
|
||||
mydir=build/$rev
|
||||
|
||||
PERF_RESULTS_PREFIX=build_$rev.
|
||||
set_git_test_installed "$mydir"
|
||||
fi
|
||||
if test "$mydir" = .; then
|
||||
unset GIT_TEST_INSTALLED
|
||||
else
|
||||
GIT_TEST_INSTALLED="$mydir/bin-wrappers"
|
||||
# Older versions of git lacked bin-wrappers; fallback to the
|
||||
# files in the root.
|
||||
test -d "$GIT_TEST_INSTALLED" || GIT_TEST_INSTALLED=$mydir
|
||||
export GIT_TEST_INSTALLED
|
||||
fi
|
||||
export PERF_RESULTS_PREFIX
|
||||
|
||||
run_one_dir "$@"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue