Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/scripts/check-native-coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,11 @@ def check_changed(lines, changed, minimum, compiled, platform="windows"):
total += 1
covered += lines[name][line] > 0
if not total:
raise ValueError('no measured changed executable lines in workspace')
# Every changed line is non-executable (a constant table entry, a
# plain comment, an attribute): there is nothing to measure. Required
# platform sources were checked above, and every executable source
# still needs LCOV, so this cannot hide missing instrumentation.
return None
if covered * 100 < minimum * total:
raise ValueError(f'changed lines: {covered}/{total} below {minimum}%')
return covered, total
Expand Down
9 changes: 9 additions & 0 deletions .github/scripts/check-native-coverage_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,15 @@ def test_low_changed_line_coverage_is_rejected(self):
with self.assertRaisesRegex(ValueError, 'below 80'):
gate.check_changed({WINDOWS: {3: 0}, ACL: {4: 1}}, {WINDOWS: {3}, ACL: {4}}, 80, COMPILED)

def test_changes_with_no_executable_line_skip_only_changed_line_gate(self):
# Line 9 of the adapter is a changed constant entry with no LCOV line.
compiled = {**COMPILED, ADAPTER: (4, 4)}
lines = {WINDOWS: {3: 1}, ACL: {4: 1}, ADAPTER: {10: 1}}
self.assertIsNone(gate.check_changed(lines, {ADAPTER: {9}}, 80, compiled))
# The inventory checks still run first: an uninstrumented source fails.
with self.assertRaisesRegex(ValueError, 'missing executable LCOV source'):
gate.check_changed({WINDOWS: {3: 1}, ACL: {4: 1}}, {ADAPTER: {9}}, 80, compiled)

def test_no_production_changes_skip_only_changed_line_gate(self):
self.assertIsNone(gate.check_changed({WINDOWS: {3: 1}, ACL: {4: 1}}, {}, 80, COMPILED))
self.assertEqual(gate.changed_lines('+++ b/crates/a/src/sink_tests.rs\n@@ -0,0 +1 @@\n+x\n'), {})
Expand Down
Loading