wasm-port: broaden native LinuxCNC interpreter probes
This commit is contained in:
13
wasm-port/tests/fixtures/canon/arc_semantics.events
vendored
Normal file
13
wasm-port/tests/fixtures/canon/arc_semantics.events
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
canon_event=STRAIGHT_TRAVERSE line=1 x=0 y=0 z=0 a=0 b=0 c=0 u=0 v=0 w=0
|
||||
canon_event=COMMENT: interpreter: IJK distance mode changed to incremental
|
||||
canon_event=SET_FEED_RATE rate=60
|
||||
canon_event=ARC_FEED line=3 first_end=1 second_end=1 first_axis=1 second_axis=0 rotation=-1 axis_end_point=0 a=0 b=0 c=0 u=0 v=0 w=0
|
||||
canon_event=COMMENT: interpreter: IJK distance mode changed to absolute
|
||||
canon_event=ARC_FEED line=5 first_end=0 second_end=0 first_axis=0 second_axis=1 rotation=1 axis_end_point=0 a=0 b=0 c=0 u=0 v=0 w=0
|
||||
canon_event=ARC_FEED line=6 first_end=1 second_end=0 first_axis=0.5 second_axis=-3.06162e-17 rotation=-1 axis_end_point=0 a=0 b=0 c=0 u=0 v=0 w=0
|
||||
canon_event=STRAIGHT_TRAVERSE line=7 x=0 y=0 z=0 a=0 b=0 c=0 u=0 v=0 w=0
|
||||
canon_event=ARC_FEED line=9 first_end=1 second_end=1 first_axis=0 second_axis=1 rotation=-1 axis_end_point=0 a=0 b=0 c=0 u=0 v=0 w=0
|
||||
canon_event=STRAIGHT_TRAVERSE line=10 x=0 y=0 z=0 a=0 b=0 c=0 u=0 v=0 w=0
|
||||
canon_event=ARC_FEED line=11 first_end=1 second_end=1 first_axis=0 second_axis=1 rotation=1 axis_end_point=0 a=0 b=0 c=0 u=0 v=0 w=0
|
||||
canon_event=STRAIGHT_TRAVERSE line=12 x=0 y=0 z=0 a=0 b=0 c=0 u=0 v=0 w=0
|
||||
canon_event=ARC_FEED line=13 first_end=1 second_end=0 first_axis=0.5 second_axis=0.866025 rotation=-1 axis_end_point=2 a=0 b=0 c=0 u=0 v=0 w=0
|
||||
11
wasm-port/tests/fixtures/canon/canon_runtime_edges.events
vendored
Normal file
11
wasm-port/tests/fixtures/canon/canon_runtime_edges.events
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
canon_event=SET_SPINDLE_SPEED spindle=0 speed=1200
|
||||
canon_event=START_SPINDLE_CLOCKWISE spindle=0 wait_for_at_speed=1
|
||||
canon_event=STOP_SPINDLE_TURNING spindle=0
|
||||
canon_event=SET_SPINDLE_SPEED spindle=0 speed=900
|
||||
canon_event=START_SPINDLE_COUNTERCLOCKWISE spindle=0 wait_for_at_speed=1
|
||||
canon_event=STOP_SPINDLE_TURNING spindle=0
|
||||
canon_event=MIST_ON
|
||||
canon_event=FLOOD_ON
|
||||
canon_event=MIST_OFF
|
||||
canon_event=FLOOD_OFF
|
||||
canon_event=DWELL seconds=0.25
|
||||
7
wasm-port/tests/fixtures/canon/namedparam_semantics.events
vendored
Normal file
7
wasm-port/tests/fixtures/canon/namedparam_semantics.events
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
canon_event=MESSAGE: named global=42.5000
|
||||
canon_event=MESSAGE: named local=7.2500
|
||||
canon_event=MESSAGE: exists global=1 local=1 missing=0
|
||||
canon_event=MESSAGE: ini velocity=35
|
||||
canon_event=MESSAGE: hal pin=1 signal=98.2500 param=-17
|
||||
canon_event=MESSAGE: hal u32=123456789 s64=-9000000000 u64=9000000000
|
||||
canon_event=MESSAGE: hal disconnected=12.5000 missing_exists=0
|
||||
3
wasm-port/tests/fixtures/canon/numbered_params.events
vendored
Normal file
3
wasm-port/tests/fixtures/canon/numbered_params.events
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
canon_event=MESSAGE: numbered p1=12.5000 p2=15.5000 exists1=1 exists5602=0
|
||||
canon_event=STRAIGHT_TRAVERSE line=6 x=2 y=3 z=4 a=0 b=0 c=0 u=0 v=0 w=0
|
||||
canon_event=MESSAGE: numbered pos x=2.0000 y=3.0000 z=4.0000
|
||||
3
wasm-port/tests/fixtures/canon/oword_subroutine.events
vendored
Normal file
3
wasm-port/tests/fixtures/canon/oword_subroutine.events
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
STRAIGHT_TRAVERSE line=4 x=0 y=0 z=0
|
||||
SET_FEED_RATE rate=100
|
||||
STRAIGHT_FEED line=2 x=2 y=3 z=0
|
||||
11
wasm-port/tests/fixtures/canon/tool_semantics.events
vendored
Normal file
11
wasm-port/tests/fixtures/canon/tool_semantics.events
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
canon_event=SELECT_TOOL tool=2
|
||||
canon_event=MESSAGE: tool selected=2 selected_pocket=2
|
||||
canon_event=STOP_SPINDLE_TURNING spindle=0
|
||||
canon_event=CHANGE_TOOL
|
||||
canon_event=MESSAGE: tool after_m6 current_pocket=2 current_tool=2
|
||||
canon_event=USE_TOOL_LENGTH_OFFSET x=0 y=0 z=1.25 a=0 b=0 c=0 u=0 v=0 w=0
|
||||
canon_event=MESSAGE: tool g43 offset=1 x=0.0000 y=0.0000 z=1.2500
|
||||
canon_event=USE_TOOL_LENGTH_OFFSET x=0 y=0 z=0 a=0 b=0 c=0 u=0 v=0 w=0
|
||||
canon_event=MESSAGE: tool g49 offset=0 x=0.0000 y=0.0000 z=0.0000
|
||||
canon_event=CHANGE_TOOL_NUMBER pocket=0
|
||||
canon_event=MESSAGE: tool after_m61 current_pocket=0 current_tool=2
|
||||
4
wasm-port/tests/fixtures/canon_errors/arc_radius_mismatch.expected
vendored
Normal file
4
wasm-port/tests/fixtures/canon_errors/arc_radius_mismatch.expected
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
execute_line_1=0
|
||||
execute_line_2=5
|
||||
error_text=Radius to end of arc differs from radius to start
|
||||
absent=canon_event=ARC_FEED
|
||||
4
wasm-port/tests/fixtures/canon_errors/arc_zero_radius.expected
vendored
Normal file
4
wasm-port/tests/fixtures/canon_errors/arc_zero_radius.expected
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
execute_line_1=0
|
||||
execute_line_2=5
|
||||
error_text=Zero-radius arc
|
||||
absent=canon_event=ARC_FEED
|
||||
2
wasm-port/tests/fixtures/canon_errors/namedparam_readonly.expected
vendored
Normal file
2
wasm-port/tests/fixtures/canon_errors/namedparam_readonly.expected
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
execute_line_1=5
|
||||
error_text=Cannot assign to read-only parameter #<_feed>
|
||||
2
wasm-port/tests/fixtures/canon_errors/numbered_param_readonly.expected
vendored
Normal file
2
wasm-port/tests/fixtures/canon_errors/numbered_param_readonly.expected
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
execute_line_1=5
|
||||
error_text=Parameter is readonly
|
||||
3
wasm-port/tests/fixtures/canon_errors/tool_length_offset_not_found.expected
vendored
Normal file
3
wasm-port/tests/fixtures/canon_errors/tool_length_offset_not_found.expected
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
execute_line_1=5
|
||||
error_text=Requested tool 999 not found in the tool table
|
||||
absent=canon_event=USE_TOOL_LENGTH_OFFSET
|
||||
2
wasm-port/tests/fixtures/canon_errors/tool_not_found.expected
vendored
Normal file
2
wasm-port/tests/fixtures/canon_errors/tool_not_found.expected
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
execute_line_1=5
|
||||
error_text=Requested tool 999 not found in the tool table
|
||||
13
wasm-port/tests/fixtures/gcode/arc_semantics.ngc
vendored
Normal file
13
wasm-port/tests/fixtures/gcode/arc_semantics.ngc
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
G90 G17 G0 X0 Y0 Z0
|
||||
G91.1
|
||||
G2 X1 Y1 I1 J0 F60
|
||||
G90.1
|
||||
G3 X0 Y0 I0 J1
|
||||
G2 X1 Y0 R0.5
|
||||
G18 G0 X0 Y0 Z0
|
||||
G91.1
|
||||
G2 X1 Z1 I1 K0
|
||||
G19 G0 X0 Y0 Z0
|
||||
G3 Y1 Z1 J0 K1
|
||||
G17 G0 X0 Y0 Z0
|
||||
G2 X1 Y0 Z2 R-1
|
||||
8
wasm-port/tests/fixtures/gcode/canon_runtime_edges.ngc
vendored
Normal file
8
wasm-port/tests/fixtures/gcode/canon_runtime_edges.ngc
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
S1200 M3
|
||||
M5
|
||||
S900 M4
|
||||
M5
|
||||
M7
|
||||
M8
|
||||
M9
|
||||
G4 P0.25
|
||||
21
wasm-port/tests/fixtures/gcode/namedparam_semantics.ngc
vendored
Normal file
21
wasm-port/tests/fixtures/gcode/namedparam_semantics.ngc
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
#<_global_probe> = 42.5
|
||||
#<local_probe> = 7.25
|
||||
#<exists_global> = EXISTS[#<_global_probe>]
|
||||
#<exists_local> = EXISTS[#<local_probe>]
|
||||
#<exists_missing> = EXISTS[#<missing_probe>]
|
||||
#<ini_velocity> = #<_ini[traj]max_linear_velocity>
|
||||
#<hal_pin> = #<_hal[standalone.pin-bit]>
|
||||
#<hal_signal> = #<_hal[standalone.signal-float]>
|
||||
#<hal_param> = #<_hal[standalone.param-s32]>
|
||||
#<hal_u32> = #<_hal[standalone.pin-u32]>
|
||||
#<hal_s64> = #<_hal[standalone.signal-s64]>
|
||||
#<hal_u64> = #<_hal[standalone.param-u64]>
|
||||
#<hal_disconnected> = #<_hal[standalone.disconnected-float]>
|
||||
#<hal_missing_exists> = EXISTS[#<_hal[standalone.missing]>]
|
||||
(DEBUG, named global=%f#<_global_probe>)
|
||||
(DEBUG, named local=%f#<local_probe>)
|
||||
(DEBUG, exists global=%d#<exists_global> local=%d#<exists_local> missing=%d#<exists_missing>)
|
||||
(DEBUG, ini velocity=%d#<ini_velocity>)
|
||||
(DEBUG, hal pin=%d#<hal_pin> signal=%f#<hal_signal> param=%d#<hal_param>)
|
||||
(DEBUG, hal u32=%d#<hal_u32> s64=%.0f#<hal_s64> u64=%.0f#<hal_u64>)
|
||||
(DEBUG, hal disconnected=%f#<hal_disconnected> missing_exists=%d#<hal_missing_exists>)
|
||||
7
wasm-port/tests/fixtures/gcode/numbered_params.ngc
vendored
Normal file
7
wasm-port/tests/fixtures/gcode/numbered_params.ngc
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
#1 = 12.5
|
||||
#2 = [#1 + 3]
|
||||
#3 = EXISTS[#1]
|
||||
#4 = EXISTS[#5602]
|
||||
(DEBUG, numbered p1=%f#1 p2=%f#2 exists1=%d#3 exists5602=%d#4)
|
||||
G90 G0 X2 Y3 Z4
|
||||
(DEBUG, numbered pos x=%f#5420 y=%f#5421 z=%f#5422)
|
||||
5
wasm-port/tests/fixtures/gcode/oword_subroutine.ngc
vendored
Normal file
5
wasm-port/tests/fixtures/gcode/oword_subroutine.ngc
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
O<move> sub
|
||||
G1 X#1 Y#2 F100
|
||||
O<move> endsub
|
||||
G0 X0 Y0
|
||||
O<move> call [2] [3]
|
||||
10
wasm-port/tests/fixtures/gcode/tool_semantics.ngc
vendored
Normal file
10
wasm-port/tests/fixtures/gcode/tool_semantics.ngc
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
T2
|
||||
(DEBUG, tool selected=%d#<_selected_tool> selected_pocket=%d#<_selected_pocket>)
|
||||
M6
|
||||
(DEBUG, tool after_m6 current_pocket=%d#<_current_pocket> current_tool=%d#<_current_tool>)
|
||||
G43 H2
|
||||
(DEBUG, tool g43 offset=%d#<_tool_offset> x=%f#5401 y=%f#5402 z=%f#5403)
|
||||
G49
|
||||
(DEBUG, tool g49 offset=%d#<_tool_offset> x=%f#5401 y=%f#5402 z=%f#5403)
|
||||
M61 Q2
|
||||
(DEBUG, tool after_m61 current_pocket=%d#<_current_pocket> current_tool=%d#<_current_tool>)
|
||||
2
wasm-port/tests/fixtures/gcode_errors/arc_radius_mismatch.ngc
vendored
Normal file
2
wasm-port/tests/fixtures/gcode_errors/arc_radius_mismatch.ngc
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
G90 G17 G0 X0 Y0
|
||||
G2 X1 Y1 I0.2 J0 F60
|
||||
2
wasm-port/tests/fixtures/gcode_errors/arc_zero_radius.ngc
vendored
Normal file
2
wasm-port/tests/fixtures/gcode_errors/arc_zero_radius.ngc
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
G90 G17 G0 X0 Y0
|
||||
G2 X1 Y0 I0 J0 F60
|
||||
1
wasm-port/tests/fixtures/gcode_errors/namedparam_readonly.ngc
vendored
Normal file
1
wasm-port/tests/fixtures/gcode_errors/namedparam_readonly.ngc
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#<_feed> = 1
|
||||
1
wasm-port/tests/fixtures/gcode_errors/numbered_param_readonly.ngc
vendored
Normal file
1
wasm-port/tests/fixtures/gcode_errors/numbered_param_readonly.ngc
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#5400 = 1
|
||||
1
wasm-port/tests/fixtures/gcode_errors/tool_length_offset_not_found.ngc
vendored
Normal file
1
wasm-port/tests/fixtures/gcode_errors/tool_length_offset_not_found.ngc
vendored
Normal file
@@ -0,0 +1 @@
|
||||
G43 H999
|
||||
1
wasm-port/tests/fixtures/gcode_errors/tool_not_found.ngc
vendored
Normal file
1
wasm-port/tests/fixtures/gcode_errors/tool_not_found.ngc
vendored
Normal file
@@ -0,0 +1 @@
|
||||
T999
|
||||
3
wasm-port/tests/fixtures/ini/namedparams.ini
vendored
Normal file
3
wasm-port/tests/fixtures/ini/namedparams.ini
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[TRAJ]
|
||||
LINEAR_UNITS = mm
|
||||
MAX_LINEAR_VELOCITY = 35
|
||||
@@ -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