8000 packbuilder: adjust nondeterministic tests by ethomson · Pull Request #6762 · libgit2/libgit2 · GitHub
[go: up one dir, main page]

Skip to content

packbuilder: adjust nondeterministic tests #6762

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

Merged
merged 1 commit into from
Mar 16, 2024
Merged

packbuilder: adjust nondeterministic tests #6762

merged 1 commit into from
Mar 16, 2024

Conversation

ethomson
Copy link
Member

The packbuilder tests should be deterministic. This comment suggests that they are:

/*
 * By default, packfiles are created with only one thread.
 * Therefore we can predict the object ordering and make sure
 * we create exactly the same pack as git.git does when *not*
 * reusing existing deltas (as libgit2).
 *
 * $ cd tests/resources/testrepo.git
 * $ git rev-list --objects HEAD | \
 *  git pack-objects -q --no-reuse-delta --threads=1 pack
 * $ sha1sum pack-7f5fa362c664d68ba7221259be1cbd187434b2f0.pack
 * 5d410bdf97cf896f9007681b92868471d636954b
 *
 */

but it is disappointingly incorrect. As is evidenced by the fact that -- at least on my machine -- that command does not actually produce that output any longer.

Variations in things like the which compression library is actually used, and its defaults, mean that we cannot accurately predict or enforce the bytes in the packfile from one system to another.

Adjust the tests so that they do not believe that they should enforce the bytes in the packfile. This allows broader compatibility with zlib-compatible compression libraries, or other compression levels.

The packbuilder tests should be deterministic. This comment suggests
that they are:

```
/*
 * By default, packfiles are created with only one thread.
 * Therefore we can predict the object ordering and make sure
 * we create exactly the same pack as git.git does when *not*
 * reusing existing deltas (as libgit2).
 *
 * $ cd tests/resources/testrepo.git
 * $ git rev-list --objects HEAD | \
 *  git pack-objects -q --no-reuse-delta --threads=1 pack
 * $ sha1sum pack-7f5fa362c664d68ba7221259be1cbd187434b2f0.pack
 * 5d410bdf97cf896f9007681b92868471d636954b
 *
 */
```

but it is disappointingly incorrect. As is evidenced by the fact that --
at least on _my_ machine -- that command does not actually produce that
output any longer.

Variations in things like the which compression library is actually
used, and its defaults, mean that we cannot accurately predict or
enforce the bytes in the packfile from one system to another.

Adjust the tests so that they do not believe that they should enforce
the bytes in the packfile. This allows broader compatibility with
zlib-compatible compression libraries, or other compression levels.
@ethomson
Copy link
Member Author

Fixes #5324
Fixes #6728

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

Successfully merging this pull request may close these issues.

1 participant
0