Add helpers for syncing commit files with external testsuites

This provides "make sync-repos" to check out all locally available testsuites at
the commits indicated in their commit files, and "make sync-commits" to update
the commit files to the HEADs of the local testsuite repos.

Also adds the commit -> repo sync for the Makefile init target so initialization
always lands on the right version, and removes the corresponding explicit
checkout from the CI repo setup.
This commit is contained in:
Christian Kreibich 2022-06-24 16:05:47 -07:00
parent 9f3dfbdb13
commit bf9b1ebbbe
5 changed files with 72 additions and 3 deletions

30
testing/external/scripts/sync-commit vendored Executable file
View file

@ -0,0 +1,30 @@
#! /usr/bin/env bash
#
# This updates the requested test repo's commit file to the current HEAD commit
# of that repo. If the repo isn't available, this does nothing. If the commit
# file doesn't exist yet, this creates it. It doesn't stage or commit the
# updated commit files.
[[ -z "$1" ]] && {
echo "sync-commit needs a local testsuite repository path as argument"
exit 1
}
repo="$1"
reponame=$(basename $repo)
commitfile=commit-hash.$reponame
[[ ! -d $repo || ! -d $repo/.git ]] && exit 0
commit=$(cd $repo && git log -1 --pretty=format:%H)
[[ -f $commitfile && $(cat $commitfile) == $commit ]] && exit 0
if [[ -n $commit ]]; then
echo "Pinning '$reponame' to $commit"
echo $commit >$commitfile
# If git knows the commit file, show diff:
if git ls-files --error-unmatch $commitfile >/dev/null 2>&1; then
git diff $commitfile
fi
fi