Refactor code structure for improved readability and maintainability
This commit is contained in:
Executable
+139
@@ -0,0 +1,139 @@
|
||||
#!/usr/bin/env bash
|
||||
# ============================================================
|
||||
# HCIE-Rust v3.05 — Bulk All-Tests Execution Script (bash)
|
||||
# Usage: bash run_all_tests.sh [--no-io] [--no-4k] [--ignored]
|
||||
#
|
||||
# Flags:
|
||||
# --no-io Skip hcie-io tests (slow, needs PSD fixtures)
|
||||
# --no-4k Skip the 4K performance benchmark
|
||||
# --ignored Also run #[ignore] tests (visual checks, benchmarks)
|
||||
# ============================================================
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
cd "$ROOT_DIR"
|
||||
|
||||
PASS=0
|
||||
FAIL=0
|
||||
SKIP=0
|
||||
START_TIME=$(date +%s)
|
||||
|
||||
SKIP_IO=false
|
||||
SKIP_4K=false
|
||||
INCLUDE_IGNORED=false
|
||||
EXTRA_ARGS=()
|
||||
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--no-io) SKIP_IO=true ;;
|
||||
--no-4k) SKIP_4K=true ;;
|
||||
--ignored) INCLUDE_IGNORED=true ;;
|
||||
*) EXTRA_ARGS+=("$arg") ;;
|
||||
esac
|
||||
done
|
||||
|
||||
SEPARATOR() { printf '%*s\n' 80 '' | tr ' ' '='; }
|
||||
|
||||
run_crate() {
|
||||
local crate="$1"
|
||||
local label="$2"
|
||||
local extra="${3:-}"
|
||||
|
||||
SEPARATOR
|
||||
echo "[$label] Running: cargo test -p $crate $extra"
|
||||
SEPARATOR
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
if cargo test -p "$crate" $extra "${EXTRA_ARGS[@]+${EXTRA_ARGS[@]}}" 2>&1; then
|
||||
PASS=$((PASS + 1))
|
||||
else
|
||||
FAIL=$((FAIL + 1))
|
||||
fi
|
||||
}
|
||||
|
||||
display_summary() {
|
||||
local elapsed=$(( $(date +%s) - START_TIME ))
|
||||
echo ""
|
||||
SEPARATOR
|
||||
echo " BULK TEST EXECUTION COMPLETE"
|
||||
echo " Crates passed: $PASS"
|
||||
echo " Crates failed: $FAIL"
|
||||
echo " Crates skipped: $SKIP"
|
||||
echo " Elapsed time: ${elapsed}s"
|
||||
SEPARATOR
|
||||
[ "$FAIL" -eq 0 ] && echo " ALL CRATES PASSED" || echo " $FAIL crate(s) have failing tests"
|
||||
exit "$FAIL"
|
||||
}
|
||||
|
||||
# ──────────────────────────────────────────────────────────
|
||||
# Layer 1: DATA
|
||||
# ──────────────────────────────────────────────────────────
|
||||
run_crate "hcie-protocol" "Layer 1"
|
||||
run_crate "hcie-color" "Layer 1"
|
||||
|
||||
# ──────────────────────────────────────────────────────────
|
||||
# Layer 2: ENGINE CORE
|
||||
# ──────────────────────────────────────────────────────────
|
||||
run_crate "hcie-blend" "Layer 2"
|
||||
run_crate "hcie-brush-engine" "Layer 2"
|
||||
run_crate "hcie-draw" "Layer 2"
|
||||
run_crate "hcie-composite" "Layer 2"
|
||||
run_crate "hcie-filter" "Layer 2"
|
||||
run_crate "hcie-selection" "Layer 2"
|
||||
run_crate "hcie-vector" "Layer 2"
|
||||
run_crate "hcie-history" "Layer 2"
|
||||
|
||||
if [ "$SKIP_IO" = true ]; then
|
||||
echo "[SKIP] hcie-io (--no-io flag)"
|
||||
SKIP=$((SKIP + 1))
|
||||
else
|
||||
run_crate "hcie-io" "Layer 2"
|
||||
fi
|
||||
|
||||
run_crate "hcie-psd" "Layer 2"
|
||||
run_crate "hcie-vision" "Layer 2"
|
||||
run_crate "hcie-build-info" "Layer 2"
|
||||
|
||||
# ──────────────────────────────────────────────────────────
|
||||
# Layer 4: ENGINE API
|
||||
# ──────────────────────────────────────────────────────────
|
||||
if [ "$SKIP_4K" = true ]; then
|
||||
run_crate "hcie-engine-api" "Layer 4" "--skip benchmark_4k_stroke_on_multilayer_document"
|
||||
else
|
||||
run_crate "hcie-engine-api" "Layer 4"
|
||||
fi
|
||||
|
||||
# ──────────────────────────────────────────────────────────
|
||||
# Layer 6: GUI — egui
|
||||
# ──────────────────────────────────────────────────────────
|
||||
run_crate "hcie-gui-egui" "Layer 6"
|
||||
|
||||
# ──────────────────────────────────────────────────────────
|
||||
# Layer 6: GUI — iced
|
||||
# ──────────────────────────────────────────────────────────
|
||||
run_crate "hcie-iced-gui" "Layer 6"
|
||||
|
||||
# ──────────────────────────────────────────────────────────
|
||||
# Brush Catalogs
|
||||
# ──────────────────────────────────────────────────────────
|
||||
run_crate "hcie-dry-media-brushes" "Brushes"
|
||||
run_crate "hcie-paint-brushes" "Brushes"
|
||||
run_crate "hcie-digital-brushes" "Brushes"
|
||||
run_crate "hcie-watercolor-brushes" "Brushes"
|
||||
run_crate "hcie-ink-brushes" "Brushes"
|
||||
|
||||
# ──────────────────────────────────────────────────────────
|
||||
# Ignored tests (visual checks, benchmarks)
|
||||
# ──────────────────────────────────────────────────────────
|
||||
if [ "$INCLUDE_IGNORED" = true ]; then
|
||||
echo ""
|
||||
SEPARATOR
|
||||
echo "Running IGNORED tests (visual checks, benchmarks)"
|
||||
SEPARATOR
|
||||
cargo test -p hcie-engine-api -- --ignored || true
|
||||
cargo test -p hcie-brush-engine -- --ignored || true
|
||||
cargo test -p hcie-iced-gui -- --ignored || true
|
||||
cargo test -p hcie-fx -- --ignored || true
|
||||
fi
|
||||
|
||||
display_summary
|
||||
Reference in New Issue
Block a user