|
| 1 | +#!/usr/bin/env bash |
| 2 | +# SPDX-License-Identifier: PMPL-1.0-or-later |
| 3 | +# dogfood-test.sh — Verify local backends return real data for CRG D→C promotion. |
| 4 | +# |
| 5 | +# Usage: |
| 6 | +# ./scripts/dogfood-test.sh [--with-boj] [--with-verisimdb] |
| 7 | +# |
| 8 | +# Tests the 3 local backends (Farm, Provenance, Watcher) that require |
| 9 | +# no network services. With flags, also tests BoJ and VeriSimDB. |
| 10 | + |
| 11 | +set -euo pipefail |
| 12 | + |
| 13 | +PASS=0 |
| 14 | +FAIL=0 |
| 15 | +SKIP=0 |
| 16 | + |
| 17 | +check() { |
| 18 | + local name="$1" |
| 19 | + local result="$2" |
| 20 | + if [ "$result" = "ok" ]; then |
| 21 | + echo " ✓ $name" |
| 22 | + PASS=$((PASS + 1)) |
| 23 | + elif [ "$result" = "skip" ]; then |
| 24 | + echo " ⊘ $name (skipped)" |
| 25 | + SKIP=$((SKIP + 1)) |
| 26 | + else |
| 27 | + echo " ✗ $name: $result" |
| 28 | + FAIL=$((FAIL + 1)) |
| 29 | + fi |
| 30 | +} |
| 31 | + |
| 32 | +echo "PanLL CRG D→C Dogfooding Test" |
| 33 | +echo "==============================" |
| 34 | +echo "" |
| 35 | + |
| 36 | +# Check Gossamer binary exists |
| 37 | +BINARY="target/debug/panll-gossamer" |
| 38 | +if [ ! -f "$BINARY" ]; then |
| 39 | + echo "Note: Gossamer binary not built (requires libgossamer.so from gossamer repo)." |
| 40 | + echo "Run 'cd ../gossamer && zig build' first, then 'cargo build --bin panll-gossamer'." |
| 41 | + echo "Testing backend code readiness without running binary..." |
| 42 | + echo "" |
| 43 | +fi |
| 44 | + |
| 45 | +echo "1. Farm (local filesystem)" |
| 46 | +echo " Checks: farm manifest exists, can list repos" |
| 47 | +if [ -f "$HOME/.git-private-farm/farm-manifest.json" ]; then |
| 48 | + check "Farm manifest exists" "ok" |
| 49 | +else |
| 50 | + echo " ⊘ Farm manifest not found at ~/.git-private-farm/farm-manifest.json" |
| 51 | + echo " Create it to enable the Farm panel (JSON array of repo entries)." |
| 52 | + SKIP=$((SKIP + 1)) |
| 53 | +fi |
| 54 | + |
| 55 | +echo "" |
| 56 | +echo "2. Provenance Map (git blame)" |
| 57 | +echo " Checks: git blame on a known file" |
| 58 | +BLAME_OUT=$(git blame --porcelain -- src/App.res 2>/dev/null | head -1 || true) |
| 59 | +if echo "$BLAME_OUT" | grep -qE '^[0-9a-f]'; then |
| 60 | + check "Git blame on src/App.res" "ok" |
| 61 | +else |
| 62 | + check "Git blame on src/App.res" "git blame failed" |
| 63 | +fi |
| 64 | + |
| 65 | +if git log --oneline -1 src/App.res 2>/dev/null | grep -q '.'; then |
| 66 | + check "Git log on src/App.res" "ok" |
| 67 | +else |
| 68 | + check "Git log on src/App.res" "git log failed" |
| 69 | +fi |
| 70 | + |
| 71 | +echo "" |
| 72 | +echo "3. Filesystem Watcher (notify crate)" |
| 73 | +echo " Checks: notify crate in Cargo.toml, watcher module compiles" |
| 74 | +if grep -q 'notify' Cargo.toml 2>/dev/null; then |
| 75 | + check "notify crate in Cargo.toml" "ok" |
| 76 | +else |
| 77 | + check "notify crate in Cargo.toml" "missing dependency" |
| 78 | +fi |
| 79 | + |
| 80 | +if cargo check 2>&1 | grep -q 'Finished'; then |
| 81 | + check "Gossamer backend compiles clean" "ok" |
| 82 | +else |
| 83 | + check "Gossamer backend compiles clean" "compilation errors" |
| 84 | +fi |
| 85 | + |
| 86 | +echo "" |
| 87 | +echo "4. BoJ-server (port 7700)" |
| 88 | +if [[ "${1:-}" == *"--with-boj"* ]] || [[ "${2:-}" == *"--with-boj"* ]]; then |
| 89 | + if curl -sf http://localhost:7700/status >/dev/null 2>&1; then |
| 90 | + check "BoJ-server reachable" "ok" |
| 91 | + else |
| 92 | + check "BoJ-server reachable" "not running on :7700" |
| 93 | + fi |
| 94 | +else |
| 95 | + check "BoJ-server" "skip" |
| 96 | +fi |
| 97 | + |
| 98 | +echo "" |
| 99 | +echo "5. VeriSimDB (port 8093)" |
| 100 | +if [[ "${1:-}" == *"--with-verisimdb"* ]] || [[ "${2:-}" == *"--with-verisimdb"* ]]; then |
| 101 | + if curl -sf http://localhost:8093/health >/dev/null 2>&1; then |
| 102 | + check "VeriSimDB reachable" "ok" |
| 103 | + else |
| 104 | + check "VeriSimDB reachable" "not running on :8093" |
| 105 | + fi |
| 106 | +else |
| 107 | + check "VeriSimDB" "skip" |
| 108 | +fi |
| 109 | + |
| 110 | +echo "" |
| 111 | +echo "==============================" |
| 112 | +echo "Results: $PASS passed, $FAIL failed, $SKIP skipped" |
| 113 | +echo "" |
| 114 | + |
| 115 | +if [ "$FAIL" -gt 0 ]; then |
| 116 | + echo "Fix failures before dogfooding sessions." |
| 117 | + exit 1 |
| 118 | +else |
| 119 | + echo "Local backends verified. Ready for dogfooding sessions." |
| 120 | + echo "" |
| 121 | + echo "Next steps:" |
| 122 | + echo " 1. Run 'deno task dev' to start the dev server" |
| 123 | + echo " 2. Open http://localhost:8000/public/ in browser" |
| 124 | + echo " 3. Test Farm, Provenance Map, and Watcher panels" |
| 125 | + echo " 4. Log session in docs/CRG-DOGFOOD-CHECKLIST.md" |
| 126 | + exit 0 |
| 127 | +fi |
0 commit comments