mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-11 19:54:01 +01:00
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>
58 lines
4.0 KiB
JSON
58 lines
4.0 KiB
JSON
{
|
|
"intent": "Add a test suite for arch_sysctl.sh and the shared harness for the optimize_arch_desktop.sh lib family, covering both sysctl-tuning functions across every branch.",
|
|
"scope": [
|
|
"linux_configuration/scripts/single_use/fixes/lib/arch_sysctl.sh (SYSCTL_DROPIN_DIR override only)",
|
|
"linux_configuration/scripts/single_use/fixes/lib/tests/arch_desktop_harness.sh (new)",
|
|
"linux_configuration/scripts/single_use/fixes/lib/tests/test_arch_sysctl.sh (new)",
|
|
"linux_configuration/scripts/single_use/fixes/lib/tests/lib_test_core.sh (_t_run primitive)",
|
|
"Non-goal: removing arch_sysctl.sh from the coverage allowlist -- see risks, the lib is not yet measurable through run_all.sh"
|
|
],
|
|
"changes": [
|
|
"Added SYSCTL_DROPIN_DIR to arch_sysctl.sh, defaulting to the real /etc/sysctl.d so production behaviour is unchanged; it exists so tests never write to /etc, which matters because run_all.sh runs un-jailed in ci_mirror.sh and in CI",
|
|
"Added arch_desktop_harness.sh, the third family harness, supplying the DRY_RUN/AGGRESSIVE/TWEAKS_* globals and the apply_tweak helper that live in the entry script optimize_arch_desktop.sh rather than in any lib",
|
|
"Added test_arch_sysctl.sh: 23 assertions over 8 cases covering both functions' skip path, write-when-drop-in-missing path, value-differs path, sysctl-failure path, and tweak_network_sysctl's modprobe guard",
|
|
"Added _t_run to lib_test_core.sh: runs the subject in the current shell and captures output via a file, because command substitution forks a subshell and kcov then never registers the sourced lib"
|
|
],
|
|
"verification": [
|
|
{
|
|
"command": "bash linux_configuration/scripts/single_use/fixes/lib/tests/test_arch_sysctl.sh",
|
|
"result": "pass",
|
|
"evidence": "arch_sysctl: 23 passed, 0 failed"
|
|
},
|
|
{
|
|
"command": "bash linux_configuration/scripts/single_use/fixes/lib/tests/run_all.sh",
|
|
"result": "pass",
|
|
"evidence": "All fixes lib test files passed; 21 test files green including the new one."
|
|
},
|
|
{
|
|
"command": "shellcheck lib_test_core.sh arch_desktop_harness.sh test_arch_sysctl.sh arch_sysctl.sh",
|
|
"result": "pass",
|
|
"evidence": "No findings, zero suppressions. The SC2034 on $out was fixed by exporting it, matching the existing treatment of cross-file globals in lib_test_core.sh."
|
|
},
|
|
{
|
|
"command": "ls -la /etc/sysctl.d/90-desktop-performance.conf /etc/sysctl.d/91-desktop-network.conf",
|
|
"result": "pass",
|
|
"evidence": "Both still dated Mar 2, i.e. untouched by the suite: the SYSCTL_DROPIN_DIR override kept every write inside the throwaway tmpdir."
|
|
},
|
|
{
|
|
"command": "kcov --include-pattern=arch_sysctl.sh <dir> ./g1.sh (direct call, no command substitution)",
|
|
"result": "pass",
|
|
"evidence": "arch_sysctl.sh instrumented 54 lines when the function is called directly, versus 0 lines when first called inside $( ). This is what motivated _t_run."
|
|
},
|
|
{
|
|
"command": "shell_coverage_jail.sh --measure arch_sysctl.sh --subject .../run_all.sh",
|
|
"result": "fail",
|
|
"evidence": "'kcov instrumented no lines' persists through the jail even after the _t_run change, while the control lib ubuntu_perf_more.sh measures 32/32 = 100.00% in the same worktree and same jail invocation. The lib is therefore NOT yet measurable and its allowlist line is deliberately left in place."
|
|
}
|
|
],
|
|
"risks": [
|
|
"arch_sysctl.sh remains on the coverage allowlist despite having 23 passing assertions, because it cannot yet be measured through run_all.sh; the tests are real but the coverage number is unknown",
|
|
"_t_run changes the calling convention for future lib tests; existing test files are untouched and still green",
|
|
"The SYSCTL_DROPIN_DIR override adds a test seam to production code, the same seam ubuntu_perf_more.sh and arch_perf_fixes.sh already carry"
|
|
],
|
|
"rollback": [
|
|
"git revert the commit; arch_sysctl.sh returns to hardcoded /etc/sysctl.d paths and the two new test files disappear",
|
|
"Re-run tests/run_all.sh to confirm the remaining 20 test files are still green"
|
|
]
|
|
}
|