test(docs): Phase 133 smoke is compile-only (--dump-mir)

This commit is contained in:
nyash-codex
2025-12-15 16:57:28 +09:00
parent f5c1694d44
commit 06bfb1eb31
2 changed files with 26 additions and 95 deletions

View File

@ -55,8 +55,7 @@ loop(index < s.length()) {
### P0: Fixture & Smoke Test 実装 ### P0: Fixture & Smoke Test 実装
- ✅ Fixture: `apps/tests/phase133_json_skip_whitespace_min.hako` - ✅ Fixture: `apps/tests/phase133_json_skip_whitespace_min.hako`
- ✅ Smoke: `tools/smokes/v2/profiles/integration/apps/phase133_json_skip_whitespace_llvm_exe.sh` - ✅ Smoke: `tools/smokes/v2/profiles/integration/apps/phase133_json_skip_whitespace_llvm_exe.sh`
- P0: promoted carrier join_id エラーを検出Phase 133 修正前の状態) - 現状: compile-only`--dump-mir`)で `[phase229] ... has no join_id` が出ないことを固定
- P1: MIR compilation 成功promoted carrier join_id エラー消滅)
### P1: 修正完了 ### P1: 修正完了
- ✅ MIR compilation: promoted carrier join_id エラーが消滅 - ✅ MIR compilation: promoted carrier join_id エラーが消滅

View File

@ -1,103 +1,35 @@
#!/bin/bash #!/bin/bash
# Phase 133 P0: Promoted carrier join_id test # Phase 133 P1: Promoted carrier join_id regression (compile-only)
# Tests: Loop + promoted carrier + break (from JsonParser._skip_whitespace pattern) # Tests: Pattern2 + Trim(A-3) promotion no longer triggers:
# Issue: promoted carrier 'is_char_match' has no join_id when break is used # [phase229] promoted carrier '<name>' has no join_id
# Acceptance: Fixture compiles VM/LLVM and returns exit code 3 #
# Note:
# - This smoke is intentionally compile-only (`--dump-mir`).
# - Runtime/LLVM EXE execution depends on Box providers/plugins and is out of scope here.
source "$(dirname "$0")/../../../lib/test_runner.sh" source "$(dirname "$0")/../../../lib/test_runner.sh"
export SMOKES_USE_PYVM=0 export SMOKES_USE_PYVM=0
require_env || exit 2 require_env || exit 2
# Check LLVM availability (SKIP if not found) # ===== Compile-only: ensure JoinIR lowering does not panic =====
if ! command -v llvm-config-18 &> /dev/null; then echo "[INFO] Phase 133 P1: compile-only (phase133_json_skip_whitespace_min.hako)"
test_skip "llvm-config-18 not found"; exit 0
fi
# Check hakorune LLVM backend
if ! "$NYASH_BIN" --help 2>&1 | grep -q "llvm"; then
test_skip "hakorune --backend llvm not available"; exit 0
fi
# Check Python llvmlite
if ! python3 -c "import llvmlite" 2>/dev/null; then
test_skip "Python llvmlite not found"; exit 0
fi
mkdir -p "$NYASH_ROOT/tmp"
PASS_COUNT=0
FAIL_COUNT=0
BUILD_TIMEOUT_SECS=${BUILD_TIMEOUT_SECS:-300}
RUN_TIMEOUT_SECS=${RUN_TIMEOUT_SECS:-10}
# ===== VM: Test fixture compiles and runs =====
echo "[INFO] Phase 133 P0: VM test (phase133_json_skip_whitespace_min.hako)"
INPUT="$NYASH_ROOT/apps/tests/phase133_json_skip_whitespace_min.hako" INPUT="$NYASH_ROOT/apps/tests/phase133_json_skip_whitespace_min.hako"
OUT="$(timeout "${RUN_TIMEOUT_SECS:-30}" "$NYASH_BIN" --dump-mir "$INPUT" 2>&1)"
RC=$?
# VM test: Try to run (may fail with promoted carrier error) if [ "$RC" -ne 0 ]; then
set +e echo "[FAIL] compile: hakorune --dump-mir failed (rc=$RC)"
timeout "$RUN_TIMEOUT_SECS" "$NYASH_BIN" "$INPUT" > /tmp/phase133_vm_output.log 2>&1 echo "[INFO] output (tail):"
VM_EXIT=$? echo "$OUT" | tail -n 80 || true
set -e
if grep -q "phase229.*promoted carrier.*join_id" /tmp/phase133_vm_output.log; then
echo "[INFO] VM: Expected promoted carrier join_id error detected (Phase 133 target)"
echo "[INFO] (This error will be fixed in Phase 133 modification)"
# Mark as PASS since this is the expected failure state
PASS_COUNT=$((PASS_COUNT + 1))
elif [ "$VM_EXIT" -eq 0 ]; then
echo "[PASS] VM: Fixture compiles (promoted carrier join_id fixed!)"
PASS_COUNT=$((PASS_COUNT + 1))
else
echo "[FAIL] VM: Unexpected error"
FAIL_COUNT=$((FAIL_COUNT + 1))
fi
# ===== LLVM EXE: Test Phase 132 parity (build + execute) =====
echo "[INFO] LLVM EXE: Building executable (will fail until Phase 133 fix)"
OUTPUT="$NYASH_ROOT/tmp/phase133_json_skip_whitespace_min"
# Try to build with LLVM
if timeout "$BUILD_TIMEOUT_SECS" "$NYASH_ROOT/tools/build_llvm.sh" "$INPUT" -o "$OUTPUT" > /tmp/phase133_build.log 2>&1; then
# Build succeeded - Phase 133 fix must be applied
if [ -x "$OUTPUT" ]; then
set +e
timeout "$RUN_TIMEOUT_SECS" "$OUTPUT" > /dev/null 2>&1
EXIT_CODE=$?
set -e
if [ "$EXIT_CODE" -eq 3 ]; then
echo "[PASS] LLVM EXE: exit code 3 verified"
PASS_COUNT=$((PASS_COUNT + 1))
else
echo "[FAIL] LLVM EXE: expected exit code 3, got $EXIT_CODE"
FAIL_COUNT=$((FAIL_COUNT + 1))
fi
else
echo "[FAIL] LLVM EXE: build succeeded but no executable"
FAIL_COUNT=$((FAIL_COUNT + 1))
fi
else
# Build failed - expected until Phase 133 fix
if grep -q "phase229.*promoted carrier.*join_id" /tmp/phase133_build.log; then
echo "[INFO] LLVM Build: Expected promoted carrier join_id error (Phase 133 target)"
echo "[INFO] (This error will be fixed in Phase 133 modification)"
# Mark as PASS since this is the expected failure state
PASS_COUNT=$((PASS_COUNT + 1))
else
echo "[FAIL] LLVM Build: Unexpected error"
tail -10 /tmp/phase133_build.log
FAIL_COUNT=$((FAIL_COUNT + 1))
fi
fi
# ===== Summary =====
echo ""
echo "[RESULT] Phase 133 P0: $PASS_COUNT passed, $FAIL_COUNT failed"
if [ "$FAIL_COUNT" -eq 0 ]; then
exit 0
else
exit 1 exit 1
fi fi
if echo "$OUT" | grep -q "phase229.*promoted carrier.*join_id"; then
echo "[FAIL] compile: promoted carrier join_id error still present"
echo "[INFO] output (match):"
echo "$OUT" | grep -n "phase229" | tail -n 20 || true
exit 1
fi
echo "[PASS] compile: no promoted carrier join_id error"
exit 0