chore(cpp/scripts): update_goldens.sh y check_tested.sh
- update_goldens.sh: build primitives_gallery + lanza --capture sobre cpp/tests/golden/ con LIBGL_ALWAYS_SOFTWARE=1. - check_tested.sh [days]: CI gate que falla si una funcion C++ creada en los ultimos N dias (default 30) no tiene tested:true en su .md. Hookeado al final de run_tests.sh. No-op si registry.db no existe. Issue 0048.
This commit is contained in:
Executable
+28
@@ -0,0 +1,28 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# CI gate (issue 0048): falla si una funcion C++ creada en los ultimos N dias
|
||||||
|
# no tiene `tested: true` en su frontmatter del .md.
|
||||||
|
#
|
||||||
|
# Uso:
|
||||||
|
# cpp/scripts/check_tested.sh [days] # default: 30
|
||||||
|
#
|
||||||
|
# Requiere que registry.db este actualizada (corre `fn index` antes).
|
||||||
|
set -euo pipefail
|
||||||
|
DAYS="${1:-30}"
|
||||||
|
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||||
|
DB="$ROOT/registry.db"
|
||||||
|
if [ ! -f "$DB" ]; then
|
||||||
|
echo "WARN: registry.db not found at $DB; run 'fn index' first."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
UNTESTED=$(sqlite3 "$DB" \
|
||||||
|
"SELECT id FROM functions WHERE lang='cpp' AND tested=0 \
|
||||||
|
AND (created_at IS NULL OR created_at > datetime('now','-${DAYS} days'));")
|
||||||
|
if [ -n "$UNTESTED" ]; then
|
||||||
|
echo "FAIL: las siguientes funciones C++ recientes no tienen tested:true en .md:"
|
||||||
|
echo "$UNTESTED"
|
||||||
|
echo ""
|
||||||
|
echo "Anade un test (cpp/tests/test_<name>.cpp) y marca el frontmatter del .md con tested:true."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "OK: todas las funciones C++ recientes (<= ${DAYS}d) tienen tests."
|
||||||
@@ -5,3 +5,7 @@ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|||||||
cmake -S "$ROOT" -B "$ROOT/build" -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON
|
cmake -S "$ROOT" -B "$ROOT/build" -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON
|
||||||
cmake --build "$ROOT/build" -j"$(nproc)"
|
cmake --build "$ROOT/build" -j"$(nproc)"
|
||||||
ctest --test-dir "$ROOT/build" --output-on-failure
|
ctest --test-dir "$ROOT/build" --output-on-failure
|
||||||
|
|
||||||
|
# CI gate (issue 0048): toda funcion C++ creada en los ultimos 30 dias debe
|
||||||
|
# tener tested:true en el .md. No-op si no hay registry.db.
|
||||||
|
"$ROOT/scripts/check_tested.sh" 30
|
||||||
|
|||||||
Executable
+17
@@ -0,0 +1,17 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Regenera los golden screenshots para el test visual (issue 0048).
|
||||||
|
#
|
||||||
|
# Uso:
|
||||||
|
# cpp/scripts/update_goldens.sh
|
||||||
|
#
|
||||||
|
# Compila primitives_gallery, lo lanza con --capture sobre cpp/tests/golden/,
|
||||||
|
# y deja PNG por demo. Use LIBGL_ALWAYS_SOFTWARE=1 si no hay GPU/driver.
|
||||||
|
set -euo pipefail
|
||||||
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||||
|
cmake -S "$ROOT" -B "$ROOT/build" -DCMAKE_BUILD_TYPE=Release
|
||||||
|
cmake --build "$ROOT/build" --target primitives_gallery -j"$(nproc)"
|
||||||
|
mkdir -p "$ROOT/tests/golden"
|
||||||
|
LIBGL_ALWAYS_SOFTWARE=1 \
|
||||||
|
"$ROOT/build/apps/primitives_gallery/primitives_gallery" \
|
||||||
|
--capture "$ROOT/tests/golden"
|
||||||
|
echo "Goldens regenerated: $ROOT/tests/golden/"
|
||||||
Reference in New Issue
Block a user