diff --git a/tools/smokes/v2/profiles/integration/apps/phase97_json_loader_escape_llvm_exe.sh b/tools/smokes/v2/profiles/integration/apps/phase97_json_loader_escape_llvm_exe.sh new file mode 100644 index 00000000..f1ac5e9d --- /dev/null +++ b/tools/smokes/v2/profiles/integration/apps/phase97_json_loader_escape_llvm_exe.sh @@ -0,0 +1,67 @@ +#!/bin/bash +# Phase 97: json_loader escape loop (LLVM EXE parity) + +source "$(dirname "$0")/../../../lib/test_runner.sh" +export SMOKES_USE_PYVM=0 +require_env || exit 2 + +# LLVM availability checks (graceful SKIP) +if ! command -v llvm-config-18 &> /dev/null; then + test_skip "llvm-config-18 not found"; exit 0 +fi + +if ! "$NYASH_BIN" --help 2>&1 | grep -q "llvm"; then + test_skip "hakorune --backend llvm not available"; exit 0 +fi + +if ! python3 -c "import llvmlite" 2>/dev/null; then + test_skip "Python llvmlite not found"; exit 0 +fi + +FILEBOX_SO="$NYASH_ROOT/plugins/nyash-filebox-plugin/libnyash_filebox_plugin.so" +MAPBOX_SO="$NYASH_ROOT/plugins/nyash-map-plugin/libnyash_map_plugin.so" +if [ ! -f "$FILEBOX_SO" ] || [ ! -f "$MAPBOX_SO" ]; then + test_skip "Required plugins not found (FileBox/MapBox)"; exit 0 +fi + +mkdir -p "$NYASH_ROOT/tmp" + +INPUT_HAKO="$NYASH_ROOT/apps/tests/phase95_json_loader_escape_min.hako" +OUTPUT_EXE="$NYASH_ROOT/tmp/phase97_json_loader_escape_llvm_exe" + +echo "[INFO] Building: $INPUT_HAKO → $OUTPUT_EXE" + +BUILD_LOG="/tmp/phase97_json_loader_escape_build.log" +if ! env NYASH_DISABLE_PLUGINS=1 "$NYASH_ROOT/tools/build_llvm.sh" "$INPUT_HAKO" -o "$OUTPUT_EXE" 2>&1 | tee "$BUILD_LOG"; then + echo "[FAIL] build_llvm.sh failed" + tail -n 80 "$BUILD_LOG" + exit 1 +fi + +if [ ! -x "$OUTPUT_EXE" ]; then + echo "[FAIL] Executable not created or not executable: $OUTPUT_EXE" + ls -la "$OUTPUT_EXE" 2>/dev/null || echo "File does not exist" + exit 1 +fi + +echo "[INFO] Executing: $OUTPUT_EXE" + +set +e +OUTPUT=$(timeout "${RUN_TIMEOUT_SECS:-10}" env NYASH_DISABLE_PLUGINS=1 "$OUTPUT_EXE" 2>&1) +EXIT_CODE=$? +set -e + +if [ "$EXIT_CODE" -ne 0 ]; then + echo "[FAIL] Execution failed with exit code $EXIT_CODE" + echo "$OUTPUT" | tail -n 80 + exit 1 +fi + +if printf "%s\n" "$OUTPUT" | grep -q '^hello" world$'; then + test_pass "phase97_json_loader_escape_llvm_exe: output verified (hello\" world)" +else + echo "[FAIL] Unexpected output (expected line: hello\" world)" + echo "[INFO] output (tail):" + echo "$OUTPUT" | tail -n 80 + exit 1 +fi diff --git a/tools/smokes/v2/profiles/integration/apps/phase97_next_non_ws_llvm_exe.sh b/tools/smokes/v2/profiles/integration/apps/phase97_next_non_ws_llvm_exe.sh new file mode 100644 index 00000000..671c1131 --- /dev/null +++ b/tools/smokes/v2/profiles/integration/apps/phase97_next_non_ws_llvm_exe.sh @@ -0,0 +1,75 @@ +#!/bin/bash +# Phase 97: next_non_ws fixture (LLVM EXE parity) + +source "$(dirname "$0")/../../../lib/test_runner.sh" +export SMOKES_USE_PYVM=0 +require_env || exit 2 + +# LLVM availability checks (graceful SKIP) +if ! command -v llvm-config-18 &> /dev/null; then + test_skip "llvm-config-18 not found"; exit 0 +fi + +if ! "$NYASH_BIN" --help 2>&1 | grep -q "llvm"; then + test_skip "hakorune --backend llvm not available"; exit 0 +fi + +if ! python3 -c "import llvmlite" 2>/dev/null; then + test_skip "Python llvmlite not found"; exit 0 +fi + +FILEBOX_SO="$NYASH_ROOT/plugins/nyash-filebox-plugin/libnyash_filebox_plugin.so" +MAPBOX_SO="$NYASH_ROOT/plugins/nyash-map-plugin/libnyash_map_plugin.so" +if [ ! -f "$FILEBOX_SO" ] || [ ! -f "$MAPBOX_SO" ]; then + test_skip "Required plugins not found (FileBox/MapBox)"; exit 0 +fi + +mkdir -p "$NYASH_ROOT/tmp" + +INPUT_HAKO="$NYASH_ROOT/apps/tests/phase96_json_loader_next_non_ws_min.hako" +OUTPUT_EXE="$NYASH_ROOT/tmp/phase97_next_non_ws_llvm_exe" + +echo "[INFO] Building: $INPUT_HAKO → $OUTPUT_EXE" + +BUILD_LOG="/tmp/phase97_next_non_ws_build.log" +if ! env NYASH_DISABLE_PLUGINS=1 "$NYASH_ROOT/tools/build_llvm.sh" "$INPUT_HAKO" -o "$OUTPUT_EXE" 2>&1 | tee "$BUILD_LOG"; then + echo "[FAIL] build_llvm.sh failed" + tail -n 80 "$BUILD_LOG" + exit 1 +fi + +if [ ! -x "$OUTPUT_EXE" ]; then + echo "[FAIL] Executable not created or not executable: $OUTPUT_EXE" + ls -la "$OUTPUT_EXE" 2>/dev/null || echo "File does not exist" + exit 1 +fi + +echo "[INFO] Executing: $OUTPUT_EXE" + +set +e +OUTPUT=$(timeout "${RUN_TIMEOUT_SECS:-10}" env NYASH_DISABLE_PLUGINS=1 "$OUTPUT_EXE" 2>&1) +EXIT_CODE=$? +set -e + +if [ "$EXIT_CODE" -ne 0 ]; then + echo "[FAIL] Execution failed with exit code $EXIT_CODE" + echo "$OUTPUT" | tail -n 80 + exit 1 +fi + +CLEAN=$(printf "%s\n" "$OUTPUT" | grep -E '^-?[0-9]+$' | head -n 2 | tr -d '\r') +EXPECTED=$'2\n-1' + +echo "[INFO] CLEAN output:" +echo "$CLEAN" + +if [ "$CLEAN" = "$EXPECTED" ]; then + test_pass "phase97_next_non_ws_llvm_exe: output matches expected (2, -1)" +else + echo "[FAIL] Output mismatch" + echo "[INFO] Raw output (tail):" + echo "$OUTPUT" | tail -n 80 + echo "[INFO] Expected:" + printf "%s\n" "$EXPECTED" + exit 1 +fi