Create single source of truth for smoke test environment configuration: **tools/smokes/v2/lib/env.sh** (new, 183 lines): - Centralize 16 environment variables across 6 categories - JoinIR development (NYASH_JOINIR_DEV, HAKO_JOINIR_STRICT) - LLVM features (NYASH_LLVM_USE_HARNESS, NYASH_LLVM_BACKEND, etc.) - Tmpdir EXDEV mitigation (TARGET_TMPDIR) - Plugin loader strategy (NYASH_LOAD_NY_PLUGINS, NYASH_DISABLE_PLUGINS) - Parser features (NYASH_FEATURES, using system variables) - Debug features (NYASH_CLI_VERBOSE, etc.) **Mode Presets**: - dev: Verbose logging, unlimited fuel, JoinIR dev enabled - integration: Moderate settings, JoinIR dev enabled - quick: Minimal logging, fast execution **Helper Functions**: - setup_smoke_env [mode]: Configure environment for test profiles - validate_env_setup: Validate configuration - show_smoke_env: Display current configuration **Documentation**: - ENV_README.md: Comprehensive usage guide - ENV_QUICK_START.md: Quick reference for script authors - p1.5-task5-env-ssot.md: Implementation details and testing Benefits: - SSOT: Single file for all environment variables - Sparrow prevention: No duplicate settings - Clarity: Well-documented configuration - Backward compatibility: Existing scripts work unchanged Test Results: - All environment presets work correctly - Phase 131 smoke tests PASS - Syntax validation for all shell files PASS Related: Phase 131 smoke test infrastructure improvement 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
1.8 KiB
1.8 KiB
Environment Variable SSOT - Quick Start
TL;DR
All smoke test environment variables are now managed in tools/smokes/v2/lib/env.sh.
For Script Authors
Existing Scripts
✅ No changes required! Scripts that source test_runner.sh or llvm_exe_runner.sh automatically get env.sh.
New Scripts
#!/bin/bash
source "$(dirname "$0")/../lib/test_runner.sh" # Auto-sources env.sh
require_env || exit 2
# Your test code here
test_pass "my_test: passed"
Phase 131+ Scripts (Require JoinIR Dev)
#!/bin/bash
source "$(dirname "$0")/../lib/test_runner.sh"
source "$(dirname "$0")/../lib/llvm_exe_runner.sh"
require_env || exit 2
# Enable JoinIR dev mode (required for Phase 131+)
require_joinir_dev
# Your test code here
Common Variables (Auto-Set by env.sh)
NYASH_JOINIR_DEV=1 # JoinIR dev features
HAKO_JOINIR_STRICT=1 # Strict validation
NYASH_LLVM_USE_HARNESS=1 # Python llvmlite backend
NYASH_FEATURES=stage3 # Stage 3 parser
NYASH_ENABLE_USING=1 # Using system enabled
Override Variables
To override defaults, set BEFORE sourcing:
export NYASH_CLI_VERBOSE=1 # Enable verbose mode
export NYASH_DEBUG_FUEL=unlimited # Unlimited debug fuel
source "$(dirname "$0")/../lib/test_runner.sh"
Mode Presets
source "$(dirname "$0")/../lib/env.sh"
setup_smoke_env dev # Verbose, unlimited fuel
setup_smoke_env integration # Moderate settings
setup_smoke_env quick # Fast, minimal logging
Debugging
# Show current configuration
source "$(dirname "$0")/../lib/env.sh"
show_smoke_env
# Validate configuration
source "$(dirname "$0")/../lib/env.sh"
validate_env_setup
Full Documentation
See tools/smokes/v2/lib/ENV_README.md for complete reference.