mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-11 18:34:04 +01:00
Third of the 16 untested fixes/lib libs, and the first that does NOT come
off the allowlist. 68/69 = 98.55%, up from 45/69. The remaining line is
not a missing test:
PS4='+TRACE:${BASH_SOURCE##*/}:${LINENO} ' bash -x
shows bash attributing the whole multi-line dbus-send assignment in
_services_resolved to line 100, and never emitting line 97 at all. Line 97
is the OPENING line of a backslash-continued statement; kcov instruments
it, bash never attributes a statement to it. That is defect (a) in
docs/kcov-under-report.md -- a wrong denominator -- and no test can move it.
continuation_lines() in shell_coverage_lines.py already excludes such lines,
but only detects them by tracking QUOTE state, so a line ending in an
unquoted backslash slips through. Fixing that is deliberately left out of
this commit: it changes the denominator for every measured lib, and if it
regresses one of the libs now gated with no exemption, reverting a mixed
commit would throw away these tests too.
Scope of the problem, measured rather than guessed -- backslash
continuations are confined to the bluetooth family: bt_audio.sh 10,
bt_adapter.sh 7, bt_pairing.sh 3, pacman_hook_stall_summary.sh 2, and ZERO
in the other 12 remaining libs. So this caps bt_audio.sh next and then stops
mattering.
Also replaces the harness's _t_only_path with _t_hide. _t_only_path dropped
PATH to $FAKE_BIN alone, which hid grep, head and sort as well as the tool
under test -- so the "usbreset is not installed" case died in a cascade of
"command not found" and passed for the wrong reason instead of exercising
the fallback. _t_hide rebuilds PATH from symlinks to every real executable
except the named ones; verified directly that command -v usbreset is then
empty while grep and head still resolve.
bt_report.sh (37/37) and bt_pairing.sh (65/65) re-measured at --min 100,
both exit 0, so neither cleared lib regressed.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
48 lines
5.7 KiB
JSON
48 lines
5.7 KiB
JSON
{
|
|
"intent": "Test linux_configuration/scripts/single_use/fixes/lib/bt_adapter.sh, third of the 16 untested fixes/lib libs. It reaches 98.55% and STAYS on the allowlist: the one remaining line is not reachable by any test, for an instrument reason recorded below.",
|
|
"scope": [
|
|
"linux_configuration/scripts/single_use/fixes/lib/tests/test_bt_adapter.sh (new, 14 assertions: check_firmware and _download_firmware)",
|
|
"linux_configuration/scripts/single_use/fixes/lib/tests/test_bt_adapter_reset.sh (new, 27 assertions: check_adapter_stuck, _reload_btusb, _services_resolved, _full_adapter_reset_and_connect, _verify_audio_sink)",
|
|
"linux_configuration/scripts/single_use/fixes/lib/tests/bt_harness.sh (_t_only_path replaced by _t_hide)",
|
|
"Non-goal: removing bt_adapter.sh from meta/shell-coverage-allowlist.txt -- it is at 98.55%, not 100%, so it does not meet the bar",
|
|
"Non-goal: fixing the continuation-line detector, or reformatting bt_adapter.sh to suit the tool"
|
|
],
|
|
"changes": [
|
|
"Added test_bt_adapter.sh covering check_firmware (no .hcd named in dmesg, a missing file that triggers the download, an already-installed file, and de-duplication of repeated names via sort -u) and _download_firmware (wget succeeding, and the curl fallback when wget fails).",
|
|
"Added test_bt_adapter_reset.sh covering check_adapter_stuck (responsive adapter, no USB dongle, the usbreset path, the btusb-reload fallback when usbreset is absent, and an unparseable USB ID), _reload_btusb, _services_resolved (boolean true, boolean false, and dbus-send failing), _full_adapter_reset_and_connect, and _verify_audio_sink (pactl absent, card found on the first probe, and never found after five retries).",
|
|
"Replaced the harness's _t_only_path with _t_hide, which rebuilds PATH from symlinks to every real executable EXCEPT the named ones. _t_only_path dropped PATH to $FAKE_BIN alone, which also hid grep, head and sort -- so a 'usbreset not installed' case died in a cascade of 'command not found' and passed for the wrong reason rather than exercising the fallback. Verified directly: after _t_hide usbreset, command -v usbreset is empty while grep and head still resolve.",
|
|
"test_bt_adapter_reset.sh sources bt_audio.sh as well: bt_adapter.sh calls _run_as_user and _restart_pipewire_stack, which live in bt_audio.sh, and fix_bluetooth.sh sources both. Sourcing it reproduces the real resolution order instead of stubbing the two helpers.",
|
|
"sleep is stubbed for _full_adapter_reset_and_connect (34 real seconds) and _verify_audio_sink (5 retries x 3s), with the calls still recorded so the retry-count assertion is on the real loop."
|
|
],
|
|
"verification": [
|
|
{
|
|
"command": "bash linux_configuration/scripts/single_use/fixes/lib/tests/run_all.sh",
|
|
"result": "pass",
|
|
"evidence": "bt_adapter (firmware): 14 passed, 0 failed; bt_adapter (reset/probe): 27 passed, 0 failed. All fixes lib test files passed, so bt_report, both bt_pairing files and the eight pacman_hook_stall suites stay green."
|
|
},
|
|
{
|
|
"command": "bash meta/scripts/shell_coverage_jail.sh --subject linux_configuration/scripts/single_use/fixes/lib/tests/run_all.sh --measure bt_adapter.sh --min 1 --fail-on-case-error -- \"\"",
|
|
"result": "pass",
|
|
"evidence": "bt_adapter.sh: 68/69 lines = 98.55%, up from 45/69 = 65.22% before _full_adapter_reset_and_connect and _verify_audio_sink were covered. Only line 97 remains uncovered."
|
|
},
|
|
{
|
|
"command": "PS4='+TRACE:${BASH_SOURCE##*/}:${LINENO} ' bash -x, driving _services_resolved directly",
|
|
"result": "pass",
|
|
"evidence": "bash attributes the whole multi-line dbus-send assignment to line 100 ('+TRACE:bt_adapter.sh:100 result=...'), and never emits line 97 at all. Line 97 is the OPENING line of a backslash-continued statement: kcov instruments it, bash never attributes a statement to it, so no test can cover it. This is defect (a) in docs/kcov-under-report.md -- a wrong denominator, not a missing test."
|
|
},
|
|
{
|
|
"command": "grep -c '\\\\$' on each of the 22 fixes/lib libs",
|
|
"result": "pass",
|
|
"evidence": "Backslash continuations are confined to the bluetooth family: bt_audio.sh 10, bt_adapter.sh 7, bt_pairing.sh 3, pacman_hook_stall_summary.sh 2, and ZERO in the other 12 remaining libs. So this artifact caps bt_adapter.sh and will cap bt_audio.sh, but does not block the rest of the campaign."
|
|
}
|
|
],
|
|
"risks": [
|
|
"bt_adapter.sh stays on the allowlist at 98.55%. Clearing it needs meta/scripts/lib/shell_coverage_lines.py:continuation_lines to also treat a line ending in an unquoted backslash as a continuation -- it currently tracks quote state only. That change alters the denominator for every measured lib, so it is deliberately NOT bundled here: if it regresses one of the five pacman_hook_stall libs that are already gated with no exemption, reverting a mixed commit would throw away these tests too.",
|
|
"Two check_firmware cases read the real /usr/lib/firmware/brcm (the lib hardcodes that path). The already-installed case is driven by whatever .hcd is genuinely present and self-skips with a note if the directory is empty; the download case uses BCM99999-nonexistent.hcd, a name no distribution ships. An earlier draft used BCM20702A1-0b05-17cb.hcd, which IS installed on this host, and silently exercised the wrong branch -- caught by the assertion, not by inspection."
|
|
],
|
|
"rollback": [
|
|
"git revert the commit; it adds two test files and changes one harness helper, and touches no production lib and no allowlist entry.",
|
|
"After rollback, run bash linux_configuration/scripts/single_use/fixes/lib/tests/run_all.sh and confirm the remaining suites pass; no coverage gate changes, since bt_adapter.sh stays exempt either way."
|
|
]
|
|
}
|