From bf6f4faa1ffa2bc7f29b5ebaf3867c50e1baad6f Mon Sep 17 00:00:00 2001 From: tomoaki Date: Tue, 23 Dec 2025 08:34:19 +0900 Subject: [PATCH] test(smoke): Phase 283 P0 - Add VM/LLVM smoke tests + doc update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- .../current/main/phases/phase-283/README.md | 8 ++++++ .../apps/phase283_p0_loop_if_phi_llvm.sh | 20 +++++++++++++++ .../apps/phase283_p0_loop_if_phi_vm.sh | 25 +++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 tools/smokes/v2/profiles/integration/apps/phase283_p0_loop_if_phi_llvm.sh create mode 100644 tools/smokes/v2/profiles/integration/apps/phase283_p0_loop_if_phi_vm.sh diff --git a/docs/development/current/main/phases/phase-283/README.md b/docs/development/current/main/phases/phase-283/README.md index 09eab6b3..9c0464dc 100644 --- a/docs/development/current/main/phases/phase-283/README.md +++ b/docs/development/current/main/phases/phase-283/README.md @@ -45,3 +45,11 @@ After Phase 275 (C2), implicit `"String" + Integer` is a TypeError. The fixture - `apps/tests/loop_if_phi.hako` runs on VM without undefined ValueId errors and prints `sum=9`. +Recommended smoke checks: +- VM: `tools/smokes/v2/profiles/integration/apps/phase283_p0_loop_if_phi_vm.sh` + - Checks stdout output: `sum=9` + - Exit code: 0 +- LLVM harness: `tools/smokes/v2/profiles/integration/apps/phase283_p0_loop_if_phi_llvm.sh` + - **Note**: LLVM harness (`NYASH_LLVM_USE_HARNESS=1`) suppresses program stdout + - Only check: `Result: 0` line in stderr (exit code = 0) + - Direct execution: `NYASH_LLVM_USE_HARNESS=1 ./target/release/hakorune --backend llvm apps/tests/loop_if_phi.hako` diff --git a/tools/smokes/v2/profiles/integration/apps/phase283_p0_loop_if_phi_llvm.sh b/tools/smokes/v2/profiles/integration/apps/phase283_p0_loop_if_phi_llvm.sh new file mode 100644 index 00000000..6301e6fb --- /dev/null +++ b/tools/smokes/v2/profiles/integration/apps/phase283_p0_loop_if_phi_llvm.sh @@ -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 diff --git a/tools/smokes/v2/profiles/integration/apps/phase283_p0_loop_if_phi_vm.sh b/tools/smokes/v2/profiles/integration/apps/phase283_p0_loop_if_phi_vm.sh new file mode 100644 index 00000000..aae8bd2d --- /dev/null +++ b/tools/smokes/v2/profiles/integration/apps/phase283_p0_loop_if_phi_vm.sh @@ -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