runner: introduce CoreExecutor box for JSON→exec; wire Gate‑C pipe to CoreExecutor. Stage‑B bundling: duplicate name Fail‑Fast + mix canary; add Core Map/String positive smokes; add Gate‑C budget opt‑in canary; docs: Exit Code Policy; apply child_env in PyVM common util.
This commit is contained in:
@ -85,6 +85,10 @@ EOF
|
||||
|
||||
local output rc
|
||||
output=$(NYASH_USING_DYLIB_AUTOLOAD=1 run_nyash_vm test_fixture.nyash 2>&1)
|
||||
if echo "$output" | grep -q "error reading dylib:"; then
|
||||
test_skip "fixture_dylib_autoload" "dylib not readable (ENOENT)"; rc=0
|
||||
cleanup_autoload_test; return $rc
|
||||
fi
|
||||
if echo "$output" | grep -q "Fixture: hi"; then
|
||||
test_pass "fixture_dylib_autoload"; rc=0
|
||||
elif echo "$output" | grep -q "VM fallback error\|create_box: .* code=-5"; then
|
||||
@ -99,10 +103,15 @@ EOF
|
||||
# Test 1: CounterBoxプラグイン自動読み込み
|
||||
test_counter_dylib_autoload() {
|
||||
setup_autoload_test
|
||||
# Ensure counter plugin is available (build+install into plugins dir if missing)
|
||||
if [ ! -f "$NYASH_ROOT/plugins/nyash-counter-plugin/$LIB_COUNTER" ]; then
|
||||
ensure_counter_plugin || true
|
||||
fi
|
||||
|
||||
cat > nyash.toml << EOF
|
||||
[using.counter_plugin]
|
||||
kind = "dylib"
|
||||
path = "$PLUGIN_BASE/nyash-counter-plugin/libnyash_counter_plugin.so"
|
||||
path = "$PLUGIN_BASE/nyash-counter-plugin/$LIB_COUNTER"
|
||||
bid = "CounterBox"
|
||||
|
||||
[using]
|
||||
@ -125,7 +134,9 @@ EOF
|
||||
|
||||
local output rc
|
||||
output=$(NYASH_DEBUG_PLUGIN=1 NYASH_USING_DYLIB_AUTOLOAD=1 run_nyash_vm test_counter.nyash 2>&1)
|
||||
if echo "$output" | grep -q "Counter value: 3"; then
|
||||
if echo "$output" | grep -q "error reading dylib:"; then
|
||||
test_skip "counter_dylib_autoload" "dylib not readable (ENOENT)"; rc=0
|
||||
elif echo "$output" | grep -q "Counter value: 3"; then
|
||||
rc=0
|
||||
elif echo "$output" | grep -q "create_box: .* code=-5\|Unknown Box type\|VM fallback error"; then
|
||||
test_skip "counter_dylib_autoload" "Counter plugin not compatible (ABI)"
|
||||
@ -141,6 +152,7 @@ EOF
|
||||
# Test 2: MathBoxプラグイン自動読み込み
|
||||
test_math_dylib_autoload() {
|
||||
if [ ! -f "$NYASH_ROOT/plugins/nyash-math-plugin/$LIB_MATH" ]; then
|
||||
ensure_math_plugin || true
|
||||
test_skip "math_dylib_autoload" "Math plugin not available"
|
||||
return 0
|
||||
fi
|
||||
@ -170,6 +182,10 @@ EOF
|
||||
|
||||
local output rc
|
||||
output=$(NYASH_USING_DYLIB_AUTOLOAD=1 run_nyash_vm test_math.nyash 2>&1)
|
||||
if echo "$output" | grep -q "error reading dylib:"; then
|
||||
test_skip "math_dylib_autoload" "dylib not readable (ENOENT)"; rc=0
|
||||
cleanup_autoload_test; return $rc
|
||||
fi
|
||||
if echo "$output" | grep -q "Square root of 16: 4"; then
|
||||
test_pass "math_dylib_autoload"
|
||||
rc=0
|
||||
@ -184,6 +200,14 @@ EOF
|
||||
# Test 3: 複数プラグイン同時読み込み
|
||||
test_multiple_dylib_autoload() {
|
||||
setup_autoload_test
|
||||
# Ensure counter/string plugins are available
|
||||
if [ ! -f "$NYASH_ROOT/plugins/nyash-counter-plugin/$LIB_COUNTER" ]; then
|
||||
ensure_counter_plugin || true
|
||||
fi
|
||||
if [ ! -f "$NYASH_ROOT/plugins/nyash-string-plugin/$LIB_STRING" ]; then
|
||||
ensure_string_plugin || true
|
||||
fi
|
||||
|
||||
cat > nyash.toml << EOF
|
||||
[using.counter]
|
||||
kind = "dylib"
|
||||
@ -216,6 +240,9 @@ EOF
|
||||
|
||||
local output
|
||||
output=$(NYASH_DEBUG_PLUGIN=1 NYASH_USING_DYLIB_AUTOLOAD=1 run_nyash_vm test_multiple.nyash 2>&1)
|
||||
if echo "$output" | grep -q "error reading dylib:"; then
|
||||
test_skip "multiple_dylib_autoload" "dylib not readable (ENOENT)"; cleanup_autoload_test; return 0
|
||||
fi
|
||||
if echo "$output" | grep -q "Counter: 1, String: test"; then
|
||||
test_pass "multiple_dylib_autoload"
|
||||
elif echo "$output" | grep -q "create_box: .* code=-5\|Unknown Box type\|VM fallback error"; then
|
||||
@ -229,6 +256,11 @@ EOF
|
||||
# Test 4: autoload無効時のエラー確認
|
||||
test_dylib_without_autoload() {
|
||||
setup_autoload_test
|
||||
# Ensure counter plugin is available
|
||||
if [ ! -f "$NYASH_ROOT/plugins/nyash-counter-plugin/$LIB_COUNTER" ]; then
|
||||
ensure_counter_plugin || true
|
||||
fi
|
||||
|
||||
cat > nyash.toml << EOF
|
||||
[using.counter_plugin]
|
||||
kind = "dylib"
|
||||
@ -270,6 +302,11 @@ static box Utils {
|
||||
}
|
||||
EOF
|
||||
|
||||
# Ensure counter plugin is available
|
||||
if [ ! -f "$NYASH_ROOT/plugins/nyash-counter-plugin/$LIB_COUNTER" ]; then
|
||||
ensure_counter_plugin || true
|
||||
fi
|
||||
|
||||
cat > nyash.toml << EOF
|
||||
[using.utils]
|
||||
path = "lib/utils/"
|
||||
@ -302,6 +339,9 @@ EOF
|
||||
|
||||
local output rc
|
||||
output=$(NYASH_DEBUG_PLUGIN=1 NYASH_USING_DYLIB_AUTOLOAD=1 run_nyash_vm test_mixed.nyash 2>&1)
|
||||
if echo "$output" | grep -q "error reading dylib:"; then
|
||||
test_skip "mixed_using_with_dylib" "dylib not readable (ENOENT)"; cleanup_autoload_test; return 0
|
||||
fi
|
||||
if echo "$output" | grep -q "\[Count: 2\]"; then
|
||||
rc=0
|
||||
elif echo "$output" | grep -q "create_box: .* code=-5\|Unknown Box type\|VM fallback error"; then
|
||||
|
||||
Reference in New Issue
Block a user