Complete sim config boundary coverage

This commit is contained in:
2026-06-11 06:12:06 +08:00
parent 5bd8f12872
commit 1ab5571ae1
76 changed files with 18975 additions and 146 deletions

View File

@@ -8,6 +8,11 @@ WRAP_DIR="$ROOT_DIR/runtime/core/linuxcnc_wrap"
SHIM_DIR="$ROOT_DIR/runtime/core/shims"
INCLUDE_DIR="$ROOT_DIR/runtime/core/include"
SOURCE_PROBE_MAP="$BUILD_DIR/source-probes.tsv"
NATIVE_SOURCE_PROOF_SUMMARY="$BUILD_DIR/native-source-proof-summary.tsv"
NATIVE_RUNTIME_PROBE_SUMMARY="$BUILD_DIR/native-runtime-probe-summary.tsv"
MILLTURN_USER_M_RUNTIME_PROBE="$ROOT_DIR/tests/native/probe_millturn_user_m_runtime.sh"
TOOL_DB_RUNTIME_PROBE="$ROOT_DIR/tests/native/probe_tool_db_runtime.sh"
PYTHON_REMAP_RUNTIME_PROBE="$ROOT_DIR/tests/native/probe_python_remap_runtime.sh"
MINIMAL_GCODE_FIXTURE="$ROOT_DIR/tests/fixtures/gcode/minimal_linear.ngc"
DO_WHILE_BREAK_FIXTURE="$ROOT_DIR/vendor/linuxcnc/tests/interp/do-while-break/test.ngc"
OWORD_BUG315_FIXTURE="$ROOT_DIR/vendor/linuxcnc/tests/interp/oword-bug315/test.ngc"
@@ -175,6 +180,31 @@ native_input_fingerprint() {
"$SHIM_DIR" \
"$INCLUDE_DIR" \
"$ROOT_DIR/tests/fixtures"
hash_tree \
"$ROOT_DIR/../linuxcnc/configs/sim/axis/vismach/millturn/mcodes" \
"$ROOT_DIR/../linuxcnc/configs/sim/axis/vismach/millturn/remap_subs"
sha256sum \
"$MILLTURN_USER_M_RUNTIME_PROBE" \
"$ROOT_DIR/../linuxcnc/configs/sim/axis/vismach/millturn/millturn.ini"
hash_tree \
"$ROOT_DIR/../linuxcnc/configs/sim/axis/db_demo"
sha256sum \
"$TOOL_DB_RUNTIME_PROBE" \
"$ROOT_DIR/../linuxcnc/src/emc/task/taskclass.cc" \
"$ROOT_DIR/../linuxcnc/src/emc/tooldata/tooldata_db.cc" \
"$ROOT_DIR/../linuxcnc/src/emc/tooldata/tooldata_common.cc"
hash_tree \
"$ROOT_DIR/../linuxcnc/configs/sim/axis/laser" \
"$ROOT_DIR/../linuxcnc/configs/sim/axis/remap/cycle" \
"$ROOT_DIR/../linuxcnc/configs/sim/axis/nc_files/remap_lib/python-stdglue" \
"$ROOT_DIR/../linuxcnc/configs/sim/axis/vismach/5axis/table-rotary_spindle-rotary-nutating" \
"$ROOT_DIR/../linuxcnc/configs/sim/gmoccapy/python"
sha256sum \
"$ROOT_DIR/../linuxcnc/src/emc/rs274ngc/interp_python.cc" \
"$ROOT_DIR/../linuxcnc/src/emc/pythonplugin/python_plugin.cc" \
"$PYTHON_REMAP_RUNTIME_PROBE"
hash_tree \
"$ROOT_DIR/../linuxcnc/configs/sim/axis/remap/stop-lookahead"
} | sha256sum | awk '{ print $1 }'
}
@@ -245,6 +275,12 @@ VENDOR_ASSET_FLAGS=(
-DLINUXCNC_VENDOR_DIR=\"$VENDOR_DIR\"
)
SOURCE_CONFIG_ASSET_FLAGS=(
"${COMMON_INI_FLAGS[@]}"
-DLINUXCNC_SOURCE_DIR=\"$ROOT_DIR/../linuxcnc\"
-DLINUXCNC_SOURCE_CONFIG_DIR=\"$ROOT_DIR/../linuxcnc/configs/sim\"
)
MINIMAL_FLAGS=(
"${COMMON_INI_FLAGS[@]}"
-ffunction-sections
@@ -309,6 +345,165 @@ write_file_if_changed() {
mv "$tmp" "$file"
}
stdout_value() {
local file="$1"
local key="$2"
awk -F= -v key="$key" '$1 == key { value = substr($0, length(key) + 2) } END { print value }' "$file"
}
append_native_source_proof_summary_row() {
local tmp="$1"
local boundary="$2"
local proof_key="$3"
local execution_key="$4"
local promotion_key="$5"
local stdout_log="$6"
local proof_value
local execution_enabled
local promotion_allowed
proof_value="$(stdout_value "$stdout_log" "$proof_key")"
execution_enabled="$(stdout_value "$stdout_log" "$execution_key")"
promotion_allowed="$(stdout_value "$stdout_log" "$promotion_key")"
printf '%s\t%s\t%s\t%s\t%s\t%s\n' \
"$boundary" \
"$proof_key" \
"$proof_value" \
"$execution_enabled" \
"$promotion_allowed" \
"${stdout_log#"$BUILD_DIR"/}" >> "$tmp"
}
write_native_source_proof_summary() {
local tmp
tmp="$(mktemp)"
printf '%s\t%s\t%s\t%s\t%s\t%s\n' \
boundary_class \
proof_key \
proof_value \
execution_enabled \
promotion_allowed \
stdout_log > "$tmp"
append_native_source_proof_summary_row \
"$tmp" \
L4-USER-M-PROCESS \
millturn_user_m_native_source_state_proof \
millturn_user_m_execution_enabled \
millturn_user_m_promotion_allowed \
"$BUILD_DIR/linuxcnc_millturn_user_m_boundary_probe.run.stdout.log"
append_native_source_proof_summary_row \
"$tmp" \
L4-TOOL-DB \
tool_db_native_source_protocol_proof \
tool_db_execution_enabled \
tool_db_promotion_allowed \
"$BUILD_DIR/linuxcnc_tool_db_boundary_probe.run.stdout.log"
append_native_source_proof_summary_row \
"$tmp" \
L4-PYTHON-REMAP \
python_remap_native_source_inventory_proof \
python_remap_execution_enabled \
python_remap_promotion_allowed \
"$BUILD_DIR/linuxcnc_python_remap_boundary_probe.run.stdout.log"
if [[ -f "$NATIVE_SOURCE_PROOF_SUMMARY" ]] && cmp -s "$tmp" "$NATIVE_SOURCE_PROOF_SUMMARY"; then
rm -f "$tmp"
return 0
fi
mv "$tmp" "$NATIVE_SOURCE_PROOF_SUMMARY"
}
append_native_runtime_probe_summary_row() {
local tmp="$1"
local boundary_class="$2"
local boundary_kind="$3"
local target="$4"
local runtime_probe="$5"
local prefix="$6"
local stdout_log="$7"
local runtime_ready
local source_proof_ready
local probe_status
local execution_enabled
local promotion_allowed
local missing_requirements
runtime_ready="$(stdout_value "$stdout_log" "${prefix}_runtime_ready")"
source_proof_ready="$(stdout_value "$stdout_log" "${prefix}_source_proof_ready")"
probe_status="$(stdout_value "$stdout_log" "${prefix}_runtime_probe_status")"
execution_enabled="$(stdout_value "$stdout_log" "${prefix}_execution_enabled")"
promotion_allowed="$(stdout_value "$stdout_log" "${prefix}_promotion_allowed")"
missing_requirements="$(stdout_value "$stdout_log" "${prefix}_missing_requirements")"
printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' \
"$boundary_class" \
"$boundary_kind" \
"$target" \
"$runtime_probe" \
"$runtime_ready" \
"$source_proof_ready" \
"$probe_status" \
"$execution_enabled" \
"$promotion_allowed" \
"${missing_requirements:-"-"}" \
"${stdout_log#"$BUILD_DIR"/}" >> "$tmp"
}
write_native_runtime_probe_summary() {
local tmp
tmp="$(mktemp)"
printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' \
boundary_class \
boundary_kind \
target \
runtime_probe \
runtime_ready \
source_proof_ready \
probe_status \
execution_enabled \
promotion_allowed \
missing_requirements \
stdout_log > "$tmp"
append_native_runtime_probe_summary_row \
"$tmp" \
L4-USER-M-PROCESS \
external_user_m_process \
axis/vismach/millturn/example.ngc \
linuxcnc_millturn_user_m_runtime_probe \
millturn_user_m \
"$BUILD_DIR/linuxcnc_millturn_user_m_runtime_probe.run.stdout.log"
append_native_runtime_probe_summary_row \
"$tmp" \
L4-TOOL-DB \
tool_database_process \
axis/db_demo/base.ngc \
linuxcnc_tool_db_runtime_probe \
tool_db \
"$BUILD_DIR/linuxcnc_tool_db_runtime_probe.run.stdout.log"
append_native_runtime_probe_summary_row \
"$tmp" \
L4-PYTHON-REMAP \
python_runtime \
axis/remap/stop-lookahead/nc_files \
linuxcnc_python_remap_runtime_probe \
python_remap \
"$BUILD_DIR/linuxcnc_python_remap_runtime_probe.run.stdout.log"
if [[ -f "$NATIVE_RUNTIME_PROBE_SUMMARY" ]] && cmp -s "$tmp" "$NATIVE_RUNTIME_PROBE_SUMMARY"; then
rm -f "$tmp"
return 0
fi
mv "$tmp" "$NATIVE_RUNTIME_PROBE_SUMMARY"
}
write_ccomp_ini() {
local file="$1"
local tool_table="$2"
@@ -692,6 +887,20 @@ FIVEAXIS_REMAP_ASSET_PROBE_SOURCES=(
"$WRAP_DIR/linuxcnc_5axis_remap_asset_probe.cpp"
)
MILLTURN_USER_M_BOUNDARY_PROBE_SOURCES=(
"$VENDOR_DIR/src/emc/ini/inifile.cc"
"$WRAP_DIR/linuxcnc_millturn_user_m_boundary_probe.cpp"
)
TOOL_DB_BOUNDARY_PROBE_SOURCES=(
"$VENDOR_DIR/src/emc/ini/inifile.cc"
"$WRAP_DIR/linuxcnc_tool_db_boundary_probe.cpp"
)
PYTHON_REMAP_BOUNDARY_PROBE_SOURCES=(
"$WRAP_DIR/linuxcnc_python_remap_boundary_probe.cpp"
)
STATE_PROBE_SOURCES=(
"$WRAP_DIR/linuxcnc_interp_state_probe.cpp"
)
@@ -1102,6 +1311,71 @@ else
"$BUILD_DIR/linuxcnc_5axis_remap_asset_probe.run.stderr.log"
fi
build_binary_target \
linuxcnc_millturn_user_m_boundary_probe \
"$BUILD_DIR/linuxcnc_millturn_user_m_boundary_probe" \
SOURCE_CONFIG_ASSET_FLAGS \
MILLTURN_USER_M_BOUNDARY_PROBE_SOURCES \
NO_LINK_FLAGS \
-lfmt
if [[ "$(tr -d '[:space:]' < "$BUILD_DIR/linuxcnc_millturn_user_m_boundary_probe.exitcode")" == "0" ]]; then
run_logged_command \
linuxcnc_millturn_user_m_boundary_probe \
"$BUILD_DIR/linuxcnc_millturn_user_m_boundary_probe"
run_logged_command \
linuxcnc_millturn_user_m_runtime_probe \
bash \
"$MILLTURN_USER_M_RUNTIME_PROBE"
else
clear_logged_command linuxcnc_millturn_user_m_boundary_probe
clear_logged_command linuxcnc_millturn_user_m_runtime_probe
fi
build_binary_target \
linuxcnc_tool_db_boundary_probe \
"$BUILD_DIR/linuxcnc_tool_db_boundary_probe" \
SOURCE_CONFIG_ASSET_FLAGS \
TOOL_DB_BOUNDARY_PROBE_SOURCES \
NO_LINK_FLAGS \
-lfmt
if [[ "$(tr -d '[:space:]' < "$BUILD_DIR/linuxcnc_tool_db_boundary_probe.exitcode")" == "0" ]]; then
run_logged_command \
linuxcnc_tool_db_boundary_probe \
"$BUILD_DIR/linuxcnc_tool_db_boundary_probe"
run_logged_command \
linuxcnc_tool_db_runtime_probe \
bash \
"$TOOL_DB_RUNTIME_PROBE"
else
clear_logged_command linuxcnc_tool_db_boundary_probe
clear_logged_command linuxcnc_tool_db_runtime_probe
fi
build_binary_target \
linuxcnc_python_remap_boundary_probe \
"$BUILD_DIR/linuxcnc_python_remap_boundary_probe" \
SOURCE_CONFIG_ASSET_FLAGS \
PYTHON_REMAP_BOUNDARY_PROBE_SOURCES \
NO_LINK_FLAGS
if [[ "$(tr -d '[:space:]' < "$BUILD_DIR/linuxcnc_python_remap_boundary_probe.exitcode")" == "0" ]]; then
run_logged_command \
linuxcnc_python_remap_boundary_probe \
"$BUILD_DIR/linuxcnc_python_remap_boundary_probe"
run_logged_command \
linuxcnc_python_remap_runtime_probe \
bash \
"$PYTHON_REMAP_RUNTIME_PROBE"
else
clear_logged_command linuxcnc_python_remap_boundary_probe
clear_logged_command linuxcnc_python_remap_runtime_probe
fi
write_native_source_proof_summary
write_native_runtime_probe_summary
build_object_target \
linuxcnc_inifile_source_probe \
"$BUILD_DIR/linuxcnc_inifile_source_probe.o" \