继续把 interp_execute.cc、interp_queue.cc、interp_find.cc 等 LinuxCNC 源文件纳入直接编译/链接路径,逐步删除临时 convert_g() wrapper 行为
结论:已将核心 LinuxCNC interpreter 源接入 standalone native 编译链接路径,移除 minimal runtime 中的手写 convert_g 行为,并通过 native probe 验证。
This commit is contained in:
113
wasm-port/tests/native/verify_native_probes.sh
Executable file
113
wasm-port/tests/native/verify_native_probes.sh
Executable file
@@ -0,0 +1,113 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
BUILD_DIR="$ROOT_DIR/build/native"
|
||||
GCODE_FIXTURE_DIR="$ROOT_DIR/tests/fixtures/gcode"
|
||||
CANON_FIXTURE_DIR="$ROOT_DIR/tests/fixtures/canon"
|
||||
GCODE_ERROR_FIXTURE_DIR="$ROOT_DIR/tests/fixtures/gcode_errors"
|
||||
CANON_ERROR_FIXTURE_DIR="$ROOT_DIR/tests/fixtures/canon_errors"
|
||||
|
||||
"$ROOT_DIR/tools/build_native_probes.sh"
|
||||
|
||||
check_exitcode() {
|
||||
local name="$1"
|
||||
local file="$BUILD_DIR/$name.exitcode"
|
||||
|
||||
if [[ ! -f "$file" ]]; then
|
||||
echo "missing exitcode: $file" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local rc
|
||||
rc="$(tr -d '[:space:]' < "$file")"
|
||||
if [[ "$rc" != "0" ]]; then
|
||||
echo "$name failed with exit code $rc" >&2
|
||||
if [[ -f "$BUILD_DIR/$name.stderr.log" ]]; then
|
||||
sed -n '1,160p' "$BUILD_DIR/$name.stderr.log" >&2
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_exitcode linuxcnc_interp_state_probe
|
||||
check_exitcode linuxcnc_namedparam_harness
|
||||
check_exitcode linuxcnc_interp_minimal_harness
|
||||
check_exitcode linuxcnc_interp_minimal_harness.run
|
||||
check_exitcode linuxcnc_rs274_compile_probe
|
||||
check_exitcode linuxcnc_interp_convert_source_probe
|
||||
|
||||
check_fixture_output() {
|
||||
local fixture="$1"
|
||||
local expected="$2"
|
||||
local stdout_file="$3"
|
||||
|
||||
grep -Fq "read=0" "$stdout_file"
|
||||
grep -Fq "parse_line=0" "$stdout_file"
|
||||
|
||||
local line_count
|
||||
line_count="$(grep -cv '^[[:space:]]*$' "$fixture")"
|
||||
local line_number
|
||||
for ((line_number = 1; line_number <= line_count; line_number += 1)); do
|
||||
grep -Fq "execute_line_${line_number}=0" "$stdout_file"
|
||||
done
|
||||
|
||||
while IFS= read -r expected_event; do
|
||||
[[ -z "$expected_event" ]] && continue
|
||||
grep -Fq "$expected_event" "$stdout_file"
|
||||
done < "$expected"
|
||||
}
|
||||
|
||||
RUN_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.run.stdout.log"
|
||||
check_fixture_output \
|
||||
"$GCODE_FIXTURE_DIR/minimal_linear.ngc" \
|
||||
"$CANON_FIXTURE_DIR/minimal_linear.events" \
|
||||
"$RUN_STDOUT"
|
||||
|
||||
for fixture in "$GCODE_FIXTURE_DIR"/*.ngc; do
|
||||
name="$(basename "$fixture" .ngc)"
|
||||
expected="$CANON_FIXTURE_DIR/$name.events"
|
||||
if [[ ! -f "$expected" ]]; then
|
||||
echo "missing expected canon fixture: $expected" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
stdout_file="$BUILD_DIR/linuxcnc_interp_minimal_harness.$name.stdout.log"
|
||||
stderr_file="$BUILD_DIR/linuxcnc_interp_minimal_harness.$name.stderr.log"
|
||||
"$BUILD_DIR/linuxcnc_interp_minimal_harness" "$fixture" \
|
||||
>"$stdout_file" \
|
||||
2>"$stderr_file"
|
||||
check_fixture_output "$fixture" "$expected" "$stdout_file"
|
||||
done
|
||||
|
||||
for fixture in "$GCODE_ERROR_FIXTURE_DIR"/*.ngc; do
|
||||
name="$(basename "$fixture" .ngc)"
|
||||
expected="$CANON_ERROR_FIXTURE_DIR/$name.expected"
|
||||
if [[ ! -f "$expected" ]]; then
|
||||
echo "missing expected error fixture: $expected" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
stdout_file="$BUILD_DIR/linuxcnc_interp_minimal_harness.$name.stdout.log"
|
||||
stderr_file="$BUILD_DIR/linuxcnc_interp_minimal_harness.$name.stderr.log"
|
||||
"$BUILD_DIR/linuxcnc_interp_minimal_harness" "$fixture" \
|
||||
>"$stdout_file" \
|
||||
2>"$stderr_file"
|
||||
|
||||
while IFS= read -r expected_line; do
|
||||
[[ -z "$expected_line" ]] && continue
|
||||
if [[ "$expected_line" == absent=* ]]; then
|
||||
forbidden="${expected_line#absent=}"
|
||||
if grep -Fq "$forbidden" "$stdout_file"; then
|
||||
echo "unexpected output in $stdout_file: $forbidden" >&2
|
||||
exit 1
|
||||
fi
|
||||
elif [[ "$expected_line" == error_text=* ]]; then
|
||||
grep -Fq "${expected_line#error_text=}" "$stderr_file"
|
||||
else
|
||||
grep -Fq "$expected_line" "$stdout_file"
|
||||
fi
|
||||
done < "$expected"
|
||||
done
|
||||
|
||||
echo "native probe validation complete"
|
||||
Reference in New Issue
Block a user