Skip to content

Commit 75028c4

Browse files
Merge pull request #61 from BitHighlander/fix/dylib-source-revision
test(dylib): bind provenance to checked-out source
2 parents f9e2414 + 7535e3f commit 75028c4

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

tests/test_dylib_confirm_flow.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,19 @@ def test_features_round_trip(self):
7777
self.assertGreaterEqual(f.major_version, 7)
7878
revision = f.revision.decode("ascii")
7979
self.assertRegex(revision, r"^[0-9a-f]{40}$")
80-
expected_revision = os.environ.get("GITHUB_SHA")
80+
# GITHUB_SHA is the synthetic pull-request merge commit for PR jobs,
81+
# even when the workflow deliberately checks out the PR's head commit.
82+
# The caller must therefore pass the revision of the source tree that
83+
# actually produced the dylib instead of relying on GitHub's ambient
84+
# merge-ref value.
85+
expected_revision = os.environ.get("KK_EXPECTED_FIRMWARE_REVISION")
86+
if os.environ.get("GITHUB_ACTIONS") == "true":
87+
self.assertIsNotNone(
88+
expected_revision,
89+
"GitHub Actions must bind the dylib test to its checked-out source revision",
90+
)
8191
if expected_revision:
92+
self.assertRegex(expected_revision, r"^[0-9a-f]{40}$")
8293
self.assertEqual(revision, expected_revision)
8394

8495
@unittest.skip(

0 commit comments

Comments
 (0)