On Tue, Dec 26, 2017 at 10:59 PM, Christian Couder <christian.couder@xxxxxxxxx> wrote: > Changes since previous version > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > - Fixed the way the 'executable' field sent to Codespeed is set in > `perf/aggregate.perl` in patch 3/7. We now use `uname -s -m` to > which we concatenate the perf.repoName config value if it is set, > as suggested by Junio and Eric. > > - Fixed the name of the GIT_PERF_REPO_NAME variable in patches 3/7 > and 7/7. It was GIT_TEST_REPO_NAME in some places. > > - Fixed how the conf_opt argument is added to the > get_var_from_env_or_config() function in patch 4/7. It was added > as the last, so fifth, argument, but it is simpler and makes more > sense to keep the default value argument as the last argument, so > now the conf_opt argument is added as the fourth argument. > > - What patch 4/7 did was previously done in 2 patches in the > previous version (patches 4/8 and 5/8), but as we are not doing > exactly the same thing (see the above item) it is simpler to do it > in only one patch instead of two. > > - We now use the --int type specifier when getting the > perf.repeatCount config variable in patch 4/7. Here is the diff with v1: diff --git a/t/perf/aggregate.perl b/t/perf/aggregate.perl index 6e15f62a9e..34d74fc015 100755 --- a/t/perf/aggregate.perl +++ b/t/perf/aggregate.perl @@ -186,17 +186,16 @@ sub print_codespeed_results { my $project = "Git"; - my $executable; - if ($results_section eq "") { - $executable = `uname -o -p`; - } else { - $executable = $results_section; - chomp $executable; + my $executable = `uname -s -m`; + chomp $executable; + + if ($results_section ne "") { + $executable .= ", " . $results_section; } my $environment; - if (exists $ENV{GIT_TEST_REPO_NAME} and $ENV{GIT_TEST_REPO_NAME} ne "") { - $environment = $ENV{GIT_TEST_REPO_NAME}; + if (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$||; diff --git a/t/perf/run b/t/perf/run index 279c2d41f6..1a100d6134 100755 --- a/t/perf/run +++ b/t/perf/run @@ -105,8 +105,8 @@ get_var_from_env_or_config () { env_var="$1" conf_sec="$2" conf_var="$3" - default_value="$4" # optional - conf_opts="$5" # optional + conf_opts="$4" # optional + # $5 can be set to a default value # Do nothing if the env variable is already set eval "test -z \"\${$env_var+x}\"" || return @@ -124,11 +124,11 @@ get_var_from_env_or_config () { conf_value=$(git config $conf_opts -f "$GIT_PERF_CONFIG_FILE" "$var") && eval "$env_var=\"$conf_value\"" && return - test -n "${default_value+x}" && eval "$env_var=\"$default_value\"" + test -n "${5+x}" && eval "$env_var=\"$5\"" } run_subsection () { - get_var_from_env_or_config "GIT_PERF_REPEAT_COUNT" "perf" "repeatCount" 3 + get_var_from_env_or_config "GIT_PERF_REPEAT_COUNT" "perf" "repeatCount" "--int" 3 export GIT_PERF_REPEAT_COUNT get_var_from_env_or_config "GIT_PERF_DIRS_OR_REVS" "perf" "dirsOrRevs" @@ -137,7 +137,7 @@ run_subsection () { get_var_from_env_or_config "GIT_PERF_MAKE_COMMAND" "perf" "makeCommand" get_var_from_env_or_config "GIT_PERF_MAKE_OPTS" "perf" "makeOpts" - get_var_from_env_or_config "GIT_TEST_REPO_NAME" "perf" "repoName" + get_var_from_env_or_config "GIT_PERF_REPO_NAME" "perf" "repoName" export GIT_PERF_REPO_NAME GIT_PERF_AGGREGATING_LATER=t @@ -163,7 +163,7 @@ run_subsection () { fi } -get_var_from_env_or_config "GIT_PERF_CODESPEED_OUTPUT" "perf" "codespeedOutput" "" --bool +get_var_from_env_or_config "GIT_PERF_CODESPEED_OUTPUT" "perf" "codespeedOutput" "--bool" get_var_from_env_or_config "GIT_PERF_SEND_TO_CODESPEED" "perf" "sendToCodespeed" cd "$(dirname $0)"