diff --git a/contrib/source-control-tools/automated-commits.sh b/contrib/source-control-tools/automated-commits.sh --- a/contrib/source-control-tools/automated-commits.sh +++ b/contrib/source-control-tools/automated-commits.sh @@ -107,38 +107,6 @@ git commit -m "${BOT_PREFIX} Archive release notes for version ${RELEASE_NOTES_VERSION}" ;; - update-timings) - "${DEVTOOLS_DIR}"/build_cmake.sh - pushd "${BUILD_DIR}" - ninja check-functional-extended - TIMING_SRC_FILE="${TOPLEVEL}"/test/functional/timing.json - mv timing.json "${TIMING_SRC_FILE}" - popd - - # Check that all tests are included in timing.json - pushd "${TOPLEVEL}"/test/functional - NON_TESTS=$(python3 -c 'from test_runner import NON_SCRIPTS; print(" ".join(NON_SCRIPTS))') - export NON_TESTS - check_missing() { - # Exclude non-tests from the check - if [[ "${NON_TESTS}" =~ $1 ]]; then - exit 0 - fi - - if ! grep -q $1 timing.json ; then - echo "Error: Test file '$1' is missing from timing.json" - exit 1 - fi - } - export -f check_missing - find . -maxdepth 1 -name '*.py' | cut -c 3- | xargs -I'{}' -n1 bash -c 'check_missing {}' - popd - - git add "${TIMING_SRC_FILE}" - - git commit -m "${BOT_PREFIX} Update timing.json" - ;; - *) if [ -z "${SCRIPT}" ]; then echo "Error: Invalid commit name '${COMMIT_TYPE}'" diff --git a/contrib/source-control-tools/patch-recipes/update-timings.sh b/contrib/source-control-tools/patch-recipes/update-timings.sh new file mode 100755 --- /dev/null +++ b/contrib/source-control-tools/patch-recipes/update-timings.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +export LC_ALL=C.UTF-8 + +set -euxo pipefail + +TOPLEVEL=$(git rev-parse --show-toplevel) +"${TOPLEVEL}"/contrib/devtools/build_cmake.sh +pushd "${BUILD_DIR}" +ninja check-functional-extended +TIMING_SRC_FILE="${TOPLEVEL}"/test/functional/timing.json +mv timing.json "${TIMING_SRC_FILE}" +popd + +# Check that all tests are included in timing.json +pushd "${TOPLEVEL}"/test/functional +NON_TESTS=$(python3 -c 'from test_runner import NON_SCRIPTS; print(" ".join(NON_SCRIPTS))') +export NON_TESTS +check_missing() { + # Exclude non-tests from the check + if [[ "${NON_TESTS}" =~ $1 ]]; then + exit 0 + fi + + if ! grep -q $1 timing.json ; then + echo "Error: Test file '$1' is missing from timing.json" + exit 1 + fi +} +export -f check_missing +find . -maxdepth 1 -name '*.py' | cut -c 3- | xargs -I'{}' -n1 bash -c 'check_missing {}' +popd + +git add "${TIMING_SRC_FILE}" + +git commit -m "[Automated] Update timing.json"