mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-12 23:10:53 +01:00
b50b146dad
19 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
| b399fab56d |
Take the fixes/lib suite from 110s to 37s, same 645 assertions
Three changes, none of which touch what a single test asserts:
thorium_repairs.sh's `sleep 4` becomes `sleep ${THORIUM_STARTUP_WAIT:-4}`
and the harness sets 0.2s. Three cases were each paying four real
seconds to watch a stubbed browser stay up; the stub sleeps 30s, so the
`kill -0` check is unchanged. That file: 17.0s -> 5.6s.
_t_hide was the rest of it. It walks PATH and creates a symlink per
executable -- ~13.5k here, 4.6s a build -- and the suite has ~16
distinct tool sets. Now the full farm is built ONCE and `cp -al`
hard-links it per set, with only the hidden names deleted from the copy.
The cache also moved out of $TEST_TMPDIR, which is per-file, into a
run-scoped dir run_all.sh creates and removes, so it survives between
files.
110s -> 98s (sleep) -> 85s (shared cache) -> 37s (hard-linked farm).
645 OK, 0 FAIL throughout. The cases that only pass when a tool is
genuinely unfindable -- install_pyroveil's missing-dependency arms,
fix_aggressive without sqlite3 -- still pass, which is what proves the
farm is still hiding rather than quietly returning a full PATH.
lib_test_core.sh hit exactly 250 lines, so _t_hide and the farm move to
lib_test_path.sh (194 + 67).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|||
| cb1e8c53c9 |
Test nvidia_config.sh to 100%; the 8-lib campaign is done (85 -> 84)
76/76 lines through run_all.sh at --min 100, exit 0. 45 assertions over
15 cases across all four functions.
XORG_CONF and XORG_CONF_D are plain globals ASSIGNED inside
configure_xorg, so the default had to move to the assignment itself --
exporting a value from the harness alone would have been overwritten on
entry. PROFILE_FILE and USER_HOME take the ordinary `${VAR:-default}`
form. The real /etc/X11/xorg.conf.d/20-nvidia.conf keeps its Jun 2025
mtime and ~/pyroveil does not exist after the suite runs.
configure_xorg's RenderAccel value is asserted to be "true" AND asserted
never to be "false": the lib's own comment records that "false" forces
software rendering and pins Xorg above 30% CPU, so that is a regression
worth a dedicated negative assertion.
install_pyroveil's prompt could not be asserted on its text -- bash
writes a `read -p` prompt straight to the terminal, so it never reaches
captured output. The branches are distinguished by the non-interactive
arm's "Auto-installing" line instead, which is observable.
bt_audio.sh re-measured at 127/127 with the new files present.
That is all eight libs from the original handoff: arch_sysctl (banked as
unmeasurable and quarantined), arch_cpu, arch_hardware, thorium_repairs,
hosts_guard_migrate, hosts_guard_rollback, ubuntu_perf_fixes and
nvidia_config. Allowlist 91 -> 84.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|||
| ad55d1b6a1 |
Test ubuntu_perf_fixes.sh to 100%, take it off the allowlist (86 -> 85)
81/81 lines through run_all.sh at --min 100, exit 0, and check_shell_coverage.sh passes with the allowlist line already deleted. 59 assertions over 14 cases across all four functions: the sysctl drop-in with both the "already applied" skip and the documented-default fallback for an unreadable sysctl; both NVIDIA branches, since the helper-service path and the standalone fallback write different units and different undo lines; earlyoom install / already-installed / config-backup; and fix_failed_sssd for none, all five and exactly one failed unit -- that last one matters because the detection loop breaks at the first failure while the masking loop re-checks each unit, so a naive implementation would mask all five. The four write targets are now behind overrides defaulting to the real paths. The add_undo lines deliberately KEEP their literal /etc paths and are asserted to: the undo script runs on the real system, so seaming those would have written an undo that removes nothing. Neither /etc/sysctl.d/99-performance-tuning.conf nor /etc/default/earlyoom exists after the suite runs. bt_audio.sh re-measured at 127/127 with the new files present -- that canary runs after every addition to this suite now, because a test file silently broke it once already. The handoff is rewritten for the one remaining lib. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
|||
| 0201d5460a |
Clear both hosts-guard libs; teach the instrument done <redirect> (88 -> 86)
hosts_guard_migrate.sh 81/81 and hosts_guard_rollback.sh 65/65, both 100.00% through run_all.sh at --min 100, and check_shell_coverage.sh passes with each allowlist line already deleted. 82 assertions over 36 cases in three files sharing one harness: all four validate_requirements refusals, plugin installation, the mount-collapse loop in every arm (clears, fails, hits its 20-iteration bound, dry-run), per-instance migration for both the bind-mounted and the plugin flavour, and do_migrate's refusal to retire the legacy pacman hooks when nothing registered -- the arm that exists so a failed migration cannot leave the files with no unlock hook at all. INSTRUMENT FIX: rollback measured 97.01% with lines 69 and 108 uncovered, both `done <redirect>` closing a loop. Reproduced minimally: in a three-iteration loop ending `done >"$1"`, the body reports hits=3 and the `done` line hits=0, because bash attributes the redirected compound statement to the loop's OPENING line. That is the same defect _CLOSING_BRACE_OP already handles for `} |`, so _LOOP_END_OP is its twin. The redirect is required by the pattern: a bare `done` stays in the denominator, so genuinely uncovered loops are still caught. Audited as the instrument notes demand -- every newly excluded line printed with its text -- and it is exactly those two lines across all of fixes/lib. Acceptance pair unchanged and exact: dot_resolver_install.sh 39/39, rpi_nc_ca.sh 73/73. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
|||
| 0e9629e110 |
Test thorium_repairs.sh to 100%, lift the gate timeout (89 -> 88)
75/75 lines through run_all.sh at --min 100, exit 0, and
check_shell_coverage.sh passes with the allowlist line already deleted
so the pass cannot come from the exemption.
55 assertions over 23 cases: all five profile repairs plus test_thorium,
including every dry-run arm, the partial singleton-lock case, a corrupt
database and the sqlite3-absent path. The lib needed NO production
change -- it already takes every path from $THORIUM_CONFIG_DIR, so
pointing that one variable at the tmpdir confines it completely.
The gate's per-case timeout moves from the jail's 120s default to 600s.
That default is a hang-catcher, not a performance budget, and this suite
has outgrown it: 76s bare at 25 test files, 93s at 27, and kcov roughly
doubles it. The symptom was a lib FAILING the gate while measuring
perfectly -- bt_audio.sh printed "127/127 lines = 100.00%" and then
"warn: case timed out after 120s", which --fail-on-case-error turned
into a non-zero exit. bt_audio.sh and arch_cpu.sh both pass now.
The cost, recorded in the evidence: a genuine hang takes 10 minutes per
pass to surface instead of 2. test_thorium's `read -r -p` is exactly
that shape, so every case here feeds it stdin explicitly.
This also settles the quarantine in
|
|||
| b27790596b |
Quarantine the arch_sysctl cases: they broke bt_audio's measurement
check_shell_coverage.sh was RED on main. bt_audio.sh is off the allowlist at 127/127, and commit |
|||
| 88ba911641 |
Test arch_hardware.sh to 100%, fix its dead journal vacuum (90 -> 89)
94/94 lines through run_all.sh at --min 100, exit 0. 42 assertions over 26 cases across all five functions, including both boot-loader flavours and the no-boot-loader path. PRODUCTION BUG, found by writing the tests and confirmed against this host: tweak_journal's regex required a space before the unit, but journalctl prints "305.5M in the file system" with no separator. The size check never matched, so the vacuum was unreachable and a multi-gigabyte journal would never have been trimmed. This is the third instance of the same defect -- arch_perf_report.sh:36,65 carried it too -- so the fix is identical: the separator is now optional. One case asserts the spaced form still matches, making this a widening. The mitigation tweak edits the boot loader, so /boot/loader/entries, /etc/default/grub and grub.cfg are now behind overrides defaulting to the real paths. This machine's boot configuration is never touched. _t_hide gets a cache: it symlinks every executable on PATH (13.5k here) and was rebuilding that farm on every call, which took the suite to 92s and pushed a jail case past its 120s timeout. Now 77s, and arch_cpu.sh re-measures at 57/57 so the shared change cost nothing. The cases are split across two files because a single one was 307 lines and file-length-cap rejected the first commit attempt. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
|||
| b4b6908d69 |
Test arch_cpu.sh to 100% and take it off the allowlist (91 -> 90)
57/57 lines, measured through run_all.sh and confirmed a second time at --min 100 so a shortfall would exit non-zero. check_shell_coverage.sh passes with the exemption removed. 28 assertions over 14 cases: no cpufreq at all, every core already tuned, the mixed case where only some cores lag, cpupower absent / unconfigured / already configured, and all three I/O scheduler targets (none for NVMe, mq-deadline for SATA SSD, bfq for spinning disks). The sysfs reads and the two /etc write targets are now behind overrides defaulting to the real paths, so the tests can present hardware this host does not have -- a rotational disk -- without touching anything. One assertion initially passed for the wrong reason: _t_hide keeps $FAKE_BIN on PATH by design, so the harness's own cpupower stub still satisfied has_cmd and the "not installed" branch never ran. Unstubbing before hiding is now explicit, and the case fails if that is lost. This also settles arch_sysctl.sh's diagnosis: it uses this same harness, so the harness is not why it cannot be measured. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
|||
| 7c14cfca61 |
Test arch_sysctl.sh and open the optimize_arch_desktop lib family
23 assertions over 8 cases covering both tweak_vm_sysctl and tweak_network_sysctl: the skip path, the write-when-the-drop-in-is- missing path that a naive "nothing to do" check gets wrong, the value-differs path, an unreadable-sysctl path, and the tcp_bbr guard. arch_desktop_harness.sh is the third family harness, supplying the globals and apply_tweak that live in optimize_arch_desktop.sh rather than in any lib. arch_cpu.sh and arch_hardware.sh will reuse it. SYSCTL_DROPIN_DIR defaults to the real /etc/sysctl.d, matching the seam ubuntu_perf_more.sh and arch_perf_fixes.sh already carry; the suite runs un-jailed in ci_mirror.sh and CI, so a bind mount would protect nothing. Both real drop-ins keep their Mar 2 mtimes. _t_run lands in lib_test_core.sh because `out="$(func)"` forks a subshell and kcov never registers a lib whose first execution happens inside one -- measured as 0 lines via $( ) against 54 lines via a direct call. arch_sysctl.sh STAYS on the coverage allowlist: it still reports "kcov instrumented no lines" through the jail, while ubuntu_perf_more.sh measures 32/32 in the same worktree and the same invocation. The tests are real and green; the coverage number is not yet obtainable, and the exemption may only come off once it is. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
|||
| 0c92a00f0f |
Test arch_perf_fixes.sh to 93.48% and fix the journal regex a third time
Eighth of the 16 untested fixes/lib libs. 22 assertions; 43/46 = 93.48%. The lib STAYS on the allowlist -- see the artifact below. Third instance of the same dead branch. Line 16 matched on `([0-9]+\.?[0-9]*)\ G`, a required space before the unit, while journalctl prints "4.2G" with no separator, so the vacuum could never run. Fixed to an optional space, as in arch_perf_report.sh. This one differs from that earlier fix and the difference was confirmed with the user before landing: arch_perf_report.sh's vacuum sits behind --apply-safe-fixes, but THIS one runs whenever fix_arch_performance.sh runs. So the fix makes an unflagged destructive action live -- the script will now really vacuum the journal to 300M once it passes a gigabyte. That is the function's evident intent, since its next act is to write a permanent 300M cap, and the user approved it explicitly. Three absolute paths moved behind overrides defaulting to the real ones: JOURNALD_CONF_DIR, SYSTEMD_UNIT_DIR (fix_media_organizer writes /etc/systemd/system/media-organizer.service) and ORGANIZE_SCRIPT_CANDIDATES. Verified afterwards that the real unit file still carries its 2026-07-25 mtime and the journald drop-in its 2026-03-02 one, i.e. a bare un-jailed run_all.sh touched neither. The three uncovered lines (68-70) are the element lines of a multi-line array literal. `PS4` + `set -x` on a minimal case shows bash reporting the whole assignment at its OPENING line and never emitting the elements or the closing paren, so they are data, not statements -- a fourth flavour of defect (a), after multi-line quotes, `} |` and the backslash-continued assignment. The array is provably used: the loop on the next line iterates it and the media-organizer assertions pass. Worth fixing, unlike the bt_adapter one-liner: the form appears in three of the remaining untested libs (thorium_repairs.sh has four) and in nine allowlisted libs repo-wide. That lands as its own commit next. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
|||
| 99a9804d75 |
Test ubuntu_perf_more.sh to 100%: allowlist 93 -> 92
Seventh of the 16 untested fixes/lib libs and the first of the ubuntu-perf pair, which gets its own harness here. 24 assertions; 32/32 = 100.00% through run_all.sh on the first measurement, confirmed at --min 100 (exit 0), then cleared with the real gate and no exemption. Two absolute paths had to move behind env overrides, defaulting to the real ones: fix_journal writes /etc/systemd/journald.conf.d/size-limit.conf and run_undo globs /root for undo scripts. Binding those in the jail was rejected for the same reason as bt_pairing.sh's udev rule -- run_all.sh runs UN-jailed in ci_mirror.sh and in CI, so a bind mount protects the coverage run and nothing else. JOURNALD_CONF_DIR and UNDO_DIR follow the UDEV_RULES_DIR precedent. Proof the suite is safe where it runs un-jailed: after a bare run_all.sh the real /etc/systemd/journald.conf.d/size-limit.conf still carries its 2026-03-02 mtime, a genuine artifact of a past production run, and no undo_ubuntu_performance_*.sh exists in /root. Worth noting for the rest of the family: run_undo ends in `exit`, so its cases run inside an explicit subshell. A command substitution already provides one, so the exit ends only that subshell rather than the whole test file. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
|||
| fa7b05da74 |
Test arch_perf_probes.sh to 100%: allowlist 93 -> 92
Sixth of the 16 untested fixes/lib libs, and the first with no dead branch to
fix -- the whole job was test-writing. 43 assertions across two files;
93/93 = 100.00% through run_all.sh, twice, the second at --min 100 (exit 0),
then cleared with the real gate confirming and no exemption.
The one genuine gap was check_memory_pressure's high-swap branch (lines
158-159), which fires only when swap is heavily used WHILE RAM is still
available -- a state this host does not happen to be in. The lib reads the
absolute /proc/meminfo, but every read goes through `awk`, so stubbing awk
supplies controlled figures without touching /proc: the stub answers on the
pattern being matched and execs the real awk for anything else. Both
directions are covered, including RAM genuinely exhausted, which must NOT be
flagged because it is not the stutter signature.
Everything else here is branch coverage of probes whose inputs are external
commands: failed systemd units, ACPI error counts, a CPU-hungry Xorg,
governors all-performance vs one-powersave vs unsupported, thermal
throttling excerpts, the TLP/power-profiles-daemon conflict in all three
combinations, and storage health with and without fstrim/smartctl.
lib_test_core.sh gains _t_stub_cat. "Print this fixture file" is by far the
commonest stub shape, and writing it inline forces every call site to embed
a literal ${LIB_TEST_DEV} that must not expand at write time -- SC2016 on
every use. Passing the fixture NAME as data removes the class outright, and
two earlier bluetooth test files are simplified onto it. All 21 test files
and three harnesses now lint clean with no suppression anywhere.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|||
| ffcf99f102 |
Test arch_perf_report.sh to 98.33% and fix its dead journal-size check
Fifth of the 16 untested fixes/lib libs and the first of the arch-performance
group, which gets its own harness here. 38 assertions across two files. The
lib STAYS on the allowlist at 59/60 = 98.33%, measured twice.
The second dead branch this campaign has found, fixed here. Lines 36 and 65
matched on:
([0-9]+\.?[0-9]*)\ (G|M)
a REQUIRED space before the unit. journalctl actually prints "Archived and
active journals take up 305.5M in the file system." with no separator --
verified against the real binary on this machine. So check_journal_size could
never report a large journal and apply_safe_fixes could never vacuum one:
both were unreachable. The space is now optional, and tests cover the spaced
and unspaced forms so neither can rot.
NOTE: this makes a previously-dead DESTRUCTIVE action live. With
--apply-safe-fixes and a journal over a gigabyte, the entry script will now
really run `journalctl --vacuum-size=300M`. That is the flag's documented
purpose and it stays behind the flag, but it has never actually executed
before today.
Line 20, the one uncovered line, is `} >>"$REPORT_FILE"` -- the closing brace
of a redirected group. A minimal probe writes both inner lines to the file
while bash attributes no statement to the brace, and the report assertions
independently prove the group runs, since they read the text it writes. Same
defect (a) class as bt_audio's `} |`.
That form now caps four libs: bt_audio.sh, arch_perf_report.sh, and
arch_perf_probes.sh and nvidia_config.sh which are still untested. So the
continuation_lines() fix is worth landing after all -- as its own commit,
next, so a denominator change can be reverted without taking these tests
with it.
_t_hide and _t_full_path move from bt_harness.sh into lib_test_core.sh: they
are generic PATH plumbing and the arch harness needs them for the
"nvidia-smi is not installed" branch. All twelve existing suites re-run green
after the move.
One trap worth recording: apply_safe_fixes appends to the ACTIONS array, so
it must be called directly rather than inside "$(...)" -- a command
substitution runs it in a subshell where the appends die with it, and the
assertions read an empty array.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|||
| a5b6663c02 |
Test bt_audio.sh to 96.97% and fix its wpctl health check
Fourth of the 16 untested fixes/lib libs, the largest at 214 lines, and the
last of the bluetooth family. 47 assertions across three files. The lib
STAYS on the allowlist: 128/132 = 96.97%, twice with the same line set.
The bug the tests found, fixed here. Line 21 read:
if timeout 3 _run_as_user wpctl status &>/dev/null; then
`timeout` is a binary and `_run_as_user` is a shell function that is never
exported, so this always failed with rc=127 -- "timeout: failed to run
command '_run_as_user'". check_pipewire_health therefore reported PipeWire
hung on EVERY run and restarted a healthy audio stack every time
fix_bluetooth.sh ran. The healthy branch was unreachable, which is why the
test for it could not be written without first noticing. Now
`_run_as_user timeout 3 wpctl status`: same bound, inside the sudo'd command.
Why 96.97% and not 100%. An earlier run of this suite read 99/99 = 100.00%,
and that number was wrong -- it measured the file before pre-commit's
`shfmt -w` reformatted it. shfmt rewrites the `{ ...; } \` + `| bluetoothctl`
one-liners into multi-line blocks ending in `} |`, which raises the
denominator 99 -> 132. Confirmed unavoidable by running shfmt against HEAD's
own copy: it rewrites there too, so reverting the reformat is not stable.
The four uncovered lines (90, 113, 137, 157) are each that `} |` -- the pipe
operator joining a block to bluetoothctl, not a statement. They do execute:
a `{ echo a; echo b; } | consumer` block writes every marker to a file even
though bash's xtrace never reports the left-hand side, because a pipe's LHS
runs in a subshell whose xtrace is not captured. kcov instruments them and
cannot attribute them; defect (a) in docs/kcov-under-report.md, third flavour.
Scope, measured: the continuation-pipe form appears ONLY in bt_adapter.sh
(pre-format) and bt_audio.sh (post-shfmt). None of the remaining twelve
untested libs carries either, so this does not block the campaign and the
detector fix stays off the critical path.
Also worth 90.91% -> 96.97% on its own: the bluetoothctl stubs now drain
stdin before exiting. Real bluetoothctl consumes its whole input; a stub
that read one line and exited closed the pipe early, so the writing block
took SIGPIPE partway through and its later lines never ran.
NOTE for whoever edits this file next: bt_audio.sh is now exactly 250 lines,
at the cap. The next change to it needs a split, not a comment trim.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|||
| 434cb7587e |
Test bt_adapter.sh to 98.55%; line 97 is unreachable by construction
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>
|
|||
| 0e9cc0ce95 |
Test bt_pairing.sh to 100%: allowlist 97 -> 96
Second of the 16 untested fixes/lib libs. 65/65 = 100.00% through run_all.sh, twice, the second at --min 100 (exit 0), then cleared from the allowlist and confirmed by the real gate with no exemption. Two findings worth keeping: - udevadm was NOT in the harness's stub list, so `udevadm control --reload-rules` was reaching the REAL binary during the suite. A prepended stub dir cannot hide a tool the host actually has. Caught by asserting on the recorded call rather than by reading the code, which is the argument for asserting on calls at all. - _disable_usb_autosuspend writes /etc/udev/rules.d/50-bluetooth-no- autosuspend.rules. Binding /etc in the jail would have covered it, and was rejected: run_all.sh runs UN-jailed in ci_mirror.sh and in the shell-tests workflow, as its own header says, so a bind mount protects the coverage run and leaves every bare run writing to a real root-owned file. Instead the lib gained a UDEV_RULES_DIR override, defaulting to the real path -- the same env-override seam pacman_hook_stall_harness.sh uses for PACMAN_LOG/CACHE_DIR/PACMAN_LOCK. Proof the suite is safe where it runs un-jailed: after a bare run_all.sh, the real rule file still has its 2026-02-21 mtime (it is a genuine artifact of a production run six months ago) and the probed power/control values are unchanged. The jail cannot give that check. fix_usb_autosuspend globs the real /sys/bus/usb/devices/*/ with no override, so its branches are driven through stubbed lsusb output: ffff:ffff matches nothing on any machine and reaches the not-found arm, while 046d:c077 (control=on) and 046d:0825 (control=auto) are read-only probes, each guarded so the case self-skips with a note if the host state changes rather than silently asserting nothing. Split across two test files to stay under the 250-line cap; run_all.sh globs test_*.sh, so splitting costs nothing. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
|||
| 4cfc3fdde1 |
Test bt_report.sh to 100%: allowlist 98 -> 97
First of the 16 untested fixes/lib libs. Measured 37/37 = 100.00% through lib/tests/run_all.sh, twice, the second run at --min 100 (exit 0), then removed from the allowlist and confirmed with the real gate and no exemption. Adds two reusable pieces rather than a per-family harness clone: - lib_test_core.sh -- PASS/FAIL tally, _t_eq/_t_contains/_t_lacks, a mktemp -d sandbox wiped on EXIT, a FAKE_BIN stub dir on PATH, and _t_stub/_t_unstub. _t_unstub runs `hash -r`: deleting a stub file alone does not drop bash's cached executable path, so the real binary would never be reached again. - bt_harness.sh -- sources the core, sources the real scripts/lib/common.sh for the production log_*/has_cmd helpers (verified inert at source time), and redefines _btctl and apply_fix verbatim from fix_bluetooth.sh, since those live in the entry script rather than in any lib. Same trade-off pacman_hook_stall_harness.sh already makes with log_size. pacman_hook_stall_harness.sh is deliberately left alone: its six libs are already off the allowlist, i.e. gated at 100% with no exemption, so refactoring it onto the new core would risk banked work for no gain. jscpd reads 1.6% against the hook's own flags, and **/lib/tests/** is excluded from that scan anyway, so the duplication budget is not at stake. _t_only_path exists because every tool these libs call (usbreset, pactl, lsusb, ...) genuinely exists on an Arch desktop: a prepended stub dir cannot exercise a "not installed" branch, so those cases drop PATH to FAKE_BIN alone. The three coverage runs were made in a detached worktree: a second session was writing to this repo concurrently, and the jail aborts on any working-tree delta during a run. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
|||
| 347222b921 |
Add fixes/lib run_all.sh; the previous handoff was wrong about that directory
The handoff recorded fixes/lib as having "no harness at all". It already had
8 test files and 2 harnesses. What was missing is run_all.sh -- the subject
is_covered() actually builds, and the only thing the gate measures through.
All 8 test files pass through it.
No jail_args beside it, deliberately: the harness confines every write to its
own `mktemp -d` and intercepts external commands with a PATH stub dir, and
grep finds no absolute write to /etc, /var or /usr in any of the tests. So it
runs bare, like the transcribe suite.
First measurement through it: pacman_hook_stall_usage.sh is 1/1 = 100.00%.
That denominator is honest, not broken -- the lib is a single usage() whose
body is one `cat <<EOF` heredoc plus `exit 0`, and heredoc content is data
rather than statements.
16 of the 22 libs there still have no tests at all. That is now the largest
block of real test-writing work left in the campaign.
Also rewrites NEXT_SESSION_PROMPT.md, whose central claim ("the instrument is
the bottleneck, not the tests") stopped being true this session. The new one
leads with re-measuring the 103 allowlisted libs on the fixed instrument
before writing any new test.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|||
| 015eb48714 |
diagnose_pacman_hook_stall.sh: split 493 -> 249 + 6 libs, 100% coverage
Confirmed live (not dead code) via the dead-code check-in before any code
was touched -- the last two candidates this pattern was tried on were both
archived instead. Kept run_one/cleanup/log_size/main together in the entry
script: a prior session (
|