Skip to content

Add stress tests for gixp commit-graph-verify command. #30

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
Oct 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
# will have compiled files and executables
target/

/tests/fixtures/commit-graphs
# repositories used for local testing
/tests/fixtures/repos
52 changes: 52 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,50 @@ $(linux_repo):
mkdir -p $@
cd $@ && git init --bare && git remote add origin https://github.com/torvalds/linux && git fetch

test_many_commits_1m_repo = tests/fixtures/repos/test-many-commits-1m.git
$(test_many_commits_1m_repo):
mkdir -p $@
cd $@ && git init --bare && git remote add origin https://github.com/cirosantilli/test-many-commits-1m.git && git fetch

## get all non-rc tags up to v5.8, oldest tag first (should have 78 tags)
## -> convert to commit ids
## -> write a new incremental commit-graph file for each commit id
tests/fixtures/commit-graphs/linux/long-chain: $(linux_repo)
mkdir -p $@
rm -rf $(linux_repo)/objects/info/*graph*
set -x && cd $(linux_repo) && \
for tag in $$(git tag --list --merged v5.8 --sort=version:refname | grep -Fv -- -rc); do \
git show-ref -s "$$tag" | git commit-graph write --split=no-merge --stdin-commits; \
done
mv -f $(linux_repo)/objects/info/*graphs* $@
actual=$$(ls -1 $@/commit-graphs/*.graph | wc -l); \
if [ $$actual -ne 78 ]; then echo expected 78 commit-graph files, got $$actual; exit 1; fi

tests/fixtures/commit-graphs/linux/single-file: $(linux_repo)
mkdir -p $@
rm -rf $(linux_repo)/objects/info/*graph*
cd $(linux_repo) && git show-ref -s v5.8 | git commit-graph write --stdin-commits
mv -f $(linux_repo)/objects/info/*graph* $@

tests/fixtures/commit-graphs/rust/single-file: $(rust_repo)
mkdir -p $@
rm -rf $(rust_repo)/objects/info/*graph*
cd $(rust_repo) && git show-ref -s 1.47.0 | git commit-graph write --stdin-commits
mv -f $(rust_repo)/objects/info/*graph* $@

tests/fixtures/commit-graphs/test-many-commits-1m/single-file: $(test_many_commits_1m_repo)
mkdir -p $@
rm -rf $(test_many_commits_1m_repo)/objects/info/*graph*
cd $(test_many_commits_1m_repo) \
&& echo f4d21576c13d917e1464d9bc1323a560a5b8595d | git commit-graph write --stdin-commits
mv -f $(test_many_commits_1m_repo)/objects/info/*graph* $@

commit_graphs = \
tests/fixtures/commit-graphs/linux/long-chain \
tests/fixtures/commit-graphs/linux/single-file \
tests/fixtures/commit-graphs/rust/single-file \
tests/fixtures/commit-graphs/test-many-commits-1m/single-file

##@ on CI

stress: ## Run various algorithms on big repositories
Expand All @@ -146,6 +190,14 @@ stress: ## Run various algorithms on big repositories

rm -Rf delme; mkdir delme && time ./target/release/gixp --verbose pack-explode .git/objects/pack/*.idx delme/

$(MAKE) stress-commitgraph

.PHONY: stress-commitgraph
stress-commitgraph: release-lean $(commit_graphs)
set -x; for path in $(wordlist 2, 999, $^); do \
time ./target/release/gixp --verbose commit-graph-verify $$path; \
done

##@ Maintenance

baseline_asset_dir = git-repository/src/assets/baseline-init
Expand Down