Files
Martin Vogel eed87fd372 Forbid test skips and convert existing skips to hard failures
Add scripts/check-no-test-skips.sh (run from lint) which fails the lint phase on any plain SKIP() or direct tf_skip_count manipulation; only SKIP_PLATFORM() (for genuinely platform-specific tests) is tolerated. Add FAIL() and SKIP_PLATFORM() helpers to the test framework and convert the remaining SKIP()/perf-gated skips across the suite into pass-or-fail assertions, so a suite that cannot meet its preconditions reports a red failure instead of a silent skip.
2026-06-05 21:53:25 +02:00

47 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# lint.sh — Run all linters (clang-tidy + cppcheck + clang-format).
#
# Usage:
# scripts/lint.sh # All 3 linters
# scripts/lint.sh CLANG_FORMAT=clang-format-20 # Override formatter
# scripts/lint.sh --ci # CI mode (skip clang-tidy)
#
# This script is the SINGLE source of truth for linting.
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT"
# shellcheck source=env.sh
source "$ROOT/scripts/env.sh"
# Check for --ci flag (skip clang-tidy for platforms without it)
CI_ONLY=false
MAKE_ARGS=()
for arg in "$@"; do
if [ "$arg" = "--ci" ]; then
CI_ONLY=true
else
MAKE_ARGS+=("$arg")
fi
done
print_env "lint.sh"
# No-skips policy: every test must pass or fail. The only tolerable skip is a
# genuinely platform-specific test (SKIP_PLATFORM / #ifdef). Runs in both modes.
echo "=== no-skips policy (tests pass or fail) ==="
bash "$ROOT/scripts/check-no-test-skips.sh"
if $CI_ONLY; then
echo "=== CI mode: cppcheck + clang-format ==="
$ARCH_PREFIX make -j2 -f Makefile.cbm lint-ci "${MAKE_ARGS[@]+"${MAKE_ARGS[@]}"}"
echo "=== CI linters passed ==="
else
echo "=== Full lint: clang-tidy + cppcheck + clang-format ==="
$ARCH_PREFIX make -j3 -f Makefile.cbm lint "${MAKE_ARGS[@]+"${MAKE_ARGS[@]}"}"
fi
echo "=== All linters passed ==="