test(smoke): Phase 283 P0 - Add VM/LLVM smoke tests + doc update

- VM smoke: phase283_p0_loop_if_phi_vm.sh (checks sum=9 output)
- LLVM smoke: phase283_p0_loop_if_phi_llvm.sh (checks Result: 0, exit=0)
- Documentation: Update phase-283 README with LLVM harness notes
  - LLVM harness suppresses program stdout
  - VM shows stdout, LLVM checks exit code only

Both tests verified:  PASS

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-23 08:34:19 +09:00
parent bfbc9b26bf
commit bf6f4faa1f
3 changed files with 53 additions and 0 deletions

View File

@ -0,0 +1,20 @@
#!/bin/bash
# Phase 283 P0: Pattern3 loop_if_phi fix (LLVM harness backend)
# Tests: loop(i <= 5) with if-else phi (sum += odd numbers)
set -euo pipefail
HAKO_PATH="apps/tests/loop_if_phi.hako"
# LLVM harnessはstdoutを抑制するため、exit=0 (Result: 0) で判定
EXPECTED_EXIT=0
NYASH_LLVM_USE_HARNESS=1 $HAKORUNE_BIN --backend llvm "$HAKO_PATH"
actual_exit=$?
if [[ $actual_exit -eq $EXPECTED_EXIT ]]; then
echo "✅ phase283_p0_loop_if_phi_llvm: PASS (exit=$actual_exit)"
exit 0
else
echo "❌ phase283_p0_loop_if_phi_llvm: FAIL (expected=$EXPECTED_EXIT, got=$actual_exit)"
exit 1
fi

View File

@ -0,0 +1,25 @@
#!/bin/bash
# Phase 283 P0 - Pattern3 loop_if_phi fix (VM backend)
# Tests: loop(i <= 5) with if-else phi (sum += odd numbers)
HAKO_FILE="apps/tests/loop_if_phi.hako"
BACKEND="vm"
# Expected: [Console LOG] sum=9
EXPECTED_OUTPUT="sum=9"
ACTUAL_OUTPUT=$(./target/release/hakorune --backend "$BACKEND" "$HAKO_FILE" 2>&1 | grep -o 'sum=[0-9]*')
if [ "$ACTUAL_OUTPUT" = "$EXPECTED_OUTPUT" ]; then
echo "✅ PASS: phase283_p0_loop_if_phi_vm"
exit 0
else
echo "❌ FAIL: phase283_p0_loop_if_phi_vm"
echo "Expected:"
echo "$EXPECTED_OUTPUT"
echo "Got:"
echo "$ACTUAL_OUTPUT"
echo "---Full output (last 80 lines):---"
./target/release/hakorune --backend "$BACKEND" "$HAKO_FILE" 2>&1 | tail -n 80
exit 1
fi