From 7ae6a5c1be715798d5bfa6604988a7c4094c934a Mon Sep 17 00:00:00 2001 From: David Young Date: Thu, 5 Nov 2026 07:31:55 -0700 Subject: [PATCH] smoketest: don't run the pre-push hook when pushing to the VM upstream_set pushes the commit under test from the working copy, so coredesktop-dev's pre-push hook ran make check on every push to the VM. Inside the smoketest those checks saw VM_GIT_URL and friends, the smoketest tests pushed to the real VM and failed, and the hook stopped the push, failing the installed image's build. The push now uses --no-verify, and the tests clear the smoketest's variables. Co-Authored-By: Claude Opus 5.5 --- smoketest/lib/scenario.sh | 4 +++- tests/smoketest.bats | 7 +++++++ tests/test_helper.bash | 4 ++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/smoketest/lib/scenario.sh b/smoketest/lib/scenario.sh index 4fe7aeb..5e75cc3 100644 --- a/smoketest/lib/scenario.sh +++ b/smoketest/lib/scenario.sh @@ -99,7 +99,9 @@ upstream_set() { local sha sha="$(git -C "$SMOKETEST_REPO" rev-parse --verify --quiet "$1^{commit}")" \ || fail "no such commit: $1" - GIT_SSH_COMMAND="${VM_GIT_SSH:-ssh}" git -C "$SMOKETEST_REPO" push --quiet --force \ + # --no-verify: a pre-push hook in the working copy (coredesktop-dev's runs + # make check) is for pushes to the real upstream, not to the VM + GIT_SSH_COMMAND="${VM_GIT_SSH:-ssh}" git -C "$SMOKETEST_REPO" push --quiet --force --no-verify \ "${VM_GIT_URL:-}$UPSTREAM" "$sha:refs/heads/main" || fail "couldn't push $1 to the VM" } diff --git a/tests/smoketest.bats b/tests/smoketest.bats index 94fd9cd..8352d04 100644 --- a/tests/smoketest.bats +++ b/tests/smoketest.bats @@ -44,6 +44,13 @@ upstream_main() { [ "$(upstream_main)" = "$V2" ] } +@test "pushing to the VM skips the working copy's pre-push hook" { + printf '%s\n' '#!/bin/bash' 'echo hook ran; exit 1' > "$SMOKETEST_REPO/.git/hooks/pre-push" + chmod +x "$SMOKETEST_REPO/.git/hooks/pre-push" + smoketest_prepare + [ "$(upstream_main)" = "$V2" ] +} + @test "prepare sends CoreDesktop's URLs to the fake upstream" { smoketest_prepare for url in "${COREDESKTOP_URLS[@]}"; do diff --git a/tests/test_helper.bash b/tests/test_helper.bash index a48f521..87ce7b2 100644 --- a/tests/test_helper.bash +++ b/tests/test_helper.bash @@ -15,6 +15,10 @@ common_setup() { : > "$STUB_LOG" export PATH="$STUB_BIN:$PATH" unset COREDESKTOP + # Set when the tests run inside a smoketest (a pre-push hook's checks, say), + # where they would point the smoketest tests at the real VM + unset VM_GIT_SSH VM_GIT_URL SMOKETEST_REPO SMOKETEST_RESULTS SMOKETEST_SHARED \ + SMOKETEST_REF SMOKETEST_VM_DIR IMAGE_REF VARIANT } # A test file that needs more setup defines its own setup that calls this first