参考所有分组,完成尽量多的内容:结论为 WASM source probe 禁止夹带 smoke 后端

This commit is contained in:
cnc
2026-06-03 22:07:57 +08:00
parent 8b89b5b4c6
commit 3d368b2564
4 changed files with 32 additions and 2 deletions

View File

@@ -5,6 +5,9 @@ option(CNC_SIM_ENABLE_LINUXCNC_BRIDGE "Build the experimental LinuxCNC canon bri
option(CNC_SIM_ENABLE_LINUXCNC_RS274_BACKEND "Build the native LinuxCNC librs274 backend" OFF)
option(CNC_SIM_ENABLE_LINUXCNC_WASM_SAFE_PROBE "Compile the browser-safe subset of LinuxCNC rs274 sources" OFF)
option(CNC_SIM_ENABLE_SMOKE_BACKEND "Build the legacy explicit smoke G-code backend test harness" OFF)
if(CNC_SIM_ENABLE_SMOKE_BACKEND AND CNC_SIM_ENABLE_LINUXCNC_WASM_SAFE_PROBE)
message(FATAL_ERROR "CNC_SIM_ENABLE_SMOKE_BACKEND cannot be combined with CNC_SIM_ENABLE_LINUXCNC_WASM_SAFE_PROBE")
endif()
set(CNC_SIM_LINUXCNC_ROOT "" CACHE PATH "LinuxCNC source root for the experimental bridge")
set(CNC_SIM_LINUXCNC_WASM_SOURCE_MANIFEST
"${CMAKE_CURRENT_SOURCE_DIR}/../linuxcnc-rs274-wasm-source-files.txt"

View File

@@ -65,6 +65,9 @@ Efficiency rules:
permission to expand the pass into another workstream.
- Do not add a smoke-only behavior path when the LinuxCNC-backed route already
exists; add coverage to the source-backed route instead.
- The legacy explicit smoke backend must not be enabled together with the
LinuxCNC wasm-safe source probe; browser/WASM builds must keep the LinuxCNC
source-linked path separate from the temporary smoke parser.
- Keep browser filesystem guardrails negative as well as positive: require the
OPFS bridge and reject browser app/wasm storage APIs that could bypass it.
- Smoke tests are verification guardrails. They must not be expanded with new

View File

@@ -1145,6 +1145,7 @@ grep -F './list-cnc-sim-core-sources.sh --with-smoke > "$core_source_list"' test
grep -F -- '-DCNC_SIM_ENABLE_SMOKE_BACKEND' test-native.sh >/dev/null
grep -F 'option(CNC_SIM_ENABLE_SMOKE_BACKEND "Build the legacy explicit smoke G-code backend test harness" OFF)' core/CMakeLists.txt >/dev/null
grep -F 'CNC_SIM_ENABLE_SMOKE_BACKEND cannot be combined with CNC_SIM_ENABLE_LINUXCNC_RS274_BACKEND' core/CMakeLists.txt >/dev/null
grep -F 'CNC_SIM_ENABLE_SMOKE_BACKEND cannot be combined with CNC_SIM_ENABLE_LINUXCNC_WASM_SAFE_PROBE' core/CMakeLists.txt >/dev/null
grep -F 'smoke backend is not compiled into this build' core/src/gcode_backend.cpp >/dev/null
grep -F './list-linuxcnc-bridge-smoke-project-sources.sh > "$project_source_list"' test-linuxcnc-bridge-native.sh >/dev/null
grep -F 'LINUXCNC_ROOT="$linuxcnc_root" ./list-linuxcnc-source-support-objects.sh > "$support_object_list"' test-linuxcnc-source-link.sh >/dev/null

View File

@@ -56,6 +56,8 @@ wasm_python_c_api_build_dir_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_wasm_python_c_
wasm_interp_find_build_dir_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_wasm_interp_find_build_dir.XXXXXX.log")
wasm_tooldata_mmap_build_dir_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_wasm_tooldata_mmap_build_dir.XXXXXX.log")
wasm_tooldata_runtime_build_dir_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_wasm_tooldata_runtime_build_dir.XXXXXX.log")
smoke_wasm_probe_cmake_dir=$(mktemp -d "${TMPDIR:-/tmp}/cnc_sim_smoke_wasm_probe_cmake.XXXXXX")
smoke_wasm_probe_cmake_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_smoke_wasm_probe_cmake.XXXXXX.log")
cleanup_wasm_cmake_probe_temps() {
local temp_path
@@ -76,6 +78,8 @@ cleanup_wasm_cmake_probe_temps() {
"$wasm_interp_find_build_dir_log" \
"$wasm_tooldata_mmap_build_dir_log" \
"$wasm_tooldata_runtime_build_dir_log" \
"$smoke_wasm_probe_cmake_dir" \
"$smoke_wasm_probe_cmake_log" \
"${build_next_signature:-}" \
"${unknown_manifest_filter_log:-}" \
"${unknown_manifest_output_log:-}" \
@@ -576,7 +580,7 @@ for build_dir_probe_script in \
exit 1
fi
done
grep -F 'trap '\''rm -f "$missing_manifest" "$missing_manifest_log" "$missing_root_log" "$missing_source_manifest" "$missing_source_log" "$duplicate_manifest" "$duplicate_manifest_log" "$missing_replacement_manifest" "$missing_replacement_log"'\'' EXIT' test-linuxcnc-wasm-blockers.sh >/dev/null
grep -F 'trap '\''rm -f "$missing_manifest" "$missing_manifest_log" "$missing_root_log" "$missing_source_manifest" "$missing_source_log" "$duplicate_manifest" "$duplicate_manifest_log" "$bad_line_manifest" "$bad_line_log" "$missing_replacement_manifest" "$missing_replacement_log"'\'' EXIT' test-linuxcnc-wasm-blockers.sh >/dev/null
grep -F 'self_checks=${CNC_SIM_WASM_BLOCKERS_SELF_CHECKS:-0}' test-linuxcnc-wasm-blockers.sh >/dev/null
grep -F 'CNC_SIM_WASM_BLOCKERS_SELF_CHECKS must be 0 or 1: $self_checks' test-linuxcnc-wasm-blockers.sh >/dev/null
if grep -F 'rm -f "$missing_source_manifest" "$missing_source_log"' test-linuxcnc-wasm-blockers.sh >/dev/null; then
@@ -774,7 +778,7 @@ grep -F 'exists(path: string): Promise<boolean>;' web/src/wasm-core.d.ts >/dev/n
grep -F 'stat(path: string): Promise<WasmOpfsEntryStat>;' web/src/wasm-core.d.ts >/dev/null
grep -F 'LinuxCNC source basis: rs274ngc_pre.cc restore_parameters() reads the' web/src/wasm-core.js >/dev/null
grep -F 'before replacing the main file and managing filename + ".bak".' web/src/wasm-core.js >/dev/null
grep -F 'await removeOpfsEntry(workspacePath, `${path}.new`, false);' web/src/wasm-core.js >/dev/null
grep -F 'await removeOpfsFileEntry(workspacePath, `${path}.new`);' web/src/wasm-core.js >/dev/null
grep -F 'OPFS workspace is required for browser program parsing' web/src/app.js >/dev/null
grep -F 'const events = await simulator.parseFileWithParameterFile(programPath, parameterPath, "linuxcnc", parseOptions);' web/src/app.js >/dev/null
grep -F 'default browser simulator did not create an OPFS workspace' web/test-browser-wasm-smoke-opfs-policy-sections.js >/dev/null
@@ -1469,6 +1473,7 @@ awk '
grep -F "LinuxCNC wasm source manifest has no core entries" core/CMakeLists.txt >/dev/null
grep -F "LinuxCNC wasm source manifest has no blocked entries" core/CMakeLists.txt >/dev/null
grep -F "WASM builds must enable CNC_SIM_ENABLE_LINUXCNC_WASM_SAFE_PROBE so LinuxCNC rs274 sources are linked" core/CMakeLists.txt >/dev/null
grep -F "CNC_SIM_ENABLE_SMOKE_BACKEND cannot be combined with CNC_SIM_ENABLE_LINUXCNC_WASM_SAFE_PROBE" core/CMakeLists.txt >/dev/null
grep -F -- '-DCNC_SIM_ENABLE_LINUXCNC_WASM_SAFE_PROBE=ON' build-wasm.sh >/dev/null
grep -F 'if(CNC_SIM_ENABLE_LINUXCNC_WASM_SAFE_PROBE)' core/CMakeLists.txt >/dev/null
grep -F 'list(APPEND cnc_sim_core_sources ${cnc_sim_linuxcnc_rs274_backend_sources})' core/CMakeLists.txt >/dev/null
@@ -1539,6 +1544,24 @@ grep -F '$<TARGET_OBJECTS:linuxcnc_rs274_wasm_safe_probe_objects>' core/CMakeLis
grep -F '$<TARGET_OBJECTS:cnc_sim_objects>' core/CMakeLists.txt >/dev/null
grep -F 'CNC_SIM_ENABLE_LINUXCNC_RS274_BACKEND' core/CMakeLists.txt >/dev/null
grep -F '#ifndef CNC_SIM_ENABLE_LINUXCNC_WASM_SAFE_PROBE' core/src/linuxcnc_rs274_backend.cpp >/dev/null
if command -v cmake >/dev/null 2>&1; then
if cmake -S core -B "$smoke_wasm_probe_cmake_dir" \
-DCMAKE_BUILD_TYPE=Release \
-DCNC_SIM_LINUXCNC_ROOT="$linuxcnc_root" \
-DCNC_SIM_LINUXCNC_WASM_SOURCE_MANIFEST="$manifest" \
-DCNC_SIM_ENABLE_LINUXCNC_WASM_SAFE_PROBE=ON \
-DCNC_SIM_ENABLE_SMOKE_BACKEND=ON \
>"$smoke_wasm_probe_cmake_log" 2>&1; then
echo "CMake accepted legacy smoke backend with LinuxCNC wasm-safe probe enabled" >&2
exit 1
fi
if ! grep -F "CNC_SIM_ENABLE_SMOKE_BACKEND cannot be combined with" "$smoke_wasm_probe_cmake_log" >/dev/null ||
! grep -F "CNC_SIM_ENABLE_LINUXCNC_WASM_SAFE_PROBE" "$smoke_wasm_probe_cmake_log" >/dev/null; then
echo "CMake did not report smoke/wasm-safe probe conflict clearly" >&2
sed -n '1,40p' "$smoke_wasm_probe_cmake_log" >&2
exit 1
fi
fi
fi