wasm-port: broaden native LinuxCNC interpreter probes
This commit is contained in:
@@ -7,6 +7,7 @@ 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"
|
||||
NAMEDPARAM_INI_FIXTURE="$ROOT_DIR/tests/fixtures/ini/namedparams.ini"
|
||||
|
||||
"$ROOT_DIR/tools/build_native_probes.sh"
|
||||
|
||||
@@ -32,25 +33,56 @@ check_exitcode() {
|
||||
|
||||
check_exitcode linuxcnc_interp_state_probe
|
||||
check_exitcode linuxcnc_namedparam_harness
|
||||
check_exitcode linuxcnc_namedparam_harness.run
|
||||
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
|
||||
|
||||
NAMEDPARAM_STDOUT="$BUILD_DIR/linuxcnc_namedparam_harness.run.stdout.log"
|
||||
grep -Fq "init_named_parameters=0" "$NAMEDPARAM_STDOUT"
|
||||
grep -Fq "global_named_count=57" "$NAMEDPARAM_STDOUT"
|
||||
grep -Fq "_metric_machine: rc=0 found=1 value=1" "$NAMEDPARAM_STDOUT"
|
||||
grep -Fq "_motion_mode: rc=0 found=1 value=10" "$NAMEDPARAM_STDOUT"
|
||||
grep -Fq "_metric: rc=0 found=1 value=1" "$NAMEDPARAM_STDOUT"
|
||||
grep -Fq "_feed: rc=0 found=1 value=123.45" "$NAMEDPARAM_STDOUT"
|
||||
grep -Fq "_rpm: rc=0 found=1 value=678.9" "$NAMEDPARAM_STDOUT"
|
||||
grep -Fq "_x: rc=0 found=1 value=1.25" "$NAMEDPARAM_STDOUT"
|
||||
grep -Fq "_current_tool: rc=0 found=1 value=12" "$NAMEDPARAM_STDOUT"
|
||||
grep -Fq "_ini[traj]max_linear_velocity: rc=0 found=1 value=35" "$NAMEDPARAM_STDOUT"
|
||||
grep -Fq "_hal[standalone.pin-bit]: rc=0 found=1 value=1" "$NAMEDPARAM_STDOUT"
|
||||
grep -Fq "_hal[standalone.signal-float]: rc=0 found=1 value=98.25" "$NAMEDPARAM_STDOUT"
|
||||
grep -Fq "_hal[standalone.param-s32]: rc=0 found=1 value=-17" "$NAMEDPARAM_STDOUT"
|
||||
grep -Fq "_hal[standalone.pin-u32]: rc=0 found=1 value=1.23457e+08" "$NAMEDPARAM_STDOUT"
|
||||
grep -Fq "_hal[standalone.signal-s64]: rc=0 found=1 value=-9e+09" "$NAMEDPARAM_STDOUT"
|
||||
grep -Fq "_hal[standalone.param-u64]: rc=0 found=1 value=9e+09" "$NAMEDPARAM_STDOUT"
|
||||
grep -Fq "_hal[standalone.disconnected-float]: rc=0 found=1 value=12.5" "$NAMEDPARAM_STDOUT"
|
||||
grep -Fq "_hal[standalone.missing]: rc=0 found=0 value=0" "$NAMEDPARAM_STDOUT"
|
||||
|
||||
check_fixture_output() {
|
||||
local fixture="$1"
|
||||
local expected="$2"
|
||||
local stdout_file="$3"
|
||||
local require_mdi="${4:-1}"
|
||||
|
||||
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
|
||||
if [[ "$require_mdi" == "1" ]]; then
|
||||
local line_count
|
||||
line_count="$(grep -cv '^[[:space:]]*$' "$fixture")"
|
||||
local line_number
|
||||
for ((line_number = 1; line_number <= line_count; line_number += 1)); do
|
||||
if ! grep -Fq "execute_line_${line_number}=0" "$stdout_file" &&
|
||||
! grep -Fq "execute_line_${line_number}=2" "$stdout_file"; then
|
||||
echo "missing successful execute status for line $line_number in $stdout_file" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
else
|
||||
grep -Fq "file_open=0" "$stdout_file"
|
||||
grep -Fq "file_execute_1=0" "$stdout_file"
|
||||
fi
|
||||
|
||||
while IFS= read -r expected_event; do
|
||||
[[ -z "$expected_event" ]] && continue
|
||||
@@ -74,10 +106,14 @@ for fixture in "$GCODE_FIXTURE_DIR"/*.ngc; do
|
||||
|
||||
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" \
|
||||
INI_FILE_NAME="$NAMEDPARAM_INI_FIXTURE" "$BUILD_DIR/linuxcnc_interp_minimal_harness" "$fixture" \
|
||||
>"$stdout_file" \
|
||||
2>"$stderr_file"
|
||||
check_fixture_output "$fixture" "$expected" "$stdout_file"
|
||||
require_mdi=1
|
||||
if [[ "$name" == "oword_subroutine" ]]; then
|
||||
require_mdi=0
|
||||
fi
|
||||
check_fixture_output "$fixture" "$expected" "$stdout_file" "$require_mdi"
|
||||
done
|
||||
|
||||
for fixture in "$GCODE_ERROR_FIXTURE_DIR"/*.ngc; do
|
||||
@@ -90,7 +126,7 @@ for fixture in "$GCODE_ERROR_FIXTURE_DIR"/*.ngc; do
|
||||
|
||||
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" \
|
||||
INI_FILE_NAME="$NAMEDPARAM_INI_FIXTURE" "$BUILD_DIR/linuxcnc_interp_minimal_harness" "$fixture" \
|
||||
>"$stdout_file" \
|
||||
2>"$stderr_file"
|
||||
|
||||
@@ -103,7 +139,7 @@ for fixture in "$GCODE_ERROR_FIXTURE_DIR"/*.ngc; do
|
||||
exit 1
|
||||
fi
|
||||
elif [[ "$expected_line" == error_text=* ]]; then
|
||||
grep -Fq "${expected_line#error_text=}" "$stderr_file"
|
||||
grep -Fq "$expected_line" "$stdout_file"
|
||||
else
|
||||
grep -Fq "$expected_line" "$stdout_file"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user