git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] t/perf/run: fix bin-wrappers computation
@ 2021-09-21 15:46 Derrick Stolee via GitGitGadget
  2021-09-21 17:50 ` Taylor Blau
  0 siblings, 1 reply; 3+ messages in thread
From: Derrick Stolee via GitGitGadget @ 2021-09-21 15:46 UTC (permalink / raw)
  To: git; +Cc: gitster, avarab, vdye, stolee, Derrick Stolee, Derrick Stolee

From: Derrick Stolee <dstolee@microsoft.com>

The GIT_TEST_INSTALLED was moved from perf-lib.sh to run in df0f5021
(perf-lib.sh: remove GIT_TEST_INSTALLED from perf-lib.sh, 2019-05-07)
and that included a change to how it inspected the existence of a
bin-wrappers directory. However, that included a typo that made the
match of bin-wrappers never work. Specifically, the assignment was

	mydir_abs_wrappers="$mydir_abs_wrappers/bin-wrappers"

which uses the same variable before it is initialized. By changing it to

	mydir_abs_wrappers="$mydir_abs/bin-wrappers"

We can correctly use the bin-wrappers directory.

This is critical to successfully computing performance of commands that
execute subcommands. The bin-wrappers ensure that the --exec-path is set
correctly.

Reported-by: Victoria Dye <vdye@github.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
---
    t/perf/run: fix bin-wrappers computation
    
    Found this while we were testing sparse index improvements to 'git
    stash', which uses a lot of subcommands.
    
    Thanks, -Stolee

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1044%2Fderrickstolee%2Fperf-run-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1044/derrickstolee/perf-run-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1044

 t/perf/run | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/perf/run b/t/perf/run
index d19dec258a2..55219aa4056 100755
--- a/t/perf/run
+++ b/t/perf/run
@@ -74,7 +74,7 @@ set_git_test_installed () {
 	mydir=$1
 
 	mydir_abs=$(cd $mydir && pwd)
-	mydir_abs_wrappers="$mydir_abs_wrappers/bin-wrappers"
+	mydir_abs_wrappers="$mydir_abs/bin-wrappers"
 	if test -d "$mydir_abs_wrappers"
 	then
 		GIT_TEST_INSTALLED=$mydir_abs_wrappers

base-commit: 225bc32a989d7a22fa6addafd4ce7dcd04675dbf
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] t/perf/run: fix bin-wrappers computation
  2021-09-21 15:46 [PATCH] t/perf/run: fix bin-wrappers computation Derrick Stolee via GitGitGadget
@ 2021-09-21 17:50 ` Taylor Blau
  2021-09-21 18:47   ` Derrick Stolee
  0 siblings, 1 reply; 3+ messages in thread
From: Taylor Blau @ 2021-09-21 17:50 UTC (permalink / raw)
  To: Derrick Stolee via GitGitGadget
  Cc: git, gitster, avarab, vdye, stolee, Derrick Stolee,
	Derrick Stolee

On Tue, Sep 21, 2021 at 03:46:12PM +0000, Derrick Stolee via GitGitGadget wrote:
> This is critical to successfully computing performance of commands that
> execute subcommands. The bin-wrappers ensure that the --exec-path is set
> correctly.

Just sanity-checking everything you said: with this bug, we'll set
mydir_abs_wrappers to "/bin-wrappers", then realize that directory
doesn't exist, and fall back to GIT_TEST_INSTALLED=$mydir_abs. Putting
'set -x' at the top of t/perf/run, we can see the relevant section:

  + mydir=build/73cd7d9420bb7d75207e8149521db375c789a81c
  + cd build/73cd7d9420bb7d75207e8149521db375c789a81c
  + pwd
  + mydir_abs=/home/ttaylorr/src/git/t/perf/build/73cd7d9420bb7d75207e8149521db375c789a81c
  + mydir_abs_wrappers=/bin-wrappers
  + test -d /bin-wrappers
  + GIT_TEST_INSTALLED=/home/ttaylorr/src/git/t/perf/build/73cd7d9420bb7d75207e8149521db375c789a81c
  + export GIT_TEST_INSTALLED

OK. But the real problem is in t/test-lib.sh where we read
"$GIT_TEST_INSTALLED". There we ask for the `--exec-path`, which appears
to be wrong, at least in my setup. Printing out the $GIT_EXEC_PATH and
$GIT_TEST_INSTALLED, I get:

  /home/ttaylorr/local/git/ds.sparse-checkout/libexec/git-core,
  /home/ttaylorr/src/git/t/perf/build/73cd7d9420bb7d75207e8149521db375c789a81c

where the former is the branch I happen to have checked out, and the
latter is the revision that I asked to run performance tests on via
t/perf/run.

So I think we'll run the right top-level Git command since the latter
path ends up first in our $PATH, but the exec path is definitely wrong.

> diff --git a/t/perf/run b/t/perf/run
> index d19dec258a2..55219aa4056 100755
> --- a/t/perf/run
> +++ b/t/perf/run
> @@ -74,7 +74,7 @@ set_git_test_installed () {
>  	mydir=$1
>
>  	mydir_abs=$(cd $mydir && pwd)
> -	mydir_abs_wrappers="$mydir_abs_wrappers/bin-wrappers"
> +	mydir_abs_wrappers="$mydir_abs/bin-wrappers"

This fix looks obviously right to me (and gives me the expected output
from above when I apply it locally).

Thanks,
Taylor

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] t/perf/run: fix bin-wrappers computation
  2021-09-21 17:50 ` Taylor Blau
@ 2021-09-21 18:47   ` Derrick Stolee
  0 siblings, 0 replies; 3+ messages in thread
From: Derrick Stolee @ 2021-09-21 18:47 UTC (permalink / raw)
  To: Taylor Blau, Derrick Stolee via GitGitGadget
  Cc: git, gitster, avarab, vdye, Derrick Stolee, Derrick Stolee

On 9/21/2021 1:50 PM, Taylor Blau wrote:
> On Tue, Sep 21, 2021 at 03:46:12PM +0000, Derrick Stolee via GitGitGadget wrote:
>> This is critical to successfully computing performance of commands that
>> execute subcommands. The bin-wrappers ensure that the --exec-path is set
>> correctly.
> 
> Just sanity-checking everything you said: with this bug, we'll set
> mydir_abs_wrappers to "/bin-wrappers", then realize that directory
> doesn't exist, and fall back to GIT_TEST_INSTALLED=$mydir_abs. Putting
> 'set -x' at the top of t/perf/run, we can see the relevant section:
> 
>   + mydir=build/73cd7d9420bb7d75207e8149521db375c789a81c
>   + cd build/73cd7d9420bb7d75207e8149521db375c789a81c
>   + pwd
>   + mydir_abs=/home/ttaylorr/src/git/t/perf/build/73cd7d9420bb7d75207e8149521db375c789a81c
>   + mydir_abs_wrappers=/bin-wrappers
>   + test -d /bin-wrappers
>   + GIT_TEST_INSTALLED=/home/ttaylorr/src/git/t/perf/build/73cd7d9420bb7d75207e8149521db375c789a81c
>   + export GIT_TEST_INSTALLED
> 
> OK. But the real problem is in t/test-lib.sh where we read
> "$GIT_TEST_INSTALLED". There we ask for the `--exec-path`, which appears
> to be wrong, at least in my setup. Printing out the $GIT_EXEC_PATH and
> $GIT_TEST_INSTALLED, I get:
> 
>   /home/ttaylorr/local/git/ds.sparse-checkout/libexec/git-core,
>   /home/ttaylorr/src/git/t/perf/build/73cd7d9420bb7d75207e8149521db375c789a81c
> 
> where the former is the branch I happen to have checked out, and the
> latter is the revision that I asked to run performance tests on via
> t/perf/run.
> 
> So I think we'll run the right top-level Git command since the latter
> path ends up first in our $PATH, but the exec path is definitely wrong.

Thanks for digging into this more. This issue with GIT_EXEC_PATH explains
some strangeness I was seeing.

Perhaps there is something more robust to be done around GIT_EXEC_PATH,
but the current fix satisfies my needs.
 
>> diff --git a/t/perf/run b/t/perf/run
>> index d19dec258a2..55219aa4056 100755
>> --- a/t/perf/run
>> +++ b/t/perf/run
>> @@ -74,7 +74,7 @@ set_git_test_installed () {
>>  	mydir=$1
>>
>>  	mydir_abs=$(cd $mydir && pwd)
>> -	mydir_abs_wrappers="$mydir_abs_wrappers/bin-wrappers"
>> +	mydir_abs_wrappers="$mydir_abs/bin-wrappers"
> 
> This fix looks obviously right to me (and gives me the expected output
> from above when I apply it locally).

Thanks,
-Stolee

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-21 18:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-21 15:46 [PATCH] t/perf/run: fix bin-wrappers computation Derrick Stolee via GitGitGadget
2021-09-21 17:50 ` Taylor Blau
2021-09-21 18:47   ` Derrick Stolee

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).