File tree Expand file tree Collapse file tree 3 files changed +31
-0
lines changed
Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 2121 OUTPUT_STYLE=" auto"
2222fi
2323
24+ HELP_GIT_REMOTE=" https://github.com/git/git"
25+ HELP_LINUX_REMOTE=" https://github.com/torvalds/linux"
26+
2427#
2528# parse the arguments to the outer script that's including us; these are arguments that
2629# the `benchmark.sh` passes (or that a user could specify when running an individual test)
@@ -384,3 +387,27 @@ gitbench() {
384387 hyperfine " ${ARGUMENTS[@]} "
385388 rm -rf " ${SANDBOX_DIR:? } "
386389}
390+
391+ # helper script to give useful error messages about configuration
392+ needs_repo () {
393+ REPO=" ${1} "
394+
395+ if [ " ${REPO} " = " " ]; then
396+ echo " usage: needs_repo <repo>" 1>&2
397+ exit 1
398+ fi
399+
400+ REPO_UPPER=$( echo " ${1} " | tr ' [:lower:]' ' [:upper:]' )
401+ REPO_URL=$( eval echo " \$ {BENCHMARK_${REPO_UPPER} _REPOSITORY}" )
402+ REPO_REMOTE_URL=$( eval echo " \$ {HELP_${REPO_UPPER} _REMOTE}" )
403+
404+ if [ " ${REPO_URL} " = " " ]; then
405+ echo " $0 : '${REPO} ' repository not configured" 1>&2
406+ echo " " 1>&2
407+ echo " This benchmark needs an on-disk '${REPO} ' repository. First, clone the" 1>&2
408+ echo " remote repository ('${REPO_REMOTE_URL} ') locally then set," 1>&2
409+ echo " the 'BENCHMARK_${REPO_UPPER} _REPOSITORY' environment variable to the path that" 1>&2
410+ echo " contains the repository locally, then run this benchmark again." 1>&2
411+ exit 1
412+ fi
413+ }
Original file line number Diff line number Diff line change 22
33. " $( dirname " $0 " ) /benchmark_helpers.sh"
44
5+ needs_repo git
6+
57gitbench --prepare " clone_repo git && cd git && git reset --hard v2.45.0" \
68 --warmup 5 \
79 --chdir " git" \
Original file line number Diff line number Diff line change 22
33. " $( dirname " $0 " ) /benchmark_helpers.sh"
44
5+ needs_repo linux
6+
57gitbench --prepare " clone_repo linux && cd linux && git reset --hard v6.9" \
68 --warmup 5 \
79 --chdir " linux" \
You can’t perform that action at this time.
0 commit comments