Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

t/perf/run: fix bin-wrappers computation #1044

Closed
wants to merge 1 commit into from

Conversation

derrickstolee
Copy link

@derrickstolee derrickstolee commented Sep 21, 2021

Found this while we were testing sparse index improvements to 'git stash', which uses a lot of subcommands.

Thanks,
-Stolee

cc: [email protected]
cc: [email protected]
cc: [email protected]
cc: [email protected]
cc: Taylor Blau [email protected]

The GIT_TEST_INSTALLED was moved from perf-lib.sh to run in df0f502
(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 <[email protected]>
Signed-off-by: Derrick Stolee <[email protected]>
@derrickstolee derrickstolee self-assigned this Sep 21, 2021
@derrickstolee
Copy link
Author

/submit

@gitgitgadget
Copy link

gitgitgadget bot commented Sep 21, 2021

Submitted as [email protected]

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git pr-1044/derrickstolee/perf-run-v1

To fetch this version to local tag pr-1044/derrickstolee/perf-run-v1:

git fetch --no-tags https://github.com/gitgitgadget/git tag pr-1044/derrickstolee/perf-run-v1

@gitgitgadget
Copy link

gitgitgadget bot commented Sep 21, 2021

On the Git mailing list, Taylor Blau wrote (reply to this):

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

@gitgitgadget
Copy link

gitgitgadget bot commented Sep 21, 2021

User Taylor Blau <[email protected]> has been added to the cc: list.

@gitgitgadget
Copy link

gitgitgadget bot commented Sep 21, 2021

On the Git mailing list, Derrick Stolee wrote (reply to this):

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

@gitgitgadget
Copy link

gitgitgadget bot commented Sep 22, 2021

This branch is now known as ds/perf-test-built-path-fix.

@gitgitgadget
Copy link

gitgitgadget bot commented Sep 22, 2021

This patch series was integrated into seen via git@132d623.

@gitgitgadget gitgitgadget bot added the seen label Sep 22, 2021
@gitgitgadget
Copy link

gitgitgadget bot commented Sep 23, 2021

This patch series was integrated into seen via git@947f0ee.

@gitgitgadget
Copy link

gitgitgadget bot commented Sep 23, 2021

This patch series was integrated into seen via git@886f9da.

@gitgitgadget
Copy link

gitgitgadget bot commented Sep 23, 2021

This patch series was integrated into seen via git@d06889b.

@gitgitgadget
Copy link

gitgitgadget bot commented Sep 23, 2021

There was a status update in the "New Topics" section about the branch ds/perf-test-built-path-fix on the Git mailing list:

Perf test fix.

Will merge to 'next'.

@gitgitgadget
Copy link

gitgitgadget bot commented Sep 28, 2021

There was a status update in the "Cooking" section about the branch ds/perf-test-built-path-fix on the Git mailing list:

Perf test fix.

Will merge to 'next'.

@gitgitgadget
Copy link

gitgitgadget bot commented Sep 28, 2021

This patch series was integrated into seen via git@1a35c2f.

@gitgitgadget
Copy link

gitgitgadget bot commented Sep 28, 2021

This patch series was integrated into next via git@18a2148.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant