Skip to content

Commit 0e1b12c

Browse files
avoidscornByron
authored andcommitted
Add stress tests for gixp commit-graph-verify command.
The new `tests/fixtures/commit-graphs` fixtures are built using the exact same set of commits each time even as their sources repos in `tests/fixtures/repos` get newer commits. My hope there is to make upcoming commit-graph benchmarks more consistent.
1 parent c32850d commit 0e1b12c

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
# will have compiled files and executables
55
target/
66

7+
/tests/fixtures/commit-graphs
78
# repositories used for local testing
89
/tests/fixtures/repos

Makefile

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,50 @@ $(linux_repo):
129129
mkdir -p $@
130130
cd $@ && git init --bare && git remote add origin https://github.com/torvalds/linux && git fetch
131131

132+
test_many_commits_1m_repo = tests/fixtures/repos/test-many-commits-1m.git
133+
$(test_many_commits_1m_repo):
134+
mkdir -p $@
135+
cd $@ && git init --bare && git remote add origin https://github.com/cirosantilli/test-many-commits-1m.git && git fetch
136+
137+
## get all non-rc tags up to v5.8, oldest tag first (should have 78 tags)
138+
## -> convert to commit ids
139+
## -> write a new incremental commit-graph file for each commit id
140+
tests/fixtures/commit-graphs/linux/long-chain: $(linux_repo)
141+
mkdir -p $@
142+
rm -rf $(linux_repo)/objects/info/*graph*
143+
set -x && cd $(linux_repo) && \
144+
for tag in $$(git tag --list --merged v5.8 --sort=version:refname | grep -Fv -- -rc); do \
145+
git show-ref -s "$$tag" | git commit-graph write --split=no-merge --stdin-commits; \
146+
done
147+
mv -f $(linux_repo)/objects/info/*graphs* $@
148+
actual=$$(ls -1 $@/commit-graphs/*.graph | wc -l); \
149+
if [ $$actual -ne 78 ]; then echo expected 78 commit-graph files, got $$actual; exit 1; fi
150+
151+
tests/fixtures/commit-graphs/linux/single-file: $(linux_repo)
152+
mkdir -p $@
153+
rm -rf $(linux_repo)/objects/info/*graph*
154+
cd $(linux_repo) && git show-ref -s v5.8 | git commit-graph write --stdin-commits
155+
mv -f $(linux_repo)/objects/info/*graph* $@
156+
157+
tests/fixtures/commit-graphs/rust/single-file: $(rust_repo)
158+
mkdir -p $@
159+
rm -rf $(rust_repo)/objects/info/*graph*
160+
cd $(rust_repo) && git show-ref -s 1.47.0 | git commit-graph write --stdin-commits
161+
mv -f $(rust_repo)/objects/info/*graph* $@
162+
163+
tests/fixtures/commit-graphs/test-many-commits-1m/single-file: $(test_many_commits_1m_repo)
164+
mkdir -p $@
165+
rm -rf $(test_many_commits_1m_repo)/objects/info/*graph*
166+
cd $(test_many_commits_1m_repo) \
167+
&& echo f4d21576c13d917e1464d9bc1323a560a5b8595d | git commit-graph write --stdin-commits
168+
mv -f $(test_many_commits_1m_repo)/objects/info/*graph* $@
169+
170+
commit_graphs = \
171+
tests/fixtures/commit-graphs/linux/long-chain \
172+
tests/fixtures/commit-graphs/linux/single-file \
173+
tests/fixtures/commit-graphs/rust/single-file \
174+
tests/fixtures/commit-graphs/test-many-commits-1m/single-file
175+
132176
##@ on CI
133177

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

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

193+
$(MAKE) stress-commitgraph
194+
195+
.PHONY: stress-commitgraph
196+
stress-commitgraph: release-lean $(commit_graphs)
197+
set -x; for path in $(wordlist 2, 999, $^); do \
198+
time ./target/release/gixp --verbose commit-graph-verify $$path; \
199+
done
200+
149201
##@ Maintenance
150202

151203
baseline_asset_dir = git-repository/src/assets/baseline-init

0 commit comments

Comments
 (0)