按规划持续工作

This commit is contained in:
2026-06-09 06:13:28 +08:00
parent 902c6ecaea
commit 2658ee3b72
255 changed files with 12487 additions and 150 deletions

View File

@@ -8,12 +8,59 @@ 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"
SPINDLE_ORIENT_OFFSET_INI_FIXTURE="$ROOT_DIR/tests/fixtures/ini/spindle_orient_offset.ini"
DISABLE_FANUC_STYLE_SUB_INI_FIXTURE="$ROOT_DIR/tests/fixtures/ini/disable_fanuc_style_sub.ini"
VALIDATION_CACHE_KEY_FILE="$BUILD_DIR/native-probe-validation.input.sha256"
VALIDATION_CACHE_OK_FILE="$BUILD_DIR/native-probe-validation.ok"
"$ROOT_DIR/tools/verify_upstream_baseline.sh"
"$ROOT_DIR/tools/verify_vendor_sync.sh"
"$ROOT_DIR/tools/verify_no_standalone_cnc_semantics.sh"
"$ROOT_DIR/tools/verify_native_linuxcnc_fixture_baseline.sh"
"$ROOT_DIR/tools/build_native_probes.sh"
"$ROOT_DIR/tests/native/verify_sim_configs.sh"
"$ROOT_DIR/tests/native/verify_nc_files.sh"
hash_tree() {
find "$@" -type f -print0 | sort -z | xargs -0 -r sha256sum
}
hash_build_validation_inputs() {
find "$BUILD_DIR" -maxdepth 1 -type f \
\( \
-name '*.exitcode' \
-o -name '*.run.stdout.log' \
-o -name '*.run.stderr.log' \
-o -name 'source-probes.tsv' \
-o -name 'native-probes.ok' \
-o -name 'linuxcnc_interp_minimal_harness' \
\) \
! -name 'native-probe-validation.*' \
-print0 | sort -z | xargs -0 -r sha256sum
}
native_probe_validation_fingerprint() {
{
sha256sum \
"$ROOT_DIR/tests/native/verify_native_probes.sh" \
"$ROOT_DIR/tools/source-manifest.txt"
hash_tree \
"$GCODE_FIXTURE_DIR" \
"$CANON_FIXTURE_DIR" \
"$GCODE_ERROR_FIXTURE_DIR" \
"$CANON_ERROR_FIXTURE_DIR" \
"$ROOT_DIR/tests/fixtures/ini"
hash_build_validation_inputs
} | sha256sum | awk '{ print $1 }'
}
NATIVE_PROBE_VALIDATION_FINGERPRINT="$(native_probe_validation_fingerprint)"
if [[ -f "$VALIDATION_CACHE_KEY_FILE" && -f "$VALIDATION_CACHE_OK_FILE" ]] &&
[[ "$(tr -d '[:space:]' < "$VALIDATION_CACHE_KEY_FILE")" == "$NATIVE_PROBE_VALIDATION_FINGERPRINT" ]] &&
[[ "$(tr -d '[:space:]' < "$VALIDATION_CACHE_OK_FILE")" == "$NATIVE_PROBE_VALIDATION_FINGERPRINT" ]]; then
echo "native probe validation up to date"
exit 0
fi
check_source_probe_coverage() {
local manifest_sources="$BUILD_DIR/source-manifest-sources.sorted"
@@ -155,6 +202,40 @@ 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_interp_minimal_harness.do_while_break.run
check_exitcode linuxcnc_interp_minimal_harness.oword_bug315.run
check_exitcode linuxcnc_interp_minimal_harness.oword_bug315_p2.run
check_exitcode linuxcnc_interp_minimal_harness.interp_exists.run
check_exitcode linuxcnc_interp_minimal_harness.return_value.run
check_exitcode linuxcnc_interp_minimal_harness.subs_follow_main.run
check_exitcode linuxcnc_interp_minimal_harness.fractional_linenumbers.run
check_exitcode linuxcnc_interp_minimal_harness.namedparam_bug424.run
check_exitcode linuxcnc_interp_minimal_harness.g6164.run
check_exitcode linuxcnc_interp_minimal_harness.rotation_abs_pts.run
check_exitcode linuxcnc_interp_minimal_harness.rotation_g28.run
check_exitcode linuxcnc_interp_minimal_harness.rotation_g53.run
check_exitcode linuxcnc_interp_minimal_harness.iniparam.run
check_exitcode linuxcnc_interp_minimal_harness.iniparam_failassign.run
check_exitcode linuxcnc_interp_minimal_harness.sub_call_from_sub.run
check_exitcode linuxcnc_interp_minimal_harness.sequence_number.run
check_exitcode linuxcnc_interp_minimal_harness.nested_sub_error.run
check_exitcode linuxcnc_interp_minimal_harness.nested_sub_in_file_error.run
check_exitcode linuxcnc_interp_minimal_harness.oword_unwind.run
check_exitcode linuxcnc_interp_minimal_harness.abort_hot_comment.run
check_exitcode linuxcnc_interp_minimal_harness.m19.run
check_exitcode linuxcnc_interp_minimal_harness.magic_comments_param_format.run
check_exitcode linuxcnc_interp_minimal_harness.m98m99_01_basics.run
check_exitcode linuxcnc_interp_minimal_harness.m98m99_02_variables.run
check_exitcode linuxcnc_interp_minimal_harness.m98m99_07_nested_subs.run
check_exitcode linuxcnc_interp_minimal_harness.m98m99_08_sub_follows_main.run
check_exitcode linuxcnc_interp_minimal_harness.m98m99_10_m98_p001.run
check_exitcode linuxcnc_interp_minimal_harness.m98m99_13_named_program_named.run
check_exitcode linuxcnc_interp_minimal_harness.m98m99_13_named_program_numbered.run
check_exitcode linuxcnc_interp_minimal_harness.m98m99_14_o_expression_call.run
check_exitcode linuxcnc_interp_minimal_harness.sim_axis_foam.run
check_exitcode linuxcnc_interp_minimal_harness.sim_bridgemill.run
check_exitcode linuxcnc_interp_minimal_harness.sim_geometry_xyzc.run
check_exitcode linuxcnc_interp_minimal_harness.sim_external_offsets_dyn.run
check_exitcode linuxcnc_parameter_file_harness
check_exitcode linuxcnc_parameter_file_harness.run
check_exitcode linuxcnc_interp_init_harness
@@ -165,6 +246,8 @@ check_exitcode linuxcnc_remap_hal_sync_harness
check_exitcode linuxcnc_remap_hal_sync_harness.run
check_exitcode linuxcnc_5axis_remap_execute_harness
check_exitcode linuxcnc_5axis_remap_execute_harness.run
check_exitcode linuxcnc_duplicate_oword_remap_harness
check_exitcode linuxcnc_duplicate_oword_remap_harness.run
check_exitcode linuxcnc_indexer_harness
check_exitcode linuxcnc_indexer_harness.run
check_exitcode linuxcnc_rs274_compile_probe
@@ -214,6 +297,29 @@ check_exitcode linuxcnc_interp_base_source_probe
check_exitcode linuxcnc_gomath_source_probe
check_exitcode linuxcnc_tooldata_common_source_probe
INIPARAM_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.iniparam.run.stdout.log"
grep -Fq "file_open=0" "$INIPARAM_STDOUT"
grep -Fq "file_read_count=9" "$INIPARAM_STDOUT"
grep -Fq "file_execute_count=8" "$INIPARAM_STDOUT"
grep -Fq "file_saw_error=1" "$INIPARAM_STDOUT"
grep -Fq "file_error_text=Named parameter #<_ini[nosuchsection]nosuchname> not defined" "$INIPARAM_STDOUT"
grep -Fq "setup.current_x=10" "$INIPARAM_STDOUT"
grep -Fq "setup.current_y=20" "$INIPARAM_STDOUT"
grep -Fq "setup.current_z=30" "$INIPARAM_STDOUT"
grep -Fq "canon_event=STRAIGHT_TRAVERSE line=1 x=10 y=20 z=30" "$INIPARAM_STDOUT"
grep -Fq "canon_event=MESSAGE: position now: 10.000000 20.000000 30.000000" "$INIPARAM_STDOUT"
grep -Fq "canon_event=MESSAGE: not in INI: ######" "$INIPARAM_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$INIPARAM_STDOUT"
INIPARAM_FAILASSIGN_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.iniparam_failassign.run.stdout.log"
grep -Fq "file_open=0" "$INIPARAM_FAILASSIGN_STDOUT"
grep -Fq "file_saw_error=1" "$INIPARAM_FAILASSIGN_STDOUT"
grep -Fq "file_error_text=Cannot assign to read-only parameter #<_ini[vars]toolchange_x>" "$INIPARAM_FAILASSIGN_STDOUT"
if grep -Fq "canon_event=MESSAGE: notreached" "$INIPARAM_FAILASSIGN_STDOUT"; then
echo "iniparam-failassign unexpectedly reached post-assignment message" >&2
exit 1
fi
EMC_STATUS_STDOUT="$BUILD_DIR/linuxcnc_emc_status_probe.run.stdout.log"
grep -Fq "emc_status_default_linear_units=1" "$EMC_STATUS_STDOUT"
grep -Fq "emc_status_default_units_visible=1" "$EMC_STATUS_STDOUT"
@@ -248,39 +354,56 @@ grep -Fq "xyzbc_trt_switch_mcodes_from_linuxcnc=1" "$FIVEAXIS_REMAP_ASSET_STDOUT
grep -Fq "fiveaxis_remap_assets_from_linuxcnc=1" "$FIVEAXIS_REMAP_ASSET_STDOUT"
REMAP_PARSE_STDOUT="$BUILD_DIR/linuxcnc_remap_parse_harness.run.stdout.log"
check_remap_descriptor() {
local machine="$1"
local mcode="$2"
grep -Fq "${machine}_${mcode}_name_lookup=1" "$REMAP_PARSE_STDOUT"
grep -Fq "${machine}_${mcode}_mcode_lookup=1" "$REMAP_PARSE_STDOUT"
grep -Fq "${machine}_${mcode}_ngc=1" "$REMAP_PARSE_STDOUT"
grep -Fq "${machine}_${mcode}_modalgroup10=1" "$REMAP_PARSE_STDOUT"
grep -Fq "${machine}_${mcode}_no_python=1" "$REMAP_PARSE_STDOUT"
grep -Fq "${machine}_${mcode}_linuxcnc_mcode_remappable=1" "$REMAP_PARSE_STDOUT"
}
grep -Fq "xyzac_trt_ini_open=1" "$REMAP_PARSE_STDOUT"
grep -Fq "xyzac_trt_parse_remap_1=0" "$REMAP_PARSE_STDOUT"
grep -Fq "xyzac_trt_parse_remap_2=0" "$REMAP_PARSE_STDOUT"
grep -Fq "xyzac_trt_parse_remap_3=0" "$REMAP_PARSE_STDOUT"
grep -Fq "xyzac_trt_parsed_remap_count=3" "$REMAP_PARSE_STDOUT"
grep -Fq "xyzac_trt_M428_ngc=1" "$REMAP_PARSE_STDOUT"
grep -Fq "xyzac_trt_M429_ngc=1" "$REMAP_PARSE_STDOUT"
grep -Fq "xyzac_trt_M430_ngc=1" "$REMAP_PARSE_STDOUT"
grep -Fq "xyzac_trt_m_remapped_count=3" "$REMAP_PARSE_STDOUT"
check_remap_descriptor "xyzac_trt" "M428"
check_remap_descriptor "xyzac_trt" "M429"
check_remap_descriptor "xyzac_trt" "M430"
grep -Fq "xyzac_trt_linuxcnc_ngc_remaps_parsed=1" "$REMAP_PARSE_STDOUT"
grep -Fq "xyzbc_trt_ini_open=1" "$REMAP_PARSE_STDOUT"
grep -Fq "xyzbc_trt_parse_remap_1=0" "$REMAP_PARSE_STDOUT"
grep -Fq "xyzbc_trt_parse_remap_2=0" "$REMAP_PARSE_STDOUT"
grep -Fq "xyzbc_trt_parse_remap_3=0" "$REMAP_PARSE_STDOUT"
grep -Fq "xyzbc_trt_parsed_remap_count=3" "$REMAP_PARSE_STDOUT"
grep -Fq "xyzbc_trt_M428_ngc=1" "$REMAP_PARSE_STDOUT"
grep -Fq "xyzbc_trt_M429_ngc=1" "$REMAP_PARSE_STDOUT"
grep -Fq "xyzbc_trt_M430_ngc=1" "$REMAP_PARSE_STDOUT"
grep -Fq "xyzbc_trt_m_remapped_count=3" "$REMAP_PARSE_STDOUT"
check_remap_descriptor "xyzbc_trt" "M428"
check_remap_descriptor "xyzbc_trt" "M429"
check_remap_descriptor "xyzbc_trt" "M430"
grep -Fq "xyzbc_trt_linuxcnc_ngc_remaps_parsed=1" "$REMAP_PARSE_STDOUT"
grep -Fq "xyzab_tdr_ini_open=1" "$REMAP_PARSE_STDOUT"
grep -Fq "xyzab_tdr_parse_remap_1=0" "$REMAP_PARSE_STDOUT"
grep -Fq "xyzab_tdr_parse_remap_2=0" "$REMAP_PARSE_STDOUT"
grep -Fq "xyzab_tdr_parsed_remap_count=2" "$REMAP_PARSE_STDOUT"
grep -Fq "xyzab_tdr_M428_ngc=1" "$REMAP_PARSE_STDOUT"
grep -Fq "xyzab_tdr_M429_ngc=1" "$REMAP_PARSE_STDOUT"
grep -Fq "xyzab_tdr_m_remapped_count=2" "$REMAP_PARSE_STDOUT"
check_remap_descriptor "xyzab_tdr" "M428"
check_remap_descriptor "xyzab_tdr" "M429"
grep -Fq "xyzab_tdr_linuxcnc_ngc_remaps_parsed=1" "$REMAP_PARSE_STDOUT"
grep -Fq "bridgemill_ini_open=1" "$REMAP_PARSE_STDOUT"
grep -Fq "bridgemill_parse_remap_1=0" "$REMAP_PARSE_STDOUT"
grep -Fq "bridgemill_parse_remap_2=0" "$REMAP_PARSE_STDOUT"
grep -Fq "bridgemill_parse_remap_3=0" "$REMAP_PARSE_STDOUT"
grep -Fq "bridgemill_parsed_remap_count=3" "$REMAP_PARSE_STDOUT"
grep -Fq "bridgemill_M428_ngc=1" "$REMAP_PARSE_STDOUT"
grep -Fq "bridgemill_M429_ngc=1" "$REMAP_PARSE_STDOUT"
grep -Fq "bridgemill_M430_ngc=1" "$REMAP_PARSE_STDOUT"
grep -Fq "bridgemill_m_remapped_count=3" "$REMAP_PARSE_STDOUT"
check_remap_descriptor "bridgemill" "M428"
check_remap_descriptor "bridgemill" "M429"
check_remap_descriptor "bridgemill" "M430"
grep -Fq "bridgemill_linuxcnc_ngc_remaps_parsed=1" "$REMAP_PARSE_STDOUT"
grep -Fq "fiveaxis_linuxcnc_remap_parse_path=1" "$REMAP_PARSE_STDOUT"
@@ -363,6 +486,14 @@ grep -Fq "xyzac_trt_xyzac_switchkins_test_1_file_final_rc=1" "$FIVEAXIS_REMAP_EX
grep -Fq "xyzac_trt_xyzac_switchkins_test_1_file_reached_exit=1" "$FIVEAXIS_REMAP_EXECUTE_STDOUT"
grep -Fq "xyzac_trt_xyzac_switchkins_test_1__hal[motion.switchkins-type]: rc=0 found=1 value=0" "$FIVEAXIS_REMAP_EXECUTE_STDOUT"
grep -Fq "xyzac_trt_xyzac_switchkins_test_1_linuxcnc_demo_file_execute=1" "$FIVEAXIS_REMAP_EXECUTE_STDOUT"
grep -Fq "xyzac_trt_xyzac_switchkins_test_2_file_open=0" "$FIVEAXIS_REMAP_EXECUTE_STDOUT"
grep -Fq "xyzac_trt_xyzac_switchkins_test_2_file_read_count=120" "$FIVEAXIS_REMAP_EXECUTE_STDOUT"
grep -Fq "xyzac_trt_xyzac_switchkins_test_2_file_execute_count=120" "$FIVEAXIS_REMAP_EXECUTE_STDOUT"
grep -Fq "xyzac_trt_xyzac_switchkins_test_2_file_finish_count=3" "$FIVEAXIS_REMAP_EXECUTE_STDOUT"
grep -Fq "xyzac_trt_xyzac_switchkins_test_2_file_final_rc=1" "$FIVEAXIS_REMAP_EXECUTE_STDOUT"
grep -Fq "xyzac_trt_xyzac_switchkins_test_2_file_reached_exit=1" "$FIVEAXIS_REMAP_EXECUTE_STDOUT"
grep -Fq "xyzac_trt_xyzac_switchkins_test_2__hal[motion.switchkins-type]: rc=0 found=1 value=0" "$FIVEAXIS_REMAP_EXECUTE_STDOUT"
grep -Fq "xyzac_trt_xyzac_switchkins_test_2_linuxcnc_demo_file_execute=1" "$FIVEAXIS_REMAP_EXECUTE_STDOUT"
grep -Fq "xyzac_trt_xyzac_switchkins_test_3_file_open=0" "$FIVEAXIS_REMAP_EXECUTE_STDOUT"
grep -Fq "xyzac_trt_xyzac_switchkins_test_3_file_read_count=86" "$FIVEAXIS_REMAP_EXECUTE_STDOUT"
grep -Fq "xyzac_trt_xyzac_switchkins_test_3_file_execute_count=86" "$FIVEAXIS_REMAP_EXECUTE_STDOUT"
@@ -413,6 +544,164 @@ grep -Fq "bridgemill_bridgemill_5axisgui__hal[motion.switchkins-type]: rc=0 foun
grep -Fq "bridgemill_bridgemill_5axisgui_linuxcnc_demo_file_execute=1" "$FIVEAXIS_REMAP_EXECUTE_STDOUT"
grep -Fq "fiveaxis_linuxcnc_remap_execute_path=1" "$FIVEAXIS_REMAP_EXECUTE_STDOUT"
DUPLICATE_OWORD_REMAP_STDOUT="$BUILD_DIR/linuxcnc_duplicate_oword_remap_harness.run.stdout.log"
grep -Fq "duplicate_oword_ini_open=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "duplicate_oword_subroutine_path_count=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "duplicate_oword_parse_remap_1=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "duplicate_oword_parse_remap_2=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "duplicate_oword_parsed_remap_count=2" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "duplicate_oword_remaps_ready=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "duplicate_oword_file_open=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "duplicate_oword_file_read_count=31" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "duplicate_oword_file_execute_count=31" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "duplicate_oword_file_finish_count=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "duplicate_oword_file_final_rc=3" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "duplicate_oword_file_reached_endfile=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "duplicate_oword_canon_event=MESSAGE: executing m207: run remapped m208 before o<problem>" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "duplicate_oword_canon_event=MESSAGE: rm207 running remapped m208" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "duplicate_oword_canon_event=MESSAGE: rm208 starting and done" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "duplicate_oword_canon_event=FINISH" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "duplicate_oword_linuxcnc_remap_file_execute=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "duplicate_oword_linuxcnc_regression_path=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_args_0_ini_open=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_args_0_parse_remap_1=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_args_0_parsed_remap_count=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_args_0_file_open=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_args_0_file_saw_error=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_args_0_canon_event=MESSAGE: M400 call_level= 1.000000 remap_level=1.000000" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_args_0_canon_event=MESSAGE: P word set: 47.110000" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_args_0_canon_event=MESSAGE: Q word set: 8.150000" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_args_0_canon_event=PROGRAM_END" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_args_0_linuxcnc_remap_file_execute=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_args_1_ini_open=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_args_1_parse_remap_1=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_args_1_file_execute_1=5" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_args_1_file_error_text=user-defined M400: missing: Q" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_args_1_file_saw_error=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_args_1_canon_event=PROGRAM_END" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_args_1_linuxcnc_remap_file_execute=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_args_2_ini_open=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_args_2_parse_remap_1=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_args_2_file_execute_1=5" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_args_2_file_error_text=user-defined M400: missing: P,Q" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_args_2_file_saw_error=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_args_2_canon_event=PROGRAM_END" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_args_2_linuxcnc_remap_file_execute=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_body_ngc_ini_open=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_body_ngc_parse_remap_1=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_body_ngc_file_read_5=5" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_body_ngc_file_error_text=Attempt to divide by zero" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_body_ngc_file_saw_error=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_body_ngc_canon_event=MESSAGE: before M400: call_level= 0.000000 remap_level=0.000000" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_body_ngc_canon_event=MESSAGE: in rm400: call_level= 1.000000 remap_level=1.000000" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_body_ngc_canon_event=MESSAGE: after failed M400: call_level= 0.000000 remap_level=0.000000" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_body_ngc_canon_event=PROGRAM_END" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "fail_body_ngc_linuxcnc_remap_file_execute=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "m30_interaction_ini_open=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "m30_interaction_subroutine_path_count=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "m30_interaction_parse_remap_1=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "m30_interaction_parsed_remap_count=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "m30_interaction_remaps_ready=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "m30_interaction_file_open=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "m30_interaction_file_read_count=4" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "m30_interaction_file_execute_count=4" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "m30_interaction_file_finish_count=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "m30_interaction_file_final_rc=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "m30_interaction_file_reached_exit=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "m30_interaction_canon_event=MESSAGE: m400 call_level=1.000000 remap_level=1.000000 line=2.000000" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "m30_interaction_canon_event=PROGRAM_END" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "m30_interaction_linuxcnc_remap_file_execute=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "m30_interaction_linuxcnc_regression_path=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "nested_remaps_oword_ini_open=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "nested_remaps_oword_subroutine_path_count=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "nested_remaps_oword_parse_remap_1=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "nested_remaps_oword_parse_remap_2=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "nested_remaps_oword_parse_remap_3=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "nested_remaps_oword_parse_remap_4=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "nested_remaps_oword_parsed_remap_count=4" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "nested_remaps_oword_remaps_ready=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "nested_remaps_oword_file_open=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "nested_remaps_oword_file_read_count=21" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "nested_remaps_oword_file_execute_count=21" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "nested_remaps_oword_file_finish_count=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "nested_remaps_oword_file_final_rc=3" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "nested_remaps_oword_file_reached_endfile=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "nested_remaps_oword_canon_event=MESSAGE: main call_level=0.000000 remap_level=0.000000 line=2.000000" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "nested_remaps_oword_canon_event=MESSAGE: m400 handler pre call_level=1.000000 remap_level=1.000000 line=2.000000" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "nested_remaps_oword_canon_event=MESSAGE: m401 handler pre call_level=2.000000 remap_level=2.000000 line=2.000000" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "nested_remaps_oword_canon_event=MESSAGE: m402 handler pre call_level=3.000000 remap_level=3.000000 line=2.000000" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "nested_remaps_oword_canon_event=MESSAGE: m403 handler pre call_level=4.000000 remap_level=4.000000 line=2.000000" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "nested_remaps_oword_canon_event=MESSAGE: m400 handler post call_level=1.000000 remap_level=1.000000 line=4.000000" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "nested_remaps_oword_canon_event=FINISH" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "nested_remaps_oword_linuxcnc_remap_file_execute=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "nested_remaps_oword_linuxcnc_regression_path=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "posargs_0_ini_open=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "posargs_0_subroutine_path_count=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "posargs_0_parse_remap_1=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "posargs_0_parsed_remap_count=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "posargs_0_remaps_ready=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "posargs_0_file_open=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "posargs_0_file_read_count=19" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "posargs_0_file_execute_count=19" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "posargs_0_file_finish_count=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "posargs_0_file_final_rc=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "posargs_0_file_reached_exit=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "posargs_0_canon_event=MESSAGE: in rg881: n_args=3.000000 [1.000000] [2.000000] [3.000000] [0.000000] [0.000000]" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "posargs_0_canon_event=MESSAGE: in rg881: n_args=4.000000 [1.000000] [2.000000] [3.000000] [4.000000] [0.000000]" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "posargs_0_canon_event=MESSAGE: in rg881: n_args=4.000000 [1.000000] [2.000000] [3.000000] [5.000000] [0.000000]" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "posargs_0_canon_event=MESSAGE: in rg881: n_args=5.000000 [1.000000] [2.000000] [3.000000] [4.000000] [5.000000]" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "posargs_0_canon_event=PROGRAM_END" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "posargs_0_linuxcnc_remap_file_execute=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "posargs_0_linuxcnc_regression_path=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "sequencing_ini_open=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "sequencing_subroutine_path_count=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "sequencing_parse_remap_1=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "sequencing_parse_remap_2=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "sequencing_parse_remap_3=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "sequencing_parse_remap_4=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "sequencing_parse_remap_5=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "sequencing_parse_remap_6=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "sequencing_parse_remap_7=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "sequencing_parsed_remap_count=7" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "sequencing_remaps_ready=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "sequencing_file_open=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "sequencing_file_read_count=10084" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "sequencing_file_execute_count=10084" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "sequencing_file_final_rc=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "sequencing_file_reached_exit=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "sequencing_canon_event=MESSAGE: seq=1.000000" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "sequencing_canon_event=MESSAGE: seq=5.000000" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "sequencing_canon_event=MESSAGE: seq=6.000000" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "sequencing_canon_event=MESSAGE: seq=7.000000" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "sequencing_canon_event=MESSAGE: seq=8.000000 - reset to 1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "sequencing_canon_event=MESSAGE: seq=8.000000" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "sequencing_canon_event=MESSAGE: seq=9.000000" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "sequencing_canon_event=MESSAGE: seq=10.000000 - reset to 1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "sequencing_canon_event=PROGRAM_END" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "sequencing_linuxcnc_remap_file_execute=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "sequencing_linuxcnc_regression_path=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "remap_io_ngc_ini_open=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "remap_io_ngc_subroutine_path_count=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "remap_io_ngc_parse_remap_1=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "remap_io_ngc_parse_remap_7=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "remap_io_ngc_parsed_remap_count=7" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "remap_io_ngc_mdi_M66 P1_execute_0=2" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "remap_io_ngc_mdi_M66 P1_execute_1=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "remap_io_ngc_mdi_M66 E1 L0_execute_0=2" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "remap_io_ngc_mdi_M66 E1 L0_execute_1=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "remap_io_ngc_parameter_5399=42.13" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "remap_io_ngc_parameter_5399=-13.42" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "remap_io_ngc_canon_event=SET_MOTION_OUTPUT_BIT index=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "remap_io_ngc_canon_event=CLEAR_MOTION_OUTPUT_BIT index=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "remap_io_ngc_canon_event=SET_AUX_OUTPUT_BIT index=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "remap_io_ngc_canon_event=CLEAR_AUX_OUTPUT_BIT index=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "remap_io_ngc_canon_event=WAIT index=0 input_type=1 wait_type=0 timeout=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "remap_io_ngc_canon_event=WAIT index=0 input_type=0 wait_type=0 timeout=0" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "remap_io_ngc_canon_event=SET_MOTION_OUTPUT_VALUE index=0 value=42.13" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "remap_io_ngc_canon_event=SET_AUX_OUTPUT_VALUE index=0 value=-13.42" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "remap_io_ngc_linuxcnc_mdi_sequence=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
grep -Fq "linuxcnc_upstream_remap_regression_path=1" "$DUPLICATE_OWORD_REMAP_STDOUT"
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"
@@ -720,8 +1009,362 @@ check_fixture_output \
"$CANON_FIXTURE_DIR/minimal_linear.events" \
"$RUN_STDOUT"
DO_WHILE_BREAK_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.do_while_break.run.stdout.log"
grep -Fq "file_open=0" "$DO_WHILE_BREAK_STDOUT"
grep -Fq "file_read_count=30" "$DO_WHILE_BREAK_STDOUT"
grep -Fq "file_execute_count=30" "$DO_WHILE_BREAK_STDOUT"
grep -Fq "canon_event=MESSAGE: must-execute-outer" "$DO_WHILE_BREAK_STDOUT"
grep -Fq "canon_event=MESSAGE: must-execute-nested" "$DO_WHILE_BREAK_STDOUT"
grep -Fq "canon_event=MESSAGE: must-execute-inner" "$DO_WHILE_BREAK_STDOUT"
grep -Fq "canon_event=MESSAGE: post-inner-while" "$DO_WHILE_BREAK_STDOUT"
grep -Fq "canon_event=MESSAGE: post-nested-while" "$DO_WHILE_BREAK_STDOUT"
grep -Fq "canon_event=MESSAGE: post-outer-while" "$DO_WHILE_BREAK_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$DO_WHILE_BREAK_STDOUT"
if grep -Fq "canon_event=MESSAGE: do-not-execute" "$DO_WHILE_BREAK_STDOUT"; then
echo "unexpected do-while-break skipped branch event" >&2
exit 1
fi
OWORD_BUG315_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.oword_bug315.run.stdout.log"
grep -Fq "file_open=0" "$OWORD_BUG315_STDOUT"
grep -Fq "file_read_count=23" "$OWORD_BUG315_STDOUT"
grep -Fq "file_execute_count=23" "$OWORD_BUG315_STDOUT"
grep -Fq "canon_event=MESSAGE: running sub" "$OWORD_BUG315_STDOUT"
grep -Fq "canon_event=MESSAGE: breaking out of sub" "$OWORD_BUG315_STDOUT"
grep -Fq "canon_event=MESSAGE: done" "$OWORD_BUG315_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$OWORD_BUG315_STDOUT"
OWORD_BUG315_P2_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.oword_bug315_p2.run.stdout.log"
grep -Fq "file_open=0" "$OWORD_BUG315_P2_STDOUT"
grep -Fq "file_read_count=26" "$OWORD_BUG315_P2_STDOUT"
grep -Fq "file_execute_count=26" "$OWORD_BUG315_P2_STDOUT"
grep -Fq "canon_event=STRAIGHT_TRAVERSE line=7 x=2 y=2 z=2" "$OWORD_BUG315_P2_STDOUT"
grep -Fq "canon_event=MESSAGE: executing this one" "$OWORD_BUG315_P2_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$OWORD_BUG315_P2_STDOUT"
if grep -Fq "canon_event=MESSAGE: not executing this one" "$OWORD_BUG315_P2_STDOUT"; then
echo "unexpected oword-bug315-p2 skipped subroutine event" >&2
exit 1
fi
INTERP_EXISTS_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.interp_exists.run.stdout.log"
grep -Fq "file_open=0" "$INTERP_EXISTS_STDOUT"
grep -Fq "file_read_count=7" "$INTERP_EXISTS_STDOUT"
grep -Fq "file_execute_count=7" "$INTERP_EXISTS_STDOUT"
grep -Fq "canon_event=STRAIGHT_TRAVERSE line=2 x=1 y=0 z=1" "$INTERP_EXISTS_STDOUT"
grep -Fq "canon_event=COMMENT: comment" "$INTERP_EXISTS_STDOUT"
grep -Fq "canon_event=STRAIGHT_TRAVERSE line=6 x=1 y=0 z=0" "$INTERP_EXISTS_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$INTERP_EXISTS_STDOUT"
SIM_AXIS_FOAM_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.sim_axis_foam.run.stdout.log"
grep -Fq "file_open=0" "$SIM_AXIS_FOAM_STDOUT"
grep -Fq "file_read_count=23" "$SIM_AXIS_FOAM_STDOUT"
if grep -Fq "Bad character 'u' used" "$SIM_AXIS_FOAM_STDOUT"; then
echo "axis_foam INI did not enable U/V axis readers" >&2
exit 1
fi
SIM_BRIDGEMILL_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.sim_bridgemill.run.stdout.log"
grep -Fq "file_open=0" "$SIM_BRIDGEMILL_STDOUT"
if grep -Fq "Bad character 'w' used" "$SIM_BRIDGEMILL_STDOUT"; then
echo "bridgemill INI did not enable W axis reader" >&2
exit 1
fi
SIM_GEOMETRY_XYZC_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.sim_geometry_xyzc.run.stdout.log"
grep -Fq "file_open=0" "$SIM_GEOMETRY_XYZC_STDOUT"
grep -Fq "canon_event=USER_M_COMMAND code=M110" "$SIM_GEOMETRY_XYZC_STDOUT"
if grep -Fq "Unknown m code used: M110" "$SIM_GEOMETRY_XYZC_STDOUT"; then
echo "xyzc INI did not register USER_M_PATH M110" >&2
exit 1
fi
SIM_EXTERNAL_OFFSETS_DYN_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.sim_external_offsets_dyn.run.stdout.log"
grep -Fq "file_open=0" "$SIM_EXTERNAL_OFFSETS_DYN_STDOUT"
grep -Fq "canon_event=USER_M_COMMAND code=M111" "$SIM_EXTERNAL_OFFSETS_DYN_STDOUT"
if grep -Fq "Unknown m code used: M111" "$SIM_EXTERNAL_OFFSETS_DYN_STDOUT"; then
echo "external_offsets INI did not register USER_M_PATH M111" >&2
exit 1
fi
RETURN_VALUE_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.return_value.run.stdout.log"
grep -Fq "file_open=0" "$RETURN_VALUE_STDOUT"
grep -Fq "file_read_count=75" "$RETURN_VALUE_STDOUT"
grep -Fq "file_execute_count=75" "$RETURN_VALUE_STDOUT"
grep -Fq "canon_event=MESSAGE: line 6.000000: _value: - expected 0.000000, got 0.000000" "$RETURN_VALUE_STDOUT"
grep -Fq "canon_event=MESSAGE: line 28.000000: call with arg1=2.000000 expect 246.000000, got 246.000000" "$RETURN_VALUE_STDOUT"
grep -Fq "canon_event=MESSAGE: line 37.000000: call with arg1=-1.000000 expect 0.000000, got 0.000000" "$RETURN_VALUE_STDOUT"
grep -Fq "canon_event=MESSAGE: line 47.000000: call with arg1=0.000000 expect 4712.000000, got 4712.000000" "$RETURN_VALUE_STDOUT"
grep -Fq "canon_event=MESSAGE: line 53.000000: _value=4712.000000 - expected 4712.000000" "$RETURN_VALUE_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$RETURN_VALUE_STDOUT"
if grep -Fq "fail:" "$RETURN_VALUE_STDOUT"; then
echo "unexpected return-value failure message" >&2
exit 1
fi
SUBS_FOLLOW_MAIN_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.subs_follow_main.run.stdout.log"
grep -Fq "file_open=0" "$SUBS_FOLLOW_MAIN_STDOUT"
grep -Fq "file_read_count=9" "$SUBS_FOLLOW_MAIN_STDOUT"
grep -Fq "file_execute_count=9" "$SUBS_FOLLOW_MAIN_STDOUT"
grep -Fq "canon_event=COMMENT: Subs may follow main program " "$SUBS_FOLLOW_MAIN_STDOUT"
grep -Fq "canon_event=PALLET_SHUTTLE" "$SUBS_FOLLOW_MAIN_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$SUBS_FOLLOW_MAIN_STDOUT"
FRACTIONAL_LINENUMBERS_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.fractional_linenumbers.run.stdout.log"
grep -Fq "file_open=0" "$FRACTIONAL_LINENUMBERS_STDOUT"
grep -Fq "file_read_count=4" "$FRACTIONAL_LINENUMBERS_STDOUT"
grep -Fq "file_execute_count=4" "$FRACTIONAL_LINENUMBERS_STDOUT"
grep -Fq "canon_event=SET_SPINDLE_SPEED spindle=0 speed=300" "$FRACTIONAL_LINENUMBERS_STDOUT"
grep -Fq "canon_event=SET_SPINDLE_SPEED spindle=0 speed=600" "$FRACTIONAL_LINENUMBERS_STDOUT"
grep -Fq "canon_event=SET_SPINDLE_SPEED spindle=0 speed=1200" "$FRACTIONAL_LINENUMBERS_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$FRACTIONAL_LINENUMBERS_STDOUT"
NAMEDPARAM_BUG424_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.namedparam_bug424.run.stdout.log"
grep -Fq "file_open=0" "$NAMEDPARAM_BUG424_STDOUT"
grep -Fq "file_read_count=6" "$NAMEDPARAM_BUG424_STDOUT"
grep -Fq "file_execute_count=6" "$NAMEDPARAM_BUG424_STDOUT"
grep -Fq "setup.current_x=2" "$NAMEDPARAM_BUG424_STDOUT"
grep -Fq "setup.current_y=3" "$NAMEDPARAM_BUG424_STDOUT"
grep -Fq "setup.current_z=4" "$NAMEDPARAM_BUG424_STDOUT"
grep -Fq "canon_event=USE_LENGTH_UNITS units=1" "$NAMEDPARAM_BUG424_STDOUT"
grep -Fq "canon_event=STRAIGHT_TRAVERSE line=5 x=2 y=3 z=4" "$NAMEDPARAM_BUG424_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$NAMEDPARAM_BUG424_STDOUT"
G6164_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.g6164.run.stdout.log"
grep -Fq "file_open=0" "$G6164_STDOUT"
grep -Fq "file_read_count=6" "$G6164_STDOUT"
grep -Fq "file_execute_count=6" "$G6164_STDOUT"
grep -Fq "canon_event=SET_MOTION_CONTROL_MODE mode=3 tolerance=0" "$G6164_STDOUT"
grep -Fq "canon_event=SET_NAIVECAM_TOLERANCE tolerance=0" "$G6164_STDOUT"
grep -Fq "canon_event=SET_MOTION_CONTROL_MODE mode=3 tolerance=1" "$G6164_STDOUT"
grep -Fq "canon_event=SET_NAIVECAM_TOLERANCE tolerance=1" "$G6164_STDOUT"
grep -Fq "canon_event=SET_NAIVECAM_TOLERANCE tolerance=2" "$G6164_STDOUT"
grep -Fq "canon_event=SET_MOTION_CONTROL_MODE mode=2 tolerance=0" "$G6164_STDOUT"
grep -Fq "canon_event=SET_MOTION_CONTROL_MODE mode=1 tolerance=0" "$G6164_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$G6164_STDOUT"
ROTATION_ABS_PTS_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.rotation_abs_pts.run.stdout.log"
grep -Fq "file_open=0" "$ROTATION_ABS_PTS_STDOUT"
grep -Fq "file_read_count=192" "$ROTATION_ABS_PTS_STDOUT"
grep -Fq "file_execute_count=192" "$ROTATION_ABS_PTS_STDOUT"
grep -Fq "file_saw_error=0" "$ROTATION_ABS_PTS_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$ROTATION_ABS_PTS_STDOUT"
if [[ "$(grep -Fc "canon_event=MESSAGE: 0.000000 0.000000 0.000000" "$ROTATION_ABS_PTS_STDOUT")" != "14" ]]; then
echo "unexpected rotation/abs-pts zero absolute-position message count" >&2
exit 1
fi
if [[ "$(grep -Fc "canon_event=MESSAGE: 1.000000 2.000000 3.000000" "$ROTATION_ABS_PTS_STDOUT")" != "14" ]]; then
echo "unexpected rotation/abs-pts target absolute-position message count" >&2
exit 1
fi
ROTATION_G28_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.rotation_g28.run.stdout.log"
grep -Fq "file_open=0" "$ROTATION_G28_STDOUT"
grep -Fq "file_read_count=13" "$ROTATION_G28_STDOUT"
grep -Fq "file_execute_count=13" "$ROTATION_G28_STDOUT"
grep -Fq "file_saw_error=0" "$ROTATION_G28_STDOUT"
grep -Fq "canon_event=SET_XY_ROTATION rotation=45" "$ROTATION_G28_STDOUT"
grep -Fq "canon_event=COMMENT: G55 G28" "$ROTATION_G28_STDOUT"
grep -Fq "canon_event=STRAIGHT_TRAVERSE line=9 x=10 y=10 z=0" "$ROTATION_G28_STDOUT"
grep -Fq "canon_event=COMMENT: G56 G28" "$ROTATION_G28_STDOUT"
grep -Fq "canon_event=STRAIGHT_TRAVERSE line=14 x=0 y=14.1421 z=0 a=1" "$ROTATION_G28_STDOUT"
grep -Eq "canon_event=STRAIGHT_TRAVERSE line=14 x=(0|[0-9.e-]+) y=14\\.1421 z=0 a=0" "$ROTATION_G28_STDOUT"
grep -Fq "canon_event=FINISH" "$ROTATION_G28_STDOUT"
ROTATION_G53_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.rotation_g53.run.stdout.log"
grep -Fq "file_open=0" "$ROTATION_G53_STDOUT"
grep -Fq "file_read_count=17" "$ROTATION_G53_STDOUT"
grep -Fq "file_execute_count=17" "$ROTATION_G53_STDOUT"
grep -Fq "file_saw_error=0" "$ROTATION_G53_STDOUT"
grep -Fq "canon_event=SET_XY_ROTATION rotation=45" "$ROTATION_G53_STDOUT"
grep -Fq "canon_event=COMMENT: g53 + g55 to 1,1" "$ROTATION_G53_STDOUT"
grep -Eq "canon_event=STRAIGHT_TRAVERSE line=8 x=1\\.41421 y=([0-9.e-]+) z=0" "$ROTATION_G53_STDOUT"
grep -Fq "canon_event=COMMENT: g53 + g55 + g92 to 1,1" "$ROTATION_G53_STDOUT"
grep -Fq "canon_event=STRAIGHT_TRAVERSE line=13 x=0 y=0 z=0" "$ROTATION_G53_STDOUT"
grep -Fq "canon_event=COMMENT: g53 + g56 + g92 to 1,1" "$ROTATION_G53_STDOUT"
grep -Fq "canon_event=STRAIGHT_TRAVERSE line=18 x=-0.414214 y=1 z=0 a=1" "$ROTATION_G53_STDOUT"
grep -Fq "canon_event=FINISH" "$ROTATION_G53_STDOUT"
SUB_CALL_FROM_SUB_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.sub_call_from_sub.run.stdout.log"
grep -Fq "file_open=0" "$SUB_CALL_FROM_SUB_STDOUT"
grep -Fq "file_read_count=10" "$SUB_CALL_FROM_SUB_STDOUT"
grep -Fq "file_execute_count=10" "$SUB_CALL_FROM_SUB_STDOUT"
grep -Fq "X caller: 1.000000 2.000000 3.000000" "$SUB_CALL_FROM_SUB_STDOUT"
grep -Fq "X helper: 4.000000 5.000000 6.000000" "$SUB_CALL_FROM_SUB_STDOUT"
grep -Fq "canon_event=COMMENT: Test: calling a sub from within another sub is valid" "$SUB_CALL_FROM_SUB_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$SUB_CALL_FROM_SUB_STDOUT"
SEQUENCE_NUMBER_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.sequence_number.run.stdout.log"
grep -Fq "file_open=0" "$SEQUENCE_NUMBER_STDOUT"
grep -Fq "file_read_count=13" "$SEQUENCE_NUMBER_STDOUT"
grep -Fq "file_execute_count=13" "$SEQUENCE_NUMBER_STDOUT"
grep -Fq "canon_event=MESSAGE: main: line=7.000000 - expect 7" "$SEQUENCE_NUMBER_STDOUT"
grep -Fq "canon_event=MESSAGE: in rm400.ngc line=2.000000 - expect 2" "$SEQUENCE_NUMBER_STDOUT"
grep -Fq "canon_event=MESSAGE: main: line=9.000000 - expect 9" "$SEQUENCE_NUMBER_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$SEQUENCE_NUMBER_STDOUT"
NESTED_SUB_ERROR_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.nested_sub_error.run.stdout.log"
grep -Fq "file_open=0" "$NESTED_SUB_ERROR_STDOUT"
grep -Fq "file_read_4=5" "$NESTED_SUB_ERROR_STDOUT"
grep -Fq "file_read_count=4" "$NESTED_SUB_ERROR_STDOUT"
grep -Fq "file_execute_count=3" "$NESTED_SUB_ERROR_STDOUT"
grep -Fq "canon_event=COMMENT: Test: nested sub definition inside named sub should error" "$NESTED_SUB_ERROR_STDOUT"
if grep -Fq "canon_event=PROGRAM_END" "$NESTED_SUB_ERROR_STDOUT"; then
echo "unexpected nested-sub-error program end" >&2
exit 1
fi
NESTED_SUB_IN_FILE_ERROR_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.nested_sub_in_file_error.run.stdout.log"
grep -Fq "file_open=0" "$NESTED_SUB_IN_FILE_ERROR_STDOUT"
grep -Fq "file_execute_5=5" "$NESTED_SUB_IN_FILE_ERROR_STDOUT"
grep -Fq "file_error_text=Subroutine 'O200' not found -- not in offset table and no file '" "$NESTED_SUB_IN_FILE_ERROR_STDOUT"
grep -Fq "file_read_count=5" "$NESTED_SUB_IN_FILE_ERROR_STDOUT"
grep -Fq "file_execute_count=5" "$NESTED_SUB_IN_FILE_ERROR_STDOUT"
grep -Fq "canon_event=COMMENT: Test: numbered sub after named endsub in same file should error" "$NESTED_SUB_IN_FILE_ERROR_STDOUT"
grep -Fq "canon_event=MESSAGE: sequential main: 7.000000 8.000000 9.000000" "$NESTED_SUB_IN_FILE_ERROR_STDOUT"
if grep -Fq "canon_event=PROGRAM_END" "$NESTED_SUB_IN_FILE_ERROR_STDOUT"; then
echo "unexpected nested-sub-in-file-error program end" >&2
exit 1
fi
OWORD_UNWIND_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.oword_unwind.run.stdout.log"
grep -Fq "file_open=0" "$OWORD_UNWIND_STDOUT"
grep -Fq "file_read_5=5" "$OWORD_UNWIND_STDOUT"
grep -Fq "file_read_10=5" "$OWORD_UNWIND_STDOUT"
grep -Fq "file_read_count=11" "$OWORD_UNWIND_STDOUT"
grep -Fq "file_execute_count=9" "$OWORD_UNWIND_STDOUT"
grep -Fq "canon_event=MESSAGE: pre divide-by-zero" "$OWORD_UNWIND_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$OWORD_UNWIND_STDOUT"
if grep -Fq "canon_event=MESSAGE: post divide-by-zero" "$OWORD_UNWIND_STDOUT"; then
echo "unexpected oword-unwind post-error message" >&2
exit 1
fi
ABORT_HOT_COMMENT_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.abort_hot_comment.run.stdout.log"
grep -Fq "file_open=0" "$ABORT_HOT_COMMENT_STDOUT"
grep -Fq "file_read_count=125" "$ABORT_HOT_COMMENT_STDOUT"
grep -Fq "file_execute_count=125" "$ABORT_HOT_COMMENT_STDOUT"
grep -Fq "file_saw_error=1" "$ABORT_HOT_COMMENT_STDOUT"
grep -Fq "file_error_text= MixedCase param42=20.000000 named=4711.000000 INI=3.140000" "$ABORT_HOT_COMMENT_STDOUT"
if grep -Fq "canon_event=PROGRAM_END" "$ABORT_HOT_COMMENT_STDOUT"; then
echo "abort-hot-comment unexpectedly reached program end" >&2
exit 1
fi
M19_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.m19.run.stdout.log"
grep -Fq "file_open=0" "$M19_STDOUT"
grep -Fq "file_read_count=8" "$M19_STDOUT"
grep -Fq "file_execute_count=8" "$M19_STDOUT"
grep -Fq "file_saw_error=0" "$M19_STDOUT"
grep -Fq "canon_event=ORIENT_SPINDLE spindle=0 orientation=87 mode=0" "$M19_STDOUT"
grep -Fq "canon_event=WAIT_SPINDLE_ORIENT_COMPLETE spindle=0 timeout=2" "$M19_STDOUT"
grep -Fq "canon_event=ORIENT_SPINDLE spindle=0 orientation=42 mode=1" "$M19_STDOUT"
grep -Fq "canon_event=ORIENT_SPINDLE spindle=0 orientation=132 mode=0" "$M19_STDOUT"
grep -Fq "canon_event=ORIENT_SPINDLE spindle=0 orientation=132 mode=1" "$M19_STDOUT"
grep -Fq "canon_event=WAIT_SPINDLE_ORIENT_COMPLETE spindle=0 timeout=1" "$M19_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$M19_STDOUT"
MAGIC_COMMENTS_PARAM_FORMAT_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.magic_comments_param_format.run.stdout.log"
grep -Fq "file_open=0" "$MAGIC_COMMENTS_PARAM_FORMAT_STDOUT"
grep -Fq "file_read_count=13" "$MAGIC_COMMENTS_PARAM_FORMAT_STDOUT"
grep -Fq "file_execute_count=13" "$MAGIC_COMMENTS_PARAM_FORMAT_STDOUT"
grep -Fq "file_saw_error=0" "$MAGIC_COMMENTS_PARAM_FORMAT_STDOUT"
grep -Fq "canon_event=MESSAGE: native value = 1.123457" "$MAGIC_COMMENTS_PARAM_FORMAT_STDOUT"
grep -Fq "canon_event=MESSAGE: Test round to integer: 1" "$MAGIC_COMMENTS_PARAM_FORMAT_STDOUT"
grep -Fq "canon_event=MESSAGE: Test round to 4 decimals: 1.1235" "$MAGIC_COMMENTS_PARAM_FORMAT_STDOUT"
grep -Fq "canon_event=MESSAGE: Test format separate from param: The value is: 1.1235" "$MAGIC_COMMENTS_PARAM_FORMAT_STDOUT"
grep -Fq "canon_event=MESSAGE: Test round to 7 decimals: 1.1234568" "$MAGIC_COMMENTS_PARAM_FORMAT_STDOUT"
grep -Fq "canon_event=MESSAGE: native value2 = 2.345679" "$MAGIC_COMMENTS_PARAM_FORMAT_STDOUT"
grep -Fq "canon_event=MESSAGE: Test2 round all params in line to 4 decimals: The values are: 1.1235, 2.3457" "$MAGIC_COMMENTS_PARAM_FORMAT_STDOUT"
grep -Fq "canon_event=MESSAGE: Test2 only round last value to integer: The values are: 1.123457, 2" "$MAGIC_COMMENTS_PARAM_FORMAT_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$MAGIC_COMMENTS_PARAM_FORMAT_STDOUT"
M98M99_01_BASICS_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_01_basics.run.stdout.log"
grep -Fq "file_open=0" "$M98M99_01_BASICS_STDOUT"
grep -Fq "file_read_count=22" "$M98M99_01_BASICS_STDOUT"
grep -Fq "file_execute_count=22" "$M98M99_01_BASICS_STDOUT"
grep -Fq "file_saw_error=0" "$M98M99_01_BASICS_STDOUT"
grep -Fq "canon_event=COMMENT: A simple O sub example " "$M98M99_01_BASICS_STDOUT"
grep -Fq "canon_event=STRAIGHT_TRAVERSE line=10 x=3 y=0 z=0.25" "$M98M99_01_BASICS_STDOUT"
grep -Fq "canon_event=STRAIGHT_FEED line=11 x=3 y=0 z=-1" "$M98M99_01_BASICS_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$M98M99_01_BASICS_STDOUT"
M98M99_02_VARIABLES_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_02_variables.run.stdout.log"
grep -Fq "file_open=0" "$M98M99_02_VARIABLES_STDOUT"
grep -Fq "file_read_count=54" "$M98M99_02_VARIABLES_STDOUT"
grep -Fq "file_execute_count=54" "$M98M99_02_VARIABLES_STDOUT"
grep -Fq "file_saw_error=0" "$M98M99_02_VARIABLES_STDOUT"
grep -Fq "Q MAIN/FANUC: POST-M98: 1=13.010000; 30=13.300000; 31=13.310000" "$M98M99_02_VARIABLES_STDOUT"
grep -Fq "Q MAIN/RS274NGC: POST-O-CALL: 1=42.010000; 30=42.300000; 31=13.310000" "$M98M99_02_VARIABLES_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$M98M99_02_VARIABLES_STDOUT"
M98M99_07_NESTED_SUBS_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_07_nested_subs.run.stdout.log"
grep -Fq "file_open=0" "$M98M99_07_NESTED_SUBS_STDOUT"
grep -Fq "file_read_count=163" "$M98M99_07_NESTED_SUBS_STDOUT"
grep -Fq "file_execute_count=163" "$M98M99_07_NESTED_SUBS_STDOUT"
grep -Fq "file_saw_error=0" "$M98M99_07_NESTED_SUBS_STDOUT"
grep -Fq "X >>>> LOOP [O2.O1]: 4.500000" "$M98M99_07_NESTED_SUBS_STDOUT"
grep -Fq "X MAIN END: 1=5.000000" "$M98M99_07_NESTED_SUBS_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$M98M99_07_NESTED_SUBS_STDOUT"
M98M99_08_SUB_FOLLOWS_MAIN_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_08_sub_follows_main.run.stdout.log"
grep -Fq "file_open=0" "$M98M99_08_SUB_FOLLOWS_MAIN_STDOUT"
grep -Fq "file_read_count=9" "$M98M99_08_SUB_FOLLOWS_MAIN_STDOUT"
grep -Fq "file_execute_count=9" "$M98M99_08_SUB_FOLLOWS_MAIN_STDOUT"
grep -Fq "file_saw_error=0" "$M98M99_08_SUB_FOLLOWS_MAIN_STDOUT"
grep -Fq "X IN O1" "$M98M99_08_SUB_FOLLOWS_MAIN_STDOUT"
grep -Fq "canon_event=COMMENT: Fanuc-style subs may follow main program " "$M98M99_08_SUB_FOLLOWS_MAIN_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$M98M99_08_SUB_FOLLOWS_MAIN_STDOUT"
M98M99_10_M98_P001_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_10_m98_p001.run.stdout.log"
grep -Fq "file_open=0" "$M98M99_10_M98_P001_STDOUT"
grep -Fq "file_read_count=8" "$M98M99_10_M98_P001_STDOUT"
grep -Fq "file_execute_count=8" "$M98M99_10_M98_P001_STDOUT"
grep -Fq "file_saw_error=0" "$M98M99_10_M98_P001_STDOUT"
grep -Fq "x got here" "$M98M99_10_M98_P001_STDOUT"
grep -Fq "canon_event=COMMENT: main program" "$M98M99_10_M98_P001_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$M98M99_10_M98_P001_STDOUT"
if awk '
/^file_read_1=0$/ { in_file = 1 }
in_file && /ERROR: should not get here/ { found = 1 }
END { exit(found ? 0 : 1) }
' "$M98M99_10_M98_P001_STDOUT"; then
echo "unexpected m98m99 leading-zero O-word fallback branch" >&2
exit 1
fi
M98M99_13_NAMED_PROGRAM_NAMED_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_13_named_program_named.run.stdout.log"
grep -Fq "file_open=0" "$M98M99_13_NAMED_PROGRAM_NAMED_STDOUT"
grep -Fq "file_read_count=4" "$M98M99_13_NAMED_PROGRAM_NAMED_STDOUT"
grep -Fq "file_execute_count=4" "$M98M99_13_NAMED_PROGRAM_NAMED_STDOUT"
grep -Fq "file_saw_error=0" "$M98M99_13_NAMED_PROGRAM_NAMED_STDOUT"
grep -Fq "canon_event=COMMENT: test-named.ngc: Test named programs" "$M98M99_13_NAMED_PROGRAM_NAMED_STDOUT"
grep -Fq "canon_event=COMMENT: ...program body" "$M98M99_13_NAMED_PROGRAM_NAMED_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$M98M99_13_NAMED_PROGRAM_NAMED_STDOUT"
M98M99_13_NAMED_PROGRAM_NUMBERED_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_13_named_program_numbered.run.stdout.log"
grep -Fq "file_open=0" "$M98M99_13_NAMED_PROGRAM_NUMBERED_STDOUT"
grep -Fq "file_read_count=4" "$M98M99_13_NAMED_PROGRAM_NUMBERED_STDOUT"
grep -Fq "file_execute_count=4" "$M98M99_13_NAMED_PROGRAM_NUMBERED_STDOUT"
grep -Fq "file_saw_error=0" "$M98M99_13_NAMED_PROGRAM_NUMBERED_STDOUT"
grep -Fq "canon_event=COMMENT: test-numbered.ngc: Test numbered programs" "$M98M99_13_NAMED_PROGRAM_NUMBERED_STDOUT"
grep -Fq "canon_event=COMMENT: ...program body" "$M98M99_13_NAMED_PROGRAM_NUMBERED_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$M98M99_13_NAMED_PROGRAM_NUMBERED_STDOUT"
M98M99_14_O_EXPRESSION_CALL_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_14_o_expression_call.run.stdout.log"
grep -Fq "file_open=0" "$M98M99_14_O_EXPRESSION_CALL_STDOUT"
grep -Fq "file_read_count=29" "$M98M99_14_O_EXPRESSION_CALL_STDOUT"
grep -Fq "file_execute_count=29" "$M98M99_14_O_EXPRESSION_CALL_STDOUT"
grep -Fq "file_saw_error=0" "$M98M99_14_O_EXPRESSION_CALL_STDOUT"
grep -Fq "In sub 100" "$M98M99_14_O_EXPRESSION_CALL_STDOUT"
grep -Fq "In sub 200" "$M98M99_14_O_EXPRESSION_CALL_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$M98M99_14_O_EXPRESSION_CALL_STDOUT"
for fixture in "$GCODE_FIXTURE_DIR"/*.ngc; do
name="$(basename "$fixture" .ngc)"
if [[ "$name" == "disable_fanuc_style_sub_m98" ]]; then
continue
fi
expected="$CANON_FIXTURE_DIR/$name.events"
if [[ ! -f "$expected" ]]; then
echo "missing expected canon fixture: $expected" >&2
@@ -737,9 +1380,62 @@ for fixture in "$GCODE_FIXTURE_DIR"/*.ngc; do
if [[ "$name" == "oword_subroutine" || "$name" == "percent_file_finish" ]]; then
require_mdi=0
fi
if [[ "$name" == "namedparam_semantics" ||
"$name" == "namedparam_ini_semantics" ||
"$name" == "ini_tool_table" ||
"$name" == "spindle_orient_offset" ]]; then
continue
fi
check_fixture_output "$fixture" "$expected" "$stdout_file" "$require_mdi"
done
for name in namedparam_semantics namedparam_ini_semantics; do
fixture="$GCODE_FIXTURE_DIR/$name.ngc"
expected="$CANON_FIXTURE_DIR/$name.events"
stdout_file="$BUILD_DIR/linuxcnc_interp_minimal_harness.$name.with_ini.stdout.log"
stderr_file="$BUILD_DIR/linuxcnc_interp_minimal_harness.$name.with_ini.stderr.log"
"$BUILD_DIR/linuxcnc_interp_minimal_harness" "$fixture" "$NAMEDPARAM_INI_FIXTURE" \
>"$stdout_file" \
2>"$stderr_file"
check_fixture_output "$fixture" "$expected" "$stdout_file"
done
INI_TOOL_TABLE_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.ini_tool_table.with_ini.stdout.log"
INI_TOOL_TABLE_STDERR="$BUILD_DIR/linuxcnc_interp_minimal_harness.ini_tool_table.with_ini.stderr.log"
"$BUILD_DIR/linuxcnc_interp_minimal_harness" \
"$GCODE_FIXTURE_DIR/ini_tool_table.ngc" \
"$ROOT_DIR/tests/fixtures/ini/ini_tool_table.ini" \
>"$INI_TOOL_TABLE_STDOUT" \
2>"$INI_TOOL_TABLE_STDERR"
check_fixture_output \
"$GCODE_FIXTURE_DIR/ini_tool_table.ngc" \
"$CANON_FIXTURE_DIR/ini_tool_table.events" \
"$INI_TOOL_TABLE_STDOUT"
SPINDLE_ORIENT_OFFSET_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.spindle_orient_offset.with_ini.stdout.log"
SPINDLE_ORIENT_OFFSET_STDERR="$BUILD_DIR/linuxcnc_interp_minimal_harness.spindle_orient_offset.with_ini.stderr.log"
"$BUILD_DIR/linuxcnc_interp_minimal_harness" \
"$GCODE_FIXTURE_DIR/spindle_orient_offset.ngc" \
"$SPINDLE_ORIENT_OFFSET_INI_FIXTURE" \
>"$SPINDLE_ORIENT_OFFSET_STDOUT" \
2>"$SPINDLE_ORIENT_OFFSET_STDERR"
check_fixture_output \
"$GCODE_FIXTURE_DIR/spindle_orient_offset.ngc" \
"$CANON_FIXTURE_DIR/spindle_orient_offset.events" \
"$SPINDLE_ORIENT_OFFSET_STDOUT"
DISABLE_FANUC_STYLE_SUB_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.disable_fanuc_style_sub_m98.with_ini.stdout.log"
DISABLE_FANUC_STYLE_SUB_STDERR="$BUILD_DIR/linuxcnc_interp_minimal_harness.disable_fanuc_style_sub_m98.with_ini.stderr.log"
"$BUILD_DIR/linuxcnc_interp_minimal_harness" \
"$GCODE_FIXTURE_DIR/disable_fanuc_style_sub_m98.ngc" \
"$DISABLE_FANUC_STYLE_SUB_INI_FIXTURE" \
>"$DISABLE_FANUC_STYLE_SUB_STDOUT" \
2>"$DISABLE_FANUC_STYLE_SUB_STDERR"
grep -Fq "file_open=0" "$DISABLE_FANUC_STYLE_SUB_STDOUT"
grep -Fq "file_saw_error=1" "$DISABLE_FANUC_STYLE_SUB_STDOUT"
grep -Fq "file_error_text=DISABLE_FANUC_STYLE_SUB set in INI file, but found m98" \
"$DISABLE_FANUC_STYLE_SUB_STDOUT"
for fixture in "$GCODE_ERROR_FIXTURE_DIR"/*.ngc; do
name="$(basename "$fixture" .ngc)"
expected="$CANON_ERROR_FIXTURE_DIR/$name.expected"
@@ -770,4 +1466,6 @@ for fixture in "$GCODE_ERROR_FIXTURE_DIR"/*.ngc; do
done < "$expected"
done
printf '%s\n' "$NATIVE_PROBE_VALIDATION_FINGERPRINT" > "$VALIDATION_CACHE_KEY_FILE"
printf '%s\n' "$NATIVE_PROBE_VALIDATION_FINGERPRINT" > "$VALIDATION_CACHE_OK_FILE"
echo "native probe validation complete"

View File

@@ -0,0 +1,313 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
WORKSPACE_ROOT="$(cd "$ROOT_DIR/.." && pwd)"
LINUXCNC_DIR="${LINUXCNC_DIR:-$WORKSPACE_ROOT/linuxcnc}"
NC_DIR="$LINUXCNC_DIR/nc_files"
BUILD_DIR="${NC_FILES_BUILD_DIR:-$ROOT_DIR/build/native/nc-files}"
RS274="${RS274:-$LINUXCNC_DIR/bin/rs274}"
TIMEOUT_SECONDS="${NC_FILES_TIMEOUT_SECONDS:-30}"
ONLY_FILTER=""
SCAN_ALL=0
while [[ $# -gt 0 ]]; do
case "$1" in
--all)
SCAN_ALL=1
shift
;;
--only)
[[ $# -ge 2 ]] || { echo "missing value for --only" >&2; exit 2; }
ONLY_FILTER="$2"
shift 2
;;
--help|-h)
cat <<EOF
Usage: $0 [--all] [--only PATH_SUBSTRING]
Runs LinuxCNC nc_files programs through LinuxCNC's rs274 standalone entry point.
The default suite covers the basic/example programs and common macro libraries.
Use --all to scan every .ngc under linuxcnc/nc_files.
Results are written under:
$BUILD_DIR
EOF
exit 0
;;
*)
echo "unknown argument: $1" >&2
exit 2
;;
esac
done
if [[ ! -x "$RS274" ]]; then
echo "missing executable rs274: $RS274" >&2
exit 1
fi
if [[ ! -d "$NC_DIR" ]]; then
echo "missing LinuxCNC nc_files directory: $NC_DIR" >&2
exit 1
fi
export LD_LIBRARY_PATH="$LINUXCNC_DIR/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
export PYTHONPATH="$LINUXCNC_DIR/lib/python${PYTHONPATH:+:$PYTHONPATH}"
mkdir -p "$BUILD_DIR"/{logs,out,wrapped,params}
SUMMARY_FILE="$BUILD_DIR/summary.tsv"
INI_FILE="$BUILD_DIR/test-rs274.ini"
TOOL_TABLE="$BUILD_DIR/test-tools.tbl"
PARAMETER_TEMPLATE="$BUILD_DIR/test.var.template"
printf 'path\tclass\tstatus\texpected_failure\texit_code\tseconds\toutput_lines\tstderr_summary\n' > "$SUMMARY_FILE"
relpath() {
local path="$1"
printf '%s\n' "${path#"$NC_DIR"/}"
}
safe_name() {
local rel="$1"
rel="${rel//\//_}"
rel="${rel// /_}"
rel="${rel//#/_}"
rel="${rel//=/}"
printf '%s\n' "$rel"
}
write_fixture_config() {
{
printf '[RS274NGC]\n'
printf 'PARAMETER_FILE = test.var\n'
printf 'SUBROUTINE_PATH = %s\n' "$(
find "$NC_DIR" -type d | sort | paste -sd ':' -
)"
printf 'OWORD_NARGS = 1\n'
printf 'FEATURES = 30\n'
printf '\n[DISPLAY]\n'
printf 'PROGRAM_PREFIX = %s\n' "$NC_DIR"
printf '\n[TRAJ]\n'
printf 'COORDINATES = X Y Z A B C U V W\n'
printf '\n[EMCIO]\n'
printf 'TOOL_TABLE = %s\n' "$TOOL_TABLE"
} > "$INI_FILE"
: > "$TOOL_TABLE"
local tool
for tool in $(seq 1 200); do
printf 'T%s P%s D0.125000 Z+0.000000 ; generated nc_files test tool\n' "$tool" "$tool" >> "$TOOL_TABLE"
done
{
printf '5161 0.0\n'
printf '5162 0.0\n'
printf '5163 0.0\n'
printf '5220 1\n'
printf '5221 0.0\n'
printf '5222 0.0\n'
printf '5223 0.0\n'
printf '5399 0.0\n'
} > "$PARAMETER_TEMPLATE"
}
has_program_end() {
local ngc="$1"
awk '
BEGIN { found = 0 }
/^[[:space:]]*%[[:space:]]*$/ { found = 1 }
{
line = tolower($0)
gsub(/\([^)]*\)/, "", line)
if (line ~ /(^|[[:space:]])m0*(2|30)([[:space:]]|$)/) {
found = 1
}
}
END { exit(found ? 0 : 1) }
' "$ngc"
}
is_default_basic_path() {
local rel="$1"
case "$rel" in
*/*)
case "$rel" in
gladevcp_lib/*.ngc|macros/lathe/*.ngc|macros/mill/*.ngc|ngcgui_lib/*.ngc)
return 0
;;
esac
return 1
;;
*.ngc)
return 0
;;
esac
return 1
}
classify_program() {
local rel="$1"
local ngc="$2"
case "$rel" in
macros/*|ngcgui_lib/*|gladevcp_lib/*|remap-subroutines/*|remap_lib/*|probe/*)
printf 'macro_load\n'
return 0
;;
esac
if has_program_end "$ngc"; then
printf 'main\n'
else
printf 'macro_load\n'
fi
}
prepare_input() {
local class="$1"
local ngc="$2"
local wrapped="$3"
if [[ "$class" == "main" ]]; then
printf '%s\n' "$ngc"
return 0
fi
cp "$ngc" "$wrapped"
printf '\nM2\n' >> "$wrapped"
printf '%s\n' "$wrapped"
}
known_expected_failure() {
local rel="$1"
local combined="$2"
case "$rel" in
cone.ngc)
[[ "$combined" == *"Bad character 'w' used"* ]] && { printf 'five-axis-W-machine-context\n'; return 0; }
;;
g76.ngc|lathe-g76.ngc)
[[ "$combined" == *"Length of cutter compensation entry move is not greater than the tool radius"* ]] && { printf 'lathe-cutter-comp-tool-context\n'; return 0; }
;;
lathe_g70_71_demo.ngc)
[[ "$combined" == *"Arc move in concave corner cannot be reached by the tool without gouging"* ]] && { printf 'lathe-profile-tool-context\n'; return 0; }
;;
nestedcall.ngc)
[[ "$combined" == *"Unexpected character after O-word"* ]] && { printf 'upstream-oword-callsub-syntax-edge\n'; return 0; }
;;
nurbs/G5/Curva_Stella\ #1=1_G5.ngc)
[[ "$combined" == *"Unknown g code used"* && "$combined" == *"G2.2"* ]] && { printf 'nurbs-g22-entrypoint-edge\n'; return 0; }
;;
probe*.ngc|probe/*|smartprobe.ngc|tool-length-probe.ngc|touchoff.ngc)
[[ "$combined" == *"probe"* || "$combined" == *"G38"* ]] && { printf 'probe-runtime-context\n'; return 0; }
;;
plasmac/*|plasmatest.ngc)
[[ "$combined" == *"Unknown m code"* || "$combined" == *"Named parameter"* ]] && { printf 'plasmac-runtime-context\n'; return 0; }
;;
esac
return 1
}
summarize_text() {
local file="$1"
if [[ ! -f "$file" ]]; then
return 0
fi
tr '\n\t' ' ' < "$file" | sed -E 's/[[:space:]]+/ /g; s/^ //; s/ $//' | cut -c 1-260
}
write_fixture_config
total=0
pass=0
fail=0
timeout_count=0
expected_fail=0
unexpected_fail=0
while IFS= read -r ngc; do
rel="$(relpath "$ngc")"
if [[ "$SCAN_ALL" -eq 0 ]] && ! is_default_basic_path "$rel"; then
continue
fi
if [[ -n "$ONLY_FILTER" && "$rel" != *"$ONLY_FILTER"* ]]; then
continue
fi
total=$((total + 1))
class="$(classify_program "$rel" "$ngc")"
safe="$(safe_name "$rel")"
wrapped="$BUILD_DIR/wrapped/$safe"
input="$(prepare_input "$class" "$ngc" "$wrapped")"
out_file="$BUILD_DIR/out/$safe.out"
stdout_file="$BUILD_DIR/logs/$safe.stdout"
stderr_file="$BUILD_DIR/logs/$safe.stderr"
param_file="$BUILD_DIR/params/$safe.var"
cp "$PARAMETER_TEMPLATE" "$param_file"
start_time="$(date +%s)"
set +e
(
cd "$WORKSPACE_ROOT"
INI_FILE_NAME="$INI_FILE" timeout "$TIMEOUT_SECONDS" "$RS274" \
-g \
-i "$INI_FILE" \
-t "$TOOL_TABLE" \
-v "$param_file" \
"$input" \
"$out_file"
) >"$stdout_file" 2>"$stderr_file"
rc=$?
set -e
end_time="$(date +%s)"
seconds=$((end_time - start_time))
status="FAIL"
if [[ "$rc" -eq 0 ]]; then
status="PASS"
pass=$((pass + 1))
elif [[ "$rc" -eq 124 || "$rc" -eq 137 ]]; then
status="TIMEOUT"
timeout_count=$((timeout_count + 1))
fail=$((fail + 1))
else
fail=$((fail + 1))
fi
combined="$(cat "$stdout_file" "$stderr_file" 2>/dev/null || true)"
expected=""
if [[ "$status" != "PASS" ]]; then
expected="$(known_expected_failure "$rel" "$combined" || true)"
if [[ -n "$expected" ]]; then
expected_fail=$((expected_fail + 1))
else
unexpected_fail=$((unexpected_fail + 1))
fi
fi
output_lines=0
[[ -f "$out_file" ]] && output_lines="$(wc -l < "$out_file" | tr -d '[:space:]')"
stderr_summary="$(summarize_text "$stderr_file")"
printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' \
"$rel" \
"$class" \
"$status" \
"$expected" \
"$rc" \
"$seconds" \
"$output_lines" \
"$stderr_summary" >> "$SUMMARY_FILE"
done < <(find "$NC_DIR" -type f -name '*.ngc' | sort)
{
printf 'nc_files harness summary\n'
printf 'summary: %s\n' "$SUMMARY_FILE"
printf 'suite: %s\n' "$([[ "$SCAN_ALL" -eq 1 ]] && printf all || printf basic)"
printf 'total: %s\n' "$total"
printf 'pass: %s\n' "$pass"
printf 'fail: %s\n' "$fail"
printf 'timeout: %s\n' "$timeout_count"
printf 'expected_fail: %s\n' "$expected_fail"
printf 'unexpected_fail: %s\n' "$unexpected_fail"
} | tee "$BUILD_DIR/summary.txt"
if [[ "$unexpected_fail" -ne 0 ]]; then
echo "unexpected nc_files failures:" >&2
awk -F '\t' 'NR > 1 && $3 != "PASS" && $4 == "" { print $1 "\t" $3 "\t" $8 }' "$SUMMARY_FILE" >&2
exit 1
fi

View File

@@ -0,0 +1,387 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
WORKSPACE_ROOT="$(cd "$ROOT_DIR/.." && pwd)"
LINUXCNC_DIR="${LINUXCNC_DIR:-$WORKSPACE_ROOT/linuxcnc}"
SIM_DIR="$LINUXCNC_DIR/configs/sim"
BUILD_DIR="${SIM_CONFIG_BUILD_DIR:-$ROOT_DIR/build/native/sim-configs}"
RS274="${RS274:-$LINUXCNC_DIR/bin/rs274}"
TIMEOUT_SECONDS="${SIM_CONFIG_TIMEOUT_SECONDS:-30}"
ONLY_FILTER=""
while [[ $# -gt 0 ]]; do
case "$1" in
--only)
[[ $# -ge 2 ]] || { echo "missing value for --only" >&2; exit 2; }
ONLY_FILTER="$2"
shift 2
;;
--help|-h)
cat <<EOF
Usage: $0 [--only PATH_SUBSTRING]
Runs LinuxCNC configs/sim .ngc programs through LinuxCNC's rs274 standalone
entry point and writes logs plus summary.tsv under:
$BUILD_DIR
EOF
exit 0
;;
*)
echo "unknown argument: $1" >&2
exit 2
;;
esac
done
if [[ ! -x "$RS274" ]]; then
echo "missing executable rs274: $RS274" >&2
exit 1
fi
if [[ ! -d "$SIM_DIR" ]]; then
echo "missing LinuxCNC sim config directory: $SIM_DIR" >&2
exit 1
fi
"$ROOT_DIR/tools/build_native_probes.sh"
export LD_LIBRARY_PATH="$LINUXCNC_DIR/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
export PYTHONPATH="$LINUXCNC_DIR/lib/python${PYTHONPATH:+:$PYTHONPATH}"
mkdir -p "$BUILD_DIR"/{logs,out,wrapped,params}
: > "$BUILD_DIR/skipped.tsv"
SUMMARY_FILE="$BUILD_DIR/summary.tsv"
printf 'path\tclass\tstatus\texpected_failure\texit_code\tseconds\tini\ttbl\toutput_lines\tstderr_summary\n' > "$SUMMARY_FILE"
relpath() {
local path="$1"
printf '%s\n' "${path#"$SIM_DIR"/}"
}
safe_name() {
local rel="$1"
rel="${rel//\//_}"
rel="${rel// /_}"
printf '%s\n' "$rel"
}
find_nearest_ini() {
local dir="$1"
local candidate
while [[ "$dir" == "$SIM_DIR"* ]]; do
candidate="$(find "$dir" -maxdepth 1 -type f -name '*.ini' | sort | sed -n '1p')"
if [[ -n "$candidate" ]]; then
printf '%s\n' "$candidate"
return 0
fi
[[ "$dir" == "$SIM_DIR" ]] && break
dir="$(dirname "$dir")"
done
return 1
}
find_sim_ini() {
local rel="$1"
local ngc_dir="$2"
case "$rel" in
axis/vismach/5axis/table-rotary_spindle-rotary-nutating/demos/*)
printf '%s\n' "$SIM_DIR/axis/vismach/5axis/table-rotary_spindle-rotary-nutating/xyzacb-trsrn_twp/xyzacb-trsrn.ini"
return 0
;;
esac
find_nearest_ini "$ngc_dir"
}
ini_value() {
local ini="$1"
local section="$2"
local key="$3"
awk -v section="$section" -v key="$key" '
BEGIN { in_section = 0 }
/^[[:space:]]*[#;]/ { next }
/^[[:space:]]*\[/ {
in_section = (toupper($0) ~ "\\[" toupper(section) "\\]")
next
}
in_section {
line = $0
sub(/[[:space:]]*[#;].*$/, "", line)
split(line, parts, "=")
name = parts[1]
gsub(/^[[:space:]]+|[[:space:]]+$/, "", name)
if (toupper(name) == toupper(key)) {
value = substr(line, index(line, "=") + 1)
gsub(/^[[:space:]]+|[[:space:]]+$/, "", value)
print value
exit
}
}
' "$ini"
}
find_upward_file_by_name() {
local start_dir="$1"
local basename="$2"
local dir="$start_dir"
while [[ "$dir" == "$SIM_DIR"* ]]; do
if [[ -f "$dir/$basename" ]]; then
printf '%s\n' "$dir/$basename"
return 0
fi
[[ "$dir" == "$SIM_DIR" ]] && break
dir="$(dirname "$dir")"
done
return 1
}
find_nearest_tbl() {
local ngc_dir="$1"
local ini="$2"
local tool_table
tool_table="$(ini_value "$ini" EMCIO TOOL_TABLE || true)"
if [[ -n "$tool_table" ]]; then
if [[ "$tool_table" = /* && -f "$tool_table" ]]; then
printf '%s\n' "$tool_table"
return 0
fi
if [[ -f "$(dirname "$ini")/$tool_table" ]]; then
printf '%s\n' "$(dirname "$ini")/$tool_table"
return 0
fi
if find_upward_file_by_name "$ngc_dir" "$(basename "$tool_table")"; then
return 0
fi
fi
local dir="$ngc_dir"
local candidate
while [[ "$dir" == "$SIM_DIR"* ]]; do
candidate="$(find "$dir" -maxdepth 1 -type f -name '*.tbl' | sort | sed -n '1p')"
if [[ -n "$candidate" ]]; then
printf '%s\n' "$candidate"
return 0
fi
[[ "$dir" == "$SIM_DIR" ]] && break
dir="$(dirname "$dir")"
done
return 1
}
copy_parameter_file() {
local ini="$1"
local dst="$2"
local parameter_file
parameter_file="$(ini_value "$ini" RS274NGC PARAMETER_FILE || true)"
rm -f "$dst" "$dst.bak"
if [[ -n "$parameter_file" ]]; then
if [[ "$parameter_file" = /* && -f "$parameter_file" ]]; then
cp "$parameter_file" "$dst"
return 0
fi
if [[ -f "$(dirname "$ini")/$parameter_file" ]]; then
cp "$(dirname "$ini")/$parameter_file" "$dst"
return 0
fi
fi
return 0
}
has_program_end() {
local ngc="$1"
awk '
BEGIN { found = 0 }
/^[[:space:]]*%[[:space:]]*$/ { found = 1 }
{
line = tolower($0)
gsub(/\([^)]*\)/, "", line)
if (line ~ /(^|[[:space:]])m0*(2|30)([[:space:]]|$)/) {
found = 1
}
}
END { exit(found ? 0 : 1) }
' "$ngc"
}
classify_program() {
local rel="$1"
local ngc="$2"
if [[ "$rel" == */remap_subs/* || "$rel" == */nc_subroutines/* ]]; then
printf 'remap_subroutine\n'
elif [[ "$rel" == */macros/* || "$rel" == */lathe_configs/* ]]; then
printf 'macro_load\n'
elif has_program_end "$ngc"; then
printf 'main\n'
else
printf 'macro_load\n'
fi
}
prepare_input() {
local class="$1"
local ngc="$2"
local wrapped="$3"
if [[ "$class" == "main" ]]; then
printf '%s\n' "$ngc"
return 0
fi
cp "$ngc" "$wrapped"
printf '\nM2\n' >> "$wrapped"
printf '%s\n' "$wrapped"
}
known_expected_failure() {
local rel="$1"
local combined="$2"
case "$rel" in
gmoccapy/*)
[[ "$combined" == *"python/toplevel.py"* ]] && { printf 'python-remap-runtime-edge\n'; return 0; }
;;
axis/laser/*)
[[ "$combined" == *"python/toplevel.py"* ]] && { printf 'python-remap-runtime-edge\n'; return 0; }
;;
axis/external_offsets/dyn_demo.ngc|axis/external_offsets/eoffsets.ngc|axis/external_offsets/jwp_z.ngc|axis/external_offsets/opa_demo.ngc)
[[ "$combined" == *"Unknown m code used: M111"* ]] && { printf 'user-m-code-M111\n'; return 0; }
;;
axis/geometry/xyzc.ngc)
[[ "$combined" == *"Unknown m code used: M110"* ]] && { printf 'user-m-code-M110\n'; return 0; }
;;
axis/foam/foam.ngc)
[[ "$combined" == *"Bad character 'u' used"* ]] && { printf 'ini-axis-mask-UV\n'; return 0; }
;;
axis/vismach/5axis/bridgemill/5axisgui.ngc)
[[ "$combined" == *"Bad character 'w' used"* ]] && { printf 'ini-axis-mask-W\n'; return 0; }
;;
axis/vismach/5axis/table-rotary_spindle-rotary-nutating/demos/incremental_repetition_g533.ngc)
[[ "$combined" == *"Cannot use axis values without a g code that uses them"* ]] && { printf 'upstream-demo-missing-motion-gcode\n'; return 0; }
;;
axis/vismach/5axis/table-rotary_spindle-rotary-nutating/demos/*)
[[ "$combined" == *"python/toplevel.py"* ]] && { printf 'python-remap-runtime-edge\n'; return 0; }
;;
esac
return 1
}
summarize_text() {
local file="$1"
if [[ ! -f "$file" ]]; then
return 0
fi
tr '\n\t' ' ' < "$file" | sed -E 's/[[:space:]]+/ /g; s/^ //; s/ $//' | cut -c 1-260
}
total=0
pass=0
fail=0
timeout_count=0
skip=0
expected_fail=0
unexpected_fail=0
while IFS= read -r ngc; do
rel="$(relpath "$ngc")"
if [[ -n "$ONLY_FILTER" && "$rel" != *"$ONLY_FILTER"* ]]; then
continue
fi
if [[ "$rel" == */python/*.ngc ]]; then
printf '%s\tunsupported_runtime_edge\tpython-ngc-helper\n' "$rel" >> "$BUILD_DIR/skipped.tsv"
skip=$((skip + 1))
continue
fi
ini="$(find_sim_ini "$rel" "$(dirname "$ngc")" || true)"
if [[ -z "$ini" ]]; then
printf '%s\tunsupported_runtime_edge\tmissing-ini\n' "$rel" >> "$BUILD_DIR/skipped.tsv"
skip=$((skip + 1))
continue
fi
tbl="$(find_nearest_tbl "$(dirname "$ngc")" "$ini" || true)"
if [[ -z "$tbl" ]]; then
printf '%s\tunsupported_runtime_edge\tmissing-tool-table\n' "$rel" >> "$BUILD_DIR/skipped.tsv"
skip=$((skip + 1))
continue
fi
total=$((total + 1))
class="$(classify_program "$rel" "$ngc")"
safe="$(safe_name "$rel")"
wrapped="$BUILD_DIR/wrapped/$safe"
input="$(prepare_input "$class" "$ngc" "$wrapped")"
out_file="$BUILD_DIR/out/$safe.out"
stdout_file="$BUILD_DIR/logs/$safe.stdout"
stderr_file="$BUILD_DIR/logs/$safe.stderr"
param_file="$BUILD_DIR/params/$safe.var"
copy_parameter_file "$ini" "$param_file"
start_time="$(date +%s)"
set +e
(
cd "$(dirname "$ini")"
INI_FILE_NAME="$ini" timeout "$TIMEOUT_SECONDS" "$RS274" \
-g \
-i "$(basename "$ini")" \
-t "$tbl" \
-v "$param_file" \
"$input" \
"$out_file"
) >"$stdout_file" 2>"$stderr_file"
rc=$?
set -e
end_time="$(date +%s)"
seconds=$((end_time - start_time))
status="FAIL"
if [[ "$rc" -eq 0 ]]; then
status="PASS"
pass=$((pass + 1))
elif [[ "$rc" -eq 124 || "$rc" -eq 137 ]]; then
status="TIMEOUT"
timeout_count=$((timeout_count + 1))
else
fail=$((fail + 1))
fi
combined="$(cat "$stdout_file" "$stderr_file" 2>/dev/null || true)"
expected=""
if [[ "$status" != "PASS" ]]; then
expected="$(known_expected_failure "$rel" "$combined" || true)"
if [[ -n "$expected" ]]; then
expected_fail=$((expected_fail + 1))
else
unexpected_fail=$((unexpected_fail + 1))
fi
fi
output_lines=0
[[ -f "$out_file" ]] && output_lines="$(wc -l < "$out_file" | tr -d '[:space:]')"
stderr_summary="$(summarize_text "$stderr_file")"
printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' \
"$rel" \
"$class" \
"$status" \
"$expected" \
"$rc" \
"$seconds" \
"$(relpath "$ini")" \
"$(relpath "$tbl")" \
"$output_lines" \
"$stderr_summary" >> "$SUMMARY_FILE"
done < <(find "$SIM_DIR" -type f -name '*.ngc' | sort)
{
printf 'sim config harness summary\n'
printf 'summary: %s\n' "$SUMMARY_FILE"
printf 'total: %s\n' "$total"
printf 'pass: %s\n' "$pass"
printf 'fail: %s\n' "$fail"
printf 'timeout: %s\n' "$timeout_count"
printf 'expected_fail: %s\n' "$expected_fail"
printf 'unexpected_fail: %s\n' "$unexpected_fail"
printf 'skipped: %s\n' "$skip"
} | tee "$BUILD_DIR/summary.txt"
if [[ "$unexpected_fail" -ne 0 ]]; then
echo "unexpected sim-config failures:" >&2
awk -F '\t' 'NR > 1 && $3 != "PASS" && $4 == "" { print $1 "\t" $3 "\t" $10 }' "$SUMMARY_FILE" >&2
exit 1
fi