testsAndMisc/linux_configuration/scripts/lib/tests/run_all.sh
Krzysztof kuhy Rudnicki 6b5fe8e7a7
Some checks are pending
Pre-commit checks / pre-commit (push) Waiting to run
Shell tests / shell-tests (push) Waiting to run
Shell tests / arch-tests (push) Waiting to run
Extract mtk_root, with the libraries that lived outside it
github.com/kuhyx/mtk-root

Unlike the app extractions, mtk_root could not travel alone: its four
libraries and three of its four test suites sat in scripts/lib/, one
directory up from the stages that source them. Taking only the directory
would have orphaned eight files here and left the new repo unable to
source anything, so all twelve moved in one filter-repo pass. The
mtk_root/ + lib/ sibling layout is preserved, so every
`source "$SCRIPT_DIR/../lib/..."` resolves with no call site edited.

Two things the new repo needed that the monorepo provided implicitly:

  lib/tests/run_all.sh  -- the copy here is shared with the non-mtk suite
                           and stays. Without a new one, shell-tests.yml's
                           glob over */lib/tests/run_all.sh would have
                           stopped covering these suites on a green build.
  .shellcheckrc         -- external-sources + source-path=SCRIPTDIR, which
                           is what lets shellcheck run with no severity
                           filter and still pass on the ../lib/ sources.

mtk_harness.sh stays here despite the name: test_common_datetime.sh
sources it. Removing it broke that suite outright, which running the
suite caught immediately. Its header now describes what it actually
serves; the misleading name is kept on purpose, since renaming would
churn its one consumer for nothing.

Verified: 84 tests pass in the new repo with shellcheck clean, 55 still
pass here, and check_shell_coverage.sh --all exits 0 with the four
mtk_root allowlist entries gone.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PJrqKERAo5QUeEHWS5Asgp
2026-08-23 17:39:27 +02:00

32 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Runs every linux_configuration/scripts/lib test.
#
# The glob is test_*.sh, NOT one prefix per subject: a prefix glob silently
# skips every suite added after it — including in the CI discovery step in
# shell-tests.yml, which runs this file. Only common_datetime is left here
# since the mtk_* libraries moved to github.com/kuhyx/mtk-root, but the glob
# stays generic for the same reason it was generic before.
#
# This file's existence is what meta/scripts/check_shell_coverage.sh checks:
# is_covered() tests for tests/run_all.sh and nothing more, so an empty one
# here would mark every library in the parent directory covered while testing
# nothing. The suites it runs, and the gaps they leave, are named in
# mtk_harness.sh's header.
set -euo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
rc=0
for t in "$HERE"/test_*.sh; do
printf '\n=== %s ===\n' "$(basename "$t")"
# Each suite exits non-zero on failure; keep going so one red suite does not
# hide the state of the others, then fail the run as a whole.
# Invoked directly, NOT as `bash "$t"`: under kcov the latter instruments
# bash itself and reports zero lines for every lib. A fresh process per
# suite also matters here: a library that declares readonly values aborts
# under set -e if it is sourced twice in one shell.
"$t" || rc=1
done
exit "$rc"