Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
#!/usr/bin/env bash
|
||||
# ============================================================
|
||||
# HCIE-Rust v3.05 — Categorized Test Runner (Linux shell)
|
||||
# Usage: bash run_tests_categorized.sh [--no-io] [--no-4k] [--ignored]
|
||||
# ============================================================
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
cd "$ROOT_DIR"
|
||||
|
||||
PASS=0
|
||||
FAIL=0
|
||||
SKIP=0
|
||||
SKIP_IO=false
|
||||
SKIP_4K=false
|
||||
INCLUDE_IGNORED=false
|
||||
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--no-io) SKIP_IO=true ;;
|
||||
--no-4k) SKIP_4K=true ;;
|
||||
--ignored) INCLUDE_IGNORED=true ;;
|
||||
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
|
||||
|
||||
if cargo test -p "$crate" $extra 2>&1; then
|
||||
PASS=$((PASS + 1))
|
||||
else
|
||||
FAIL=$((FAIL + 1))
|
||||
fi
|
||||
}
|
||||
|
||||
# ── Layer 1: DATA ──────────────────────────────────────────
|
||||
run_crate "hcie-protocol" "DATA"
|
||||
run_crate "hcie-color" "DATA"
|
||||
|
||||
# ── Layer 2: ENGINE CORE ───────────────────────────────────
|
||||
run_crate "hcie-blend" "CORE"
|
||||
run_crate "hcie-brush-engine" "CORE"
|
||||
run_crate "hcie-draw" "CORE"
|
||||
run_crate "hcie-composite" "CORE"
|
||||
run_crate "hcie-filter" "CORE"
|
||||
run_crate "hcie-selection" "CORE"
|
||||
run_crate "hcie-vector" "CORE"
|
||||
run_crate "hcie-history" "CORE"
|
||||
|
||||
if [ "$SKIP_IO" = true ]; then
|
||||
echo "[SKIP] hcie-io"
|
||||
SKIP=$((SKIP + 1))
|
||||
else
|
||||
run_crate "hcie-io" "CORE"
|
||||
fi
|
||||
run_crate "hcie-psd" "CORE"
|
||||
run_crate "hcie-vision" "CORE"
|
||||
run_crate "hcie-build-info" "CORE"
|
||||
|
||||
# ── Layer 4: ENGINE API ────────────────────────────────────
|
||||
if [ "$SKIP_4K" = true ]; then
|
||||
run_crate "hcie-engine-api" "ENGINE-API" "--skip benchmark_4k_stroke_on_multilayer_document"
|
||||
else
|
||||
run_crate "hcie-engine-api" "ENGINE-API"
|
||||
fi
|
||||
|
||||
# ── Layer 6: GUI ───────────────────────────────────────────
|
||||
run_crate "hcie-gui-egui" "GUI-egui"
|
||||
run_crate "hcie-iced-gui" "GUI-iced"
|
||||
|
||||
# ── 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
|
||||
|
||||
SEPARATOR
|
||||
echo "CATEGORIZED TEST RUN COMPLETE: $PASS passed, $FAIL failed, $SKIP skipped"
|
||||
SEPARATOR
|
||||
exit "$FAIL"
|
||||
Reference in New Issue
Block a user