testsAndMisc/linux_configuration/scripts/single_use/features/lib/tests
Krzysztof kuhy Rudnicki 0e843c2a5f Cover rpi_nc_install.sh and fix two latent bugs in the nc_php suite
rpi_nc_install.sh is one 200-line function that apt-installs 24
packages, seeds MariaDB, rm -rf's /var/www/nextcloud, rewrites Apache
and PHP config and installs a www-data crontab. 29 assertions, run for
real inside the jail. The destructive step is the point: a bug in
`rm -rf /var/www/nextcloud` is invisible to any check that does not
actually run it.

Two latent bugs in the ALREADY-COMMITTED nc_php suite, both found by
finally reading its assertion results instead of only its coverage
percentage. It was failing 2 of 29 in isolation:

- the cron entry arrives on crontab's STDIN, not in argv, so asserting
  on the call log could never have passed for the right reason. The
  stub now records stdin.
- configure_mariadb's stdout is eaten by `db_password=$(...)`, so the
  phase-order marker now goes to stderr and the capture reads both.

Suites now: 28 + 30 + 29 = 87 assertions, 0 failures.

KNOWN AND UNEXPLAINED: kcov mis-measures rpi_nc_install.sh at 10/88 =
11.36%, recording lines 13-54 and nothing after -- yet the code past
line 54 provably runs, since /root/.nextcloud_db_password and
/etc/apache2/sites-available/nextcloud.conf both exist afterwards. The
three obvious culprits were each tested against a minimal reproduction
and DISPROVEN: kcov traces fine past a heredoc, into a $( ) command
substitution, and past a heredoc-fed stub reading stdin via $(cat).
The file stays on the allowlist and the suite is kept for its
assertions, not its percentage. Do not 'fix' the number by weakening a
test.

dot_resolver_install.sh 39/39 = 100.00%; nc_php.sh 84/85 = 98.82%.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbD4nco3EgL1UFoZKmKsLE
2026-08-22 11:49:47 +02:00
..
features_harness.sh Shell coverage: convert the ratchet to a measured 100% bar 2026-08-22 11:20:58 +02:00
run_all.sh Cover nc_php.sh (98.82%) and teach the jail to measure foreign platforms 2026-08-22 11:30:32 +02:00
test_dot_resolver_install.sh Shell coverage: convert the ratchet to a measured 100% bar 2026-08-22 11:20:58 +02:00
test_nc_php.sh Cover rpi_nc_install.sh and fix two latent bugs in the nc_php suite 2026-08-22 11:49:47 +02:00
test_rpi_nc_install.sh Cover rpi_nc_install.sh and fix two latent bugs in the nc_php suite 2026-08-22 11:49:47 +02:00