说明:集中 LinuxCNC 源码清单与 wasm/native probe 的路径解析,补强 manifest、shim、source-link 检查,并保持 LinuxCNC 源码后端对齐验证流程可复用。 验证:./test-native.sh;./test-linuxcnc-source-link.sh;./test-all-native.sh;wasm source/probe 相关脚本。
68 lines
2.4 KiB
Bash
Executable File
68 lines
2.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
linuxcnc_root=${LINUXCNC_ROOT:-../linuxcnc}
|
|
cxx=${CXX:-g++}
|
|
python_includes=$(python3.13-config --includes 2>/dev/null || python3-config --includes)
|
|
manifest=${1:-linuxcnc-rs274-source-files.txt}
|
|
|
|
if [[ ! -f "$manifest" ]]; then
|
|
echo "missing manifest: $manifest" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [[ ! -d "$linuxcnc_root" ]]; then
|
|
echo "missing LinuxCNC root: $linuxcnc_root" >&2
|
|
exit 1
|
|
fi
|
|
|
|
source_list=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_linuxcnc_source_syntax_sources.XXXXXX.txt")
|
|
trap 'rm -f "$source_list"' EXIT
|
|
LINUXCNC_ROOT="$linuxcnc_root" ./list-linuxcnc-source-manifest-sources.sh "$manifest" all full > "$source_list"
|
|
|
|
missing_source_manifest=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_missing_rs274_manifest_source.XXXXXX.txt")
|
|
missing_source_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_missing_rs274_manifest_source.XXXXXX.log")
|
|
printf 'core:src/emc/rs274ngc/does_not_exist.cc:test missing source\n' >"$missing_source_manifest"
|
|
if ./test-linuxcnc-source-objects.sh "$missing_source_manifest" >"$missing_source_log" 2>&1; then
|
|
echo "linuxcnc source object probe accepted missing manifest file" >&2
|
|
exit 1
|
|
fi
|
|
if ! grep -F "missing manifest file: src/emc/rs274ngc/does_not_exist.cc" "$missing_source_log" >/dev/null; then
|
|
echo "linuxcnc source object probe did not report missing manifest file clearly" >&2
|
|
sed -n '1,20p' "$missing_source_log" >&2
|
|
exit 1
|
|
fi
|
|
if ./test-linuxcnc-source-link.sh "$missing_source_manifest" >"$missing_source_log" 2>&1; then
|
|
echo "linuxcnc source link probe accepted missing manifest file" >&2
|
|
exit 1
|
|
fi
|
|
if ! grep -F "missing manifest file: src/emc/rs274ngc/does_not_exist.cc" "$missing_source_log" >/dev/null; then
|
|
echo "linuxcnc source link probe did not report missing manifest file clearly" >&2
|
|
sed -n '1,20p' "$missing_source_log" >&2
|
|
exit 1
|
|
fi
|
|
rm -f "$missing_source_manifest" "$missing_source_log"
|
|
|
|
common_flags=(
|
|
-std=c++17
|
|
-DULAPI
|
|
-fsyntax-only
|
|
-I "$linuxcnc_root/src"
|
|
-I "$linuxcnc_root/src/emc"
|
|
-I "$linuxcnc_root/src/emc/nml_intf"
|
|
-I "$linuxcnc_root/src/emc/rs274ngc"
|
|
-I "$linuxcnc_root/src/emc/motion"
|
|
-I "$linuxcnc_root/src/emc/pythonplugin"
|
|
-I "$linuxcnc_root/include"
|
|
)
|
|
|
|
while IFS= read -r source; do
|
|
[[ -z "$source" ]] && continue
|
|
# shellcheck disable=SC2086
|
|
"$cxx" "${common_flags[@]}" $python_includes "$source"
|
|
done < "$source_list"
|
|
|
|
echo "linuxcnc rs274 source syntax probe passed"
|