Files
wasm-simulator/test-all-native.sh

735 lines
47 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")"
manifest=${1:-linuxcnc-rs274-source-files.txt}
linuxcnc_root=${LINUXCNC_ROOT:-../linuxcnc}
missing_root=/tmp/does-not-exist-linuxcnc
missing_root_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_native_missing_root.XXXXXX.log")
missing_manifest=${TMPDIR:-/tmp}/cnc_sim_missing_native_manifest.txt
missing_manifest_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_missing_native_manifest.XXXXXX.log")
unknown_group_manifest=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_native_unknown_manifest_group.XXXXXX.txt")
unknown_group_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_native_unknown_manifest_group.XXXXXX.log")
duplicate_manifest=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_native_duplicate_manifest.XXXXXX.txt")
duplicate_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_native_duplicate_manifest.XXXXXX.log")
unknown_filter_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_native_unknown_manifest_filter.XXXXXX.log")
unknown_output_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_native_unknown_manifest_output.XXXXXX.log")
missing_dump_source_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_missing_rs274_dump_project_source.XXXXXX.log")
missing_api_source_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_missing_rs274_api_project_source.XXXXXX.log")
missing_core_source_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_missing_core_source.XXXXXX.log")
missing_bridge_source_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_missing_bridge_smoke_project_source.XXXXXX.log")
missing_support_object_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_missing_linuxcnc_support_object.XXXXXX.log")
missing_source_manifest=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_native_syntax_missing_source_manifest.XXXXXX.txt")
missing_source_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_native_syntax_missing_source.XXXXXX.log")
bad_line_manifest=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_bad_manifest_line.XXXXXX.txt")
bad_line_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_bad_manifest_line.XXXXXX.log")
absolute_source_manifest=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_absolute_manifest_source.XXXXXX.txt")
absolute_source_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_absolute_manifest_source.XXXXXX.log")
invalid_build_jobs_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_invalid_build_jobs.XXXXXX.log")
invalid_build_dir_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_invalid_build_dir.XXXXXX.log")
empty_build_dir_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_empty_build_dir.XXXXXX.log")
whitespace_build_dir_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_whitespace_build_dir.XXXXXX.log")
cleanup_native_test_temps() {
rm -f \
"$missing_root_log" \
"$missing_manifest" \
"$missing_manifest_log" \
"$unknown_group_manifest" \
"$unknown_group_log" \
"$duplicate_manifest" \
"$duplicate_log" \
"$unknown_filter_log" \
"$unknown_output_log" \
"$missing_dump_source_log" \
"$missing_api_source_log" \
"$missing_core_source_log" \
"$missing_bridge_source_log" \
"$missing_support_object_log" \
"$missing_source_manifest" \
"$missing_source_log" \
"$bad_line_manifest" \
"$bad_line_log" \
"$absolute_source_manifest" \
"$absolute_source_log" \
"$invalid_build_jobs_log" \
"$invalid_build_dir_log" \
"$empty_build_dir_log" \
"$whitespace_build_dir_log"
}
trap cleanup_native_test_temps EXIT
grep -Fx 'trap cleanup_native_test_temps EXIT' test-all-native.sh >/dev/null
if ! awk '
/cleanup_native_test_temps\(\)/ { in_cleanup = 1 }
in_cleanup && index($0, "\"$missing_manifest\"") { found_missing_manifest = 1 }
in_cleanup && /^}/ { in_cleanup = 0 }
END { exit !found_missing_manifest }
' test-all-native.sh; then
echo "native aggregate test cleanup no longer removes fixed missing-manifest path" >&2
exit 1
fi
for forbidden_manual_cleanup in \
'rm -f "$missing_root_log"' \
'rm -f "$missing_manifest_log"' \
'rm -f "$unknown_group_manifest" "$unknown_group_log"' \
'rm -f "$duplicate_manifest" "$duplicate_log"' \
'rm -f "$unknown_filter_log"' \
'rm -f "$unknown_output_log"' \
'rm -f "$missing_dump_source_log"' \
'rm -f "$missing_api_source_log"' \
'rm -f "$missing_core_source_log"' \
'rm -f "$missing_bridge_source_log"' \
'rm -f "$missing_support_object_log"' \
'rm -f "$missing_source_manifest" "$missing_source_log"' \
'rm -f "$bad_line_manifest" "$bad_line_log"' \
'rm -f "$absolute_source_manifest" "$absolute_source_log"' \
'rm -f "$invalid_build_jobs_log"' \
'rm -f "$invalid_build_dir_log"' \
'rm -f "$empty_build_dir_log"' \
'rm -f "$whitespace_build_dir_log"'; do
if grep -Fx "$forbidden_manual_cleanup" test-all-native.sh >/dev/null; then
echo "native aggregate test still relies on manual cleanup: $forbidden_manual_cleanup" >&2
exit 1
fi
done
printf 'core:src/emc/rs274ngc/interp_arc.cc\n' >"$bad_line_manifest"
if ./check-linuxcnc-inputs.sh "$bad_line_manifest" >"$bad_line_log" 2>&1; then
echo "check-linuxcnc-inputs accepted a manifest line without a note" >&2
exit 1
fi
if ! grep -F "bad manifest line 1: core:src/emc/rs274ngc/interp_arc.cc" "$bad_line_log" >/dev/null; then
echo "check-linuxcnc-inputs did not report malformed manifest lines clearly" >&2
sed -n '1,20p' "$bad_line_log" >&2
exit 1
fi
printf 'core:/src/emc/rs274ngc/interp_arc.cc:absolute source path\n' >"$absolute_source_manifest"
if ./check-linuxcnc-inputs.sh "$absolute_source_manifest" >"$absolute_source_log" 2>&1; then
echo "check-linuxcnc-inputs accepted an absolute manifest source path" >&2
exit 1
fi
if ! grep -F "manifest source must be LinuxCNC-root relative: /src/emc/rs274ngc/interp_arc.cc" "$absolute_source_log" >/dev/null; then
echo "check-linuxcnc-inputs did not report absolute manifest paths clearly" >&2
sed -n '1,20p' "$absolute_source_log" >&2
exit 1
fi
grep -F 'exec 9>"${TMPDIR:-/tmp}/cnc_sim_rs274_source_link.lock"' test-linuxcnc-source-link.sh >/dev/null
grep -F "flock 9" test-linuxcnc-source-link.sh >/dev/null
grep -F "missing LinuxCNC support object" list-linuxcnc-source-support-objects.sh >/dev/null
grep -F 'echo "$missing_path_message: $path"' list-filtered-existing-paths.sh >/dev/null
grep -F "build LinuxCNC first or set LINUXCNC_ROOT to a built tree" list-linuxcnc-source-support-objects.sh >/dev/null
native_link_flags=$(LINUXCNC_ROOT="$linuxcnc_root" ./list-linuxcnc-native-linkflags.sh)
grep -Fx -- "-L" <<<"$native_link_flags" >/dev/null
grep -Fx -- "$linuxcnc_root/lib" <<<"$native_link_flags" >/dev/null
grep -Fx -- "-Wl,-rpath,$linuxcnc_root/lib" <<<"$native_link_flags" >/dev/null
grep -F 'exec 9>"${TMPDIR:-/tmp}/cnc_sim_linuxcnc_rs274_native.lock"' test-linuxcnc-rs274-native.sh >/dev/null
grep -F "flock 9" test-linuxcnc-rs274-native.sh >/dev/null
for build_dir_probe_script in \
test-linuxcnc-source-objects.sh \
test-linuxcnc-bridge-native.sh \
test-linuxcnc-rs274-native.sh \
test-linuxcnc-api-native.sh; do
if ! awk '
index($0, "trap '\''rm -rf \"$build_dir\"'\'' EXIT") { trap_line = NR }
index($0, "./check-linuxcnc-inputs.sh") && !check_line { check_line = NR }
END { exit !(trap_line && check_line && trap_line < check_line) }
' "$build_dir_probe_script"; then
echo "$build_dir_probe_script installs build_dir cleanup after input validation" >&2
exit 1
fi
done
if ! awk '
/cleanup_wasm_cmake_probe_temps\(\)/ { in_cleanup = 1 }
in_cleanup && index($0, "\"$build_dir\"") { found_build_dir = 1 }
in_cleanup && /^}/ { in_cleanup = 0 }
END { exit found_build_dir }
' test-linuxcnc-wasm-cmake-safe-probe.sh; then
echo "wasm CMake safe probe cleanup no longer removes its persistent build dir" >&2
exit 1
fi
grep -F 'build_dir=${CNC_SIM_SOURCE_LINK_BUILD_DIR-build/source-link-test}' test-linuxcnc-source-link.sh >/dev/null
grep -F 'CNC_SIM_SOURCE_LINK_BUILD_DIR must not be empty' test-linuxcnc-source-link.sh >/dev/null
grep -F 'CNC_SIM_SOURCE_LINK_BUILD_DIR must not contain whitespace: $build_dir' test-linuxcnc-source-link.sh >/dev/null
grep -F 'CNC_SIM_SOURCE_LINK_BUILD_DIR must not be the filesystem root' test-linuxcnc-source-link.sh >/dev/null
grep -F 'CNC_SIM_BUILD_JOBS must be a positive integer: $build_jobs' test-linuxcnc-source-link.sh >/dev/null
grep -F 'exec 9>"${TMPDIR:-/tmp}/cnc_sim_rs274_source_link.lock"' test-linuxcnc-source-link.sh >/dev/null
grep -F 'source_link_signature="$build_dir/source-link-build.signature"' test-linuxcnc-source-link.sh >/dev/null
grep -F 'if [[ ! -f "$source_link_signature" ]] || ! cmp -s "$source_link_signature" "$source_link_next_signature"; then' test-linuxcnc-source-link.sh >/dev/null
grep -F 'printf '\''PWD=%s\n'\'' "$PWD"' test-linuxcnc-source-link.sh >/dev/null
grep -F 'printf '\''LINUXCNC_ROOT=%s\n'\'' "$(cd "$linuxcnc_root" && pwd)"' test-linuxcnc-source-link.sh >/dev/null
grep -F 'printf '\''%s: %s\n'\'' "$build_dir/linuxcnc_${linuxcnc_index}.o" "$source"' test-linuxcnc-source-link.sh >/dev/null
grep -F 'printf '\''%s: %s\n'\'' "$build_dir/project_${project_index}.o" "$source"' test-linuxcnc-source-link.sh >/dev/null
grep -F 'printf '\''\t@$(CXX) $(COMMON_FLAGS) -MMD -MP -MF %s.d -c %s -o %s\n\n'\''' test-linuxcnc-source-link.sh >/dev/null
grep -F 'build_dir=${CNC_SIM_NATIVE_BUILD_DIR-build/native-test}' test-native.sh >/dev/null
grep -F 'CNC_SIM_NATIVE_BUILD_DIR must not be empty' test-native.sh >/dev/null
grep -F 'CNC_SIM_NATIVE_BUILD_DIR must not contain whitespace: $build_dir' test-native.sh >/dev/null
grep -F 'CNC_SIM_NATIVE_BUILD_DIR must not be the filesystem root' test-native.sh >/dev/null
grep -F 'CNC_SIM_BUILD_JOBS must be a positive integer: $build_jobs' test-native.sh >/dev/null
grep -F 'exec 9>"$build_dir/native-test.lock"' test-native.sh >/dev/null
grep -F 'native_signature="$build_dir/native-build.signature"' test-native.sh >/dev/null
grep -F 'if [[ ! -f "$native_signature" ]] || ! cmp -s "$native_signature" "$native_next_signature"; then' test-native.sh >/dev/null
grep -F 'printf '\''PWD=%s\n'\'' "$PWD"' test-native.sh >/dev/null
grep -F 'printf '\''%s: %s\n'\'' "${core_objects[$core_index]}" "$source"' test-native.sh >/dev/null
grep -F 'printf '\''\t@$(CXX) $(SMOKE_CXXFLAGS) -MMD -MP -MF %s.d -c %s -o %s\n\n'\''' test-native.sh >/dev/null
grep -F 'build_dir=${CNC_SIM_SOURCE_SYNTAX_BUILD_DIR-build/source-syntax-test}' test-linuxcnc-source-syntax.sh >/dev/null
grep -F 'CNC_SIM_SOURCE_SYNTAX_BUILD_DIR must not be empty' test-linuxcnc-source-syntax.sh >/dev/null
grep -F 'CNC_SIM_SOURCE_SYNTAX_BUILD_DIR must not contain whitespace: $build_dir' test-linuxcnc-source-syntax.sh >/dev/null
grep -F 'CNC_SIM_SOURCE_SYNTAX_BUILD_DIR must not be the filesystem root' test-linuxcnc-source-syntax.sh >/dev/null
grep -F 'CNC_SIM_BUILD_JOBS must be a positive integer: $build_jobs' test-linuxcnc-source-syntax.sh >/dev/null
grep -F 'exec 9>"$build_dir/source-syntax.lock"' test-linuxcnc-source-syntax.sh >/dev/null
grep -F 'source_list="$build_dir/linuxcnc_source_syntax_sources.txt"' test-linuxcnc-source-syntax.sh >/dev/null
grep -F 'source_syntax_signature="$build_dir/source-syntax.signature"' test-linuxcnc-source-syntax.sh >/dev/null
grep -F 'if [[ ! -f "$source_syntax_signature" ]] || ! cmp -s "$source_syntax_signature" "$source_syntax_next_signature"; then' test-linuxcnc-source-syntax.sh >/dev/null
grep -F 'printf '\''LINUXCNC_ROOT=%s\n'\'' "$(cd "$linuxcnc_root" && pwd)"' test-linuxcnc-source-syntax.sh >/dev/null
grep -F 'printf '\''MANIFEST=%s\n'\'' "$(cd "$(dirname "$manifest")" && pwd)/$(basename "$manifest")"' test-linuxcnc-source-syntax.sh >/dev/null
grep -F 'printf '\''BUILD_JOBS=%s\n'\'' "$build_jobs"' test-linuxcnc-source-syntax.sh >/dev/null
grep -F 'printf '\''%s/source_%s.stamp: %s\n'\'' "$build_dir" "$source_index" "$source"' test-linuxcnc-source-syntax.sh >/dev/null
grep -F 'printf '\''\t@$(CXX) $(COMMON_FLAGS) -MMD -MP -MF %s/source_%s.d %s\n'\''' test-linuxcnc-source-syntax.sh >/dev/null
grep -F 'make --output-sync=target -j"$build_jobs" -f "$source_syntax_makefile"' test-linuxcnc-source-syntax.sh >/dev/null
grep -F 'build_jobs=${CNC_SIM_BUILD_JOBS:-8}' build-wasm.sh >/dev/null
grep -F 'CNC_SIM_BUILD_JOBS must be a positive integer: $build_jobs' build-wasm.sh >/dev/null
grep -F 'cmake --build build/wasm --target cnc_sim_wasm_runtime_probe --parallel "$build_jobs"' build-wasm.sh >/dev/null
grep -F 'cmake --build build/wasm --target cnc_sim_wasm --parallel "$build_jobs"' build-wasm.sh >/dev/null
grep -F 'build_jobs=${CNC_SIM_BUILD_JOBS:-8}' test-linuxcnc-wasm-cmake-safe-probe.sh >/dev/null
grep -F 'CNC_SIM_BUILD_JOBS must be a positive integer: $build_jobs' test-linuxcnc-wasm-cmake-safe-probe.sh >/dev/null
grep -F 'build_dir=${CNC_SIM_WASM_CMAKE_SAFE_PROBE_BUILD_DIR-build/wasm-cmake-safe-probe}' test-linuxcnc-wasm-cmake-safe-probe.sh >/dev/null
grep -F 'CNC_SIM_WASM_CMAKE_SAFE_PROBE_BUILD_DIR must not be empty' test-linuxcnc-wasm-cmake-safe-probe.sh >/dev/null
grep -F 'CNC_SIM_WASM_CMAKE_SAFE_PROBE_BUILD_DIR must not contain whitespace: $build_dir' test-linuxcnc-wasm-cmake-safe-probe.sh >/dev/null
grep -F 'CNC_SIM_WASM_CMAKE_SAFE_PROBE_BUILD_DIR must not be the filesystem root' test-linuxcnc-wasm-cmake-safe-probe.sh >/dev/null
grep -F 'build_signature="$build_dir/wasm-cmake-safe-probe.signature"' test-linuxcnc-wasm-cmake-safe-probe.sh >/dev/null
grep -F 'build_next_signature=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_wasm_cmake_safe_probe.signature.XXXXXX")' test-linuxcnc-wasm-cmake-safe-probe.sh >/dev/null
grep -F 'if [[ ! -f "$build_signature" ]] || ! cmp -s "$build_signature" "$build_next_signature"; then' test-linuxcnc-wasm-cmake-safe-probe.sh >/dev/null
grep -F 'printf '\''LINUXCNC_ROOT=%s\n'\'' "$linuxcnc_root"' test-linuxcnc-wasm-cmake-safe-probe.sh >/dev/null
grep -F 'printf '\''MANIFEST=%s\n'\'' "$manifest"' test-linuxcnc-wasm-cmake-safe-probe.sh >/dev/null
grep -F 'printf '\''BUILD_JOBS=%s\n'\'' "$build_jobs"' test-linuxcnc-wasm-cmake-safe-probe.sh >/dev/null
grep -F 'cmake --build "$build_dir" --target linuxcnc_rs274_wasm_safe_probe_objects --parallel "$build_jobs"' test-linuxcnc-wasm-cmake-safe-probe.sh >/dev/null
grep -F 'cmake --build "$build_dir" --target linuxcnc_rs274_wasm_safe_probe --parallel "$build_jobs"' test-linuxcnc-wasm-cmake-safe-probe.sh >/dev/null
grep -F 'cmake --build "$build_dir" --target cnc_sim_wasm_runtime_probe --parallel "$build_jobs"' test-linuxcnc-wasm-cmake-safe-probe.sh >/dev/null
grep -F 'CNC_SIM_NATIVE_BUILD_DIR' docs/linuxcnc-source-policy.md >/dev/null
grep -F 'CNC_SIM_SOURCE_LINK_BUILD_DIR' docs/linuxcnc-source-policy.md >/dev/null
grep -F 'CNC_SIM_SOURCE_SYNTAX_BUILD_DIR' docs/linuxcnc-source-policy.md >/dev/null
grep -F 'CNC_SIM_WASM_CMAKE_SAFE_PROBE_BUILD_DIR' docs/linuxcnc-source-policy.md >/dev/null
grep -F 'Build directory overrides must' docs/linuxcnc-source-policy.md >/dev/null
grep -F 'copies and byte-compares `cnc_sim.js` and `cnc_sim.wasm` under' docs/linuxcnc-source-policy.md >/dev/null
grep -F '`CNC_SIM_BUILD_JOBS` must be a positive integer and defaults to `8`.' docs/linuxcnc-source-policy.md >/dev/null
grep -F '`test-native.sh` uses persistent `build/native-test` objects' docs/linuxcnc-source-policy.md >/dev/null
grep -F '`test-linuxcnc-source-link.sh` uses persistent `build/source-link-test`' docs/linuxcnc-source-policy.md >/dev/null
grep -F '`test-linuxcnc-source-syntax.sh` uses persistent' docs/linuxcnc-source-policy.md >/dev/null
grep -F '`test-linuxcnc-wasm-cmake-safe-probe.sh` uses persistent' docs/linuxcnc-source-policy.md >/dev/null
grep -F 'must reject empty, whitespace-containing, or filesystem-root build' docs/linuxcnc-source-policy.md >/dev/null
grep -F 'entry points must serialize' docs/linuxcnc-source-policy.md >/dev/null
grep -F 'shared non-concurrency-safe paths with lock files' docs/linuxcnc-source-policy.md >/dev/null
grep -F '`-MMD -MP` dependency tracking and `make --output-sync=target`' docs/linuxcnc-source-policy.md >/dev/null
grep -F 'must run blocker, syntax, object, CMake, tooldata,' docs/linuxcnc-source-policy.md >/dev/null
grep -F 'must check `cmake`, `emcmake`, `emcc`, and `node`' docs/linuxcnc-source-policy.md >/dev/null
grep -F 'must build `cnc_sim_wasm_runtime_probe` before' docs/linuxcnc-source-policy.md >/dev/null
grep -F 'must copy `build/wasm/cnc_sim.js` and' docs/linuxcnc-source-policy.md >/dev/null
grep -F 'must compare copied artifacts with `cmp -s` before running' docs/linuxcnc-source-policy.md >/dev/null
grep -F 'must run the Node smoke before the browser smoke' docs/linuxcnc-source-policy.md >/dev/null
grep -F 'explicitly checked for 25' docs/linuxcnc-source-policy.md >/dev/null
grep -F 'wasm-safe core sources and 9 blocked sources' docs/linuxcnc-source-policy.md >/dev/null
grep -F 'must reject malformed lines, absolute source paths,' docs/linuxcnc-source-policy.md >/dev/null
grep -F 'must include the built LinuxCNC `lib` path and rpath' docs/linuxcnc-source-policy.md >/dev/null
grep -F 'must surface helper failures instead of hiding them' docs/linuxcnc-source-policy.md >/dev/null
grep -F 'Temporary probe reports must be cleaned on failure' docs/linuxcnc-source-policy.md >/dev/null
grep -F 'Documentation-only build policy edits should still update the guardrail' docs/linuxcnc-source-policy.md >/dev/null
grep -F 'python_include_output=$(python3.13-config --includes 2>/dev/null || python3-config --includes)' list-linuxcnc-source-common-cxxflags.sh >/dev/null
if grep -F 'read -r -a python_includes <<<"$(' list-linuxcnc-source-common-cxxflags.sh >/dev/null; then
echo "source common cxxflags still hides python-config failures behind read" >&2
exit 1
fi
for script in test-native.sh test-linuxcnc-source-syntax.sh test-linuxcnc-source-link.sh build-wasm.sh; do
if CNC_SIM_BUILD_JOBS=0 "./$script" >"$invalid_build_jobs_log" 2>&1; then
echo "$script accepted invalid CNC_SIM_BUILD_JOBS" >&2
exit 1
fi
if ! grep -F "CNC_SIM_BUILD_JOBS must be a positive integer: 0" "$invalid_build_jobs_log" >/dev/null; then
echo "$script did not report invalid CNC_SIM_BUILD_JOBS clearly" >&2
sed -n '1,20p' "$invalid_build_jobs_log" >&2
exit 1
fi
done
if CNC_SIM_BUILD_JOBS=0 ./test-linuxcnc-wasm-cmake-safe-probe.sh >"$invalid_build_jobs_log" 2>&1; then
echo "test-linuxcnc-wasm-cmake-safe-probe.sh accepted invalid CNC_SIM_BUILD_JOBS" >&2
exit 1
fi
if ! grep -F "CNC_SIM_BUILD_JOBS must be a positive integer: 0" "$invalid_build_jobs_log" >/dev/null; then
echo "test-linuxcnc-wasm-cmake-safe-probe.sh did not report invalid CNC_SIM_BUILD_JOBS clearly" >&2
sed -n '1,20p' "$invalid_build_jobs_log" >&2
exit 1
fi
if CNC_SIM_WASM_CMAKE_SAFE_PROBE_BUILD_DIR=/ ./test-linuxcnc-wasm-cmake-safe-probe.sh >"$invalid_build_dir_log" 2>&1; then
echo "test-linuxcnc-wasm-cmake-safe-probe.sh accepted filesystem root as build dir" >&2
exit 1
fi
if ! grep -F "CNC_SIM_WASM_CMAKE_SAFE_PROBE_BUILD_DIR must not be the filesystem root" "$invalid_build_dir_log" >/dev/null; then
echo "test-linuxcnc-wasm-cmake-safe-probe.sh did not report filesystem-root build dir clearly" >&2
sed -n '1,20p' "$invalid_build_dir_log" >&2
exit 1
fi
if CNC_SIM_WASM_CMAKE_SAFE_PROBE_BUILD_DIR= ./test-linuxcnc-wasm-cmake-safe-probe.sh >"$empty_build_dir_log" 2>&1; then
echo "test-linuxcnc-wasm-cmake-safe-probe.sh accepted empty build dir" >&2
exit 1
fi
if ! grep -F "CNC_SIM_WASM_CMAKE_SAFE_PROBE_BUILD_DIR must not be empty" "$empty_build_dir_log" >/dev/null; then
echo "test-linuxcnc-wasm-cmake-safe-probe.sh did not report empty build dir clearly" >&2
sed -n '1,20p' "$empty_build_dir_log" >&2
exit 1
fi
if CNC_SIM_WASM_CMAKE_SAFE_PROBE_BUILD_DIR="build/wasm safe probe" ./test-linuxcnc-wasm-cmake-safe-probe.sh >"$whitespace_build_dir_log" 2>&1; then
echo "test-linuxcnc-wasm-cmake-safe-probe.sh accepted whitespace in build dir" >&2
exit 1
fi
if ! grep -F "CNC_SIM_WASM_CMAKE_SAFE_PROBE_BUILD_DIR must not contain whitespace: build/wasm safe probe" "$whitespace_build_dir_log" >/dev/null; then
echo "test-linuxcnc-wasm-cmake-safe-probe.sh did not report whitespace build dir clearly" >&2
sed -n '1,20p' "$whitespace_build_dir_log" >&2
exit 1
fi
if CNC_SIM_NATIVE_BUILD_DIR=/ ./test-native.sh >"$invalid_build_dir_log" 2>&1; then
echo "test-native.sh accepted filesystem root as build dir" >&2
exit 1
fi
if ! grep -F "CNC_SIM_NATIVE_BUILD_DIR must not be the filesystem root" "$invalid_build_dir_log" >/dev/null; then
echo "test-native.sh did not report filesystem-root build dir clearly" >&2
sed -n '1,20p' "$invalid_build_dir_log" >&2
exit 1
fi
if CNC_SIM_NATIVE_BUILD_DIR=/tmp/.. ./test-native.sh >"$invalid_build_dir_log" 2>&1; then
echo "test-native.sh accepted canonical filesystem root as build dir" >&2
exit 1
fi
if ! grep -F "CNC_SIM_NATIVE_BUILD_DIR must not be the filesystem root" "$invalid_build_dir_log" >/dev/null; then
echo "test-native.sh did not report canonical filesystem-root build dir clearly" >&2
sed -n '1,20p' "$invalid_build_dir_log" >&2
exit 1
fi
if CNC_SIM_NATIVE_BUILD_DIR= ./test-native.sh >"$empty_build_dir_log" 2>&1; then
echo "test-native.sh accepted empty build dir" >&2
exit 1
fi
if ! grep -F "CNC_SIM_NATIVE_BUILD_DIR must not be empty" "$empty_build_dir_log" >/dev/null; then
echo "test-native.sh did not report empty build dir clearly" >&2
sed -n '1,20p' "$empty_build_dir_log" >&2
exit 1
fi
if CNC_SIM_NATIVE_BUILD_DIR="build/native test" ./test-native.sh >"$whitespace_build_dir_log" 2>&1; then
echo "test-native.sh accepted whitespace in build dir" >&2
exit 1
fi
if ! grep -F "CNC_SIM_NATIVE_BUILD_DIR must not contain whitespace: build/native test" "$whitespace_build_dir_log" >/dev/null; then
echo "test-native.sh did not report whitespace build dir clearly" >&2
sed -n '1,20p' "$whitespace_build_dir_log" >&2
exit 1
fi
if CNC_SIM_SOURCE_SYNTAX_BUILD_DIR=/ ./test-linuxcnc-source-syntax.sh >"$invalid_build_dir_log" 2>&1; then
echo "test-linuxcnc-source-syntax.sh accepted filesystem root as build dir" >&2
exit 1
fi
if ! grep -F "CNC_SIM_SOURCE_SYNTAX_BUILD_DIR must not be the filesystem root" "$invalid_build_dir_log" >/dev/null; then
echo "test-linuxcnc-source-syntax.sh did not report filesystem-root build dir clearly" >&2
sed -n '1,20p' "$invalid_build_dir_log" >&2
exit 1
fi
if CNC_SIM_SOURCE_SYNTAX_BUILD_DIR=/tmp/.. ./test-linuxcnc-source-syntax.sh >"$invalid_build_dir_log" 2>&1; then
echo "test-linuxcnc-source-syntax.sh accepted canonical filesystem root as build dir" >&2
exit 1
fi
if ! grep -F "CNC_SIM_SOURCE_SYNTAX_BUILD_DIR must not be the filesystem root" "$invalid_build_dir_log" >/dev/null; then
echo "test-linuxcnc-source-syntax.sh did not report canonical filesystem-root build dir clearly" >&2
sed -n '1,20p' "$invalid_build_dir_log" >&2
exit 1
fi
if CNC_SIM_SOURCE_SYNTAX_BUILD_DIR= ./test-linuxcnc-source-syntax.sh >"$empty_build_dir_log" 2>&1; then
echo "test-linuxcnc-source-syntax.sh accepted empty build dir" >&2
exit 1
fi
if ! grep -F "CNC_SIM_SOURCE_SYNTAX_BUILD_DIR must not be empty" "$empty_build_dir_log" >/dev/null; then
echo "test-linuxcnc-source-syntax.sh did not report empty build dir clearly" >&2
sed -n '1,20p' "$empty_build_dir_log" >&2
exit 1
fi
if CNC_SIM_SOURCE_SYNTAX_BUILD_DIR="build/source syntax test" ./test-linuxcnc-source-syntax.sh >"$whitespace_build_dir_log" 2>&1; then
echo "test-linuxcnc-source-syntax.sh accepted whitespace in build dir" >&2
exit 1
fi
if ! grep -F "CNC_SIM_SOURCE_SYNTAX_BUILD_DIR must not contain whitespace: build/source syntax test" "$whitespace_build_dir_log" >/dev/null; then
echo "test-linuxcnc-source-syntax.sh did not report whitespace build dir clearly" >&2
sed -n '1,20p' "$whitespace_build_dir_log" >&2
exit 1
fi
if CNC_SIM_SOURCE_LINK_BUILD_DIR=/ ./test-linuxcnc-source-link.sh >"$invalid_build_dir_log" 2>&1; then
echo "test-linuxcnc-source-link.sh accepted filesystem root as build dir" >&2
exit 1
fi
if ! grep -F "CNC_SIM_SOURCE_LINK_BUILD_DIR must not be the filesystem root" "$invalid_build_dir_log" >/dev/null; then
echo "test-linuxcnc-source-link.sh did not report filesystem-root build dir clearly" >&2
sed -n '1,20p' "$invalid_build_dir_log" >&2
exit 1
fi
if CNC_SIM_SOURCE_LINK_BUILD_DIR=/tmp/.. ./test-linuxcnc-source-link.sh >"$invalid_build_dir_log" 2>&1; then
echo "test-linuxcnc-source-link.sh accepted canonical filesystem root as build dir" >&2
exit 1
fi
if ! grep -F "CNC_SIM_SOURCE_LINK_BUILD_DIR must not be the filesystem root" "$invalid_build_dir_log" >/dev/null; then
echo "test-linuxcnc-source-link.sh did not report canonical filesystem-root build dir clearly" >&2
sed -n '1,20p' "$invalid_build_dir_log" >&2
exit 1
fi
if CNC_SIM_SOURCE_LINK_BUILD_DIR= ./test-linuxcnc-source-link.sh >"$empty_build_dir_log" 2>&1; then
echo "test-linuxcnc-source-link.sh accepted empty build dir" >&2
exit 1
fi
if ! grep -F "CNC_SIM_SOURCE_LINK_BUILD_DIR must not be empty" "$empty_build_dir_log" >/dev/null; then
echo "test-linuxcnc-source-link.sh did not report empty build dir clearly" >&2
sed -n '1,20p' "$empty_build_dir_log" >&2
exit 1
fi
if CNC_SIM_SOURCE_LINK_BUILD_DIR="build/source link test" ./test-linuxcnc-source-link.sh >"$whitespace_build_dir_log" 2>&1; then
echo "test-linuxcnc-source-link.sh accepted whitespace in build dir" >&2
exit 1
fi
if ! grep -F "CNC_SIM_SOURCE_LINK_BUILD_DIR must not contain whitespace: build/source link test" "$whitespace_build_dir_log" >/dev/null; then
echo "test-linuxcnc-source-link.sh did not report whitespace build dir clearly" >&2
sed -n '1,20p' "$whitespace_build_dir_log" >&2
exit 1
fi
forbidden_common_flags_process_substitution='readarray -t common_flags < <('
forbidden_link_flags_process_substitution='readarray -t link_flags < <('
forbidden_source_common_flags_helper='./list-linuxcnc-source-common-cxxflags.sh'
forbidden_native_link_flags_helper='./list-linuxcnc-native-linkflags.sh'
if grep -RInF "${forbidden_common_flags_process_substitution}LINUXCNC_ROOT=\"\$linuxcnc_root\" ${forbidden_source_common_flags_helper}" test-linuxcnc-*.sh >/dev/null; then
echo "native probes still read source common flags through process substitution" >&2
grep -RInF "${forbidden_common_flags_process_substitution}LINUXCNC_ROOT=\"\$linuxcnc_root\" ${forbidden_source_common_flags_helper}" test-linuxcnc-*.sh >&2
exit 1
fi
if grep -RInF "${forbidden_link_flags_process_substitution}LINUXCNC_ROOT=\"\$linuxcnc_root\" ${forbidden_native_link_flags_helper}" test-linuxcnc-*.sh >/dev/null; then
echo "native probes still read link flags through process substitution" >&2
grep -RInF "${forbidden_link_flags_process_substitution}LINUXCNC_ROOT=\"\$linuxcnc_root\" ${forbidden_native_link_flags_helper}" test-linuxcnc-*.sh >&2
exit 1
fi
syntax_only_source_common_flags=$(LINUXCNC_ROOT="$linuxcnc_root" ./list-linuxcnc-source-common-cxxflags.sh --syntax-only)
grep -Fx -- "-fsyntax-only" <<<"$syntax_only_source_common_flags" >/dev/null
grep -Fx -- "-fpermissive" <<<"$syntax_only_source_common_flags" >/dev/null
core_include_source_common_flags=$(LINUXCNC_ROOT="$linuxcnc_root" ./list-linuxcnc-source-common-cxxflags.sh --core-include)
grep -Fx -- "-I" <<<"$core_include_source_common_flags" >/dev/null
grep -Fx -- "core/include" <<<"$core_include_source_common_flags" >/dev/null
python_source_common_flags=$(LINUXCNC_ROOT="$linuxcnc_root" ./list-linuxcnc-source-common-cxxflags.sh --python)
grep -F "include/python" <<<"$python_source_common_flags" >/dev/null
no_ulapi_source_common_flags=$(LINUXCNC_ROOT="$linuxcnc_root" ./list-linuxcnc-source-common-cxxflags.sh --no-ulapi)
if grep -Fx -- "-DULAPI" <<<"$no_ulapi_source_common_flags" >/dev/null; then
echo "source common cxxflags emitted ULAPI with --no-ulapi" >&2
exit 1
fi
grep -F "CNC_SIM_ENABLE_LINUXCNC_RS274_BACKEND is native-only; it links LinuxCNC librs274" core/CMakeLists.txt >/dev/null
grep -F "Set CNC_SIM_LINUXCNC_ROOT to the LinuxCNC source root" core/CMakeLists.txt >/dev/null
grep -F "find_package(Python3 REQUIRED COMPONENTS Development)" core/CMakeLists.txt >/dev/null
grep -F "target_compile_definitions(cnc_sim_objects" core/CMakeLists.txt >/dev/null
grep -F "CNC_SIM_ENABLE_LINUXCNC_RS274_BACKEND" core/CMakeLists.txt >/dev/null
grep -F 'target_link_directories(cnc_sim_core' core/CMakeLists.txt >/dev/null
grep -F "add_executable(cnc_sim_api_linuxcnc_rs274_smoke" core/CMakeLists.txt >/dev/null
grep -F "target_link_libraries(cnc_sim_core" core/CMakeLists.txt >/dev/null
grep -F "rs274" core/CMakeLists.txt >/dev/null
grep -F "tooldata" core/CMakeLists.txt >/dev/null
grep -F "Python3::Python" core/CMakeLists.txt >/dev/null
grep -F '"-Wl,-rpath,${CNC_SIM_LINUXCNC_ROOT}/lib"' core/CMakeLists.txt >/dev/null
grep -F "add_library(cnc_sim_linuxcnc_canon_bridge STATIC" core/CMakeLists.txt >/dev/null
grep -F "target_link_libraries(cnc_sim_linuxcnc_canon_bridge PRIVATE cnc_sim_core tooldata)" core/CMakeLists.txt >/dev/null
grep -F './list-linuxcnc-rs274-dump-project-sources.sh > "$project_source_list"' test-linuxcnc-source-link.sh >/dev/null
grep -F './list-linuxcnc-rs274-dump-project-sources.sh > "$project_source_list"' test-linuxcnc-rs274-native.sh >/dev/null
grep -F './list-linuxcnc-rs274-api-project-sources.sh > "$project_source_list"' test-linuxcnc-api-native.sh >/dev/null
grep -F './list-cnc-sim-core-sources.sh --with-smoke > "$core_source_list"' test-native.sh >/dev/null
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 '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
grep -Fx 'trap cleanup_source_syntax_temps EXIT' test-linuxcnc-source-syntax.sh >/dev/null
if grep -Fx "trap 'rm -f \"\$source_list\" \"\$missing_source_manifest\" \"\$missing_source_log\"' EXIT" test-linuxcnc-source-syntax.sh >/dev/null; then
echo "linuxcnc source syntax probe still relies on manual cleanup for missing-source temporaries" >&2
exit 1
fi
for script in \
test-linuxcnc-source-syntax.sh \
test-linuxcnc-source-objects.sh \
test-linuxcnc-source-link.sh \
test-linuxcnc-bridge-native.sh \
test-linuxcnc-rs274-native.sh \
test-linuxcnc-api-native.sh; do
if LINUXCNC_ROOT="$missing_root" "./$script" >"$missing_root_log" 2>&1; then
echo "$script accepted missing LinuxCNC root: $missing_root" >&2
exit 1
fi
if ! grep -F "missing LinuxCNC root: $missing_root" "$missing_root_log" >/dev/null; then
echo "$script did not report missing LinuxCNC root clearly" >&2
sed -n '1,20p' "$missing_root_log" >&2
exit 1
fi
done
rm -f "$missing_manifest"
for script in \
list-linuxcnc-source-manifest-sources.sh \
test-linuxcnc-source-syntax.sh \
test-linuxcnc-source-objects.sh \
test-linuxcnc-source-link.sh; do
if "./$script" "$missing_manifest" >"$missing_manifest_log" 2>&1; then
echo "$script accepted missing manifest: $missing_manifest" >&2
exit 1
fi
if ! grep -F "missing manifest: $missing_manifest" "$missing_manifest_log" >/dev/null; then
echo "$script did not report missing manifest clearly" >&2
sed -n '1,20p' "$missing_manifest_log" >&2
exit 1
fi
done
printf 'bogus:src/emc/rs274ngc/interp_arc.cc:test unknown group\n' >"$unknown_group_manifest"
for script in \
list-linuxcnc-source-manifest-sources.sh \
test-linuxcnc-source-syntax.sh \
test-linuxcnc-source-objects.sh \
test-linuxcnc-source-link.sh; do
if "./$script" "$unknown_group_manifest" >"$unknown_group_log" 2>&1; then
echo "$script accepted unknown manifest group" >&2
exit 1
fi
if ! grep -F "unknown manifest group: bogus" "$unknown_group_log" >/dev/null; then
echo "$script did not report unknown manifest group clearly" >&2
sed -n '1,20p' "$unknown_group_log" >&2
exit 1
fi
done
printf 'core:src/emc/rs274ngc/interp_arc.cc:test duplicate source\ncore:src/emc/rs274ngc/interp_arc.cc:test duplicate source\n' >"$duplicate_manifest"
for script in \
list-linuxcnc-source-manifest-sources.sh \
test-linuxcnc-source-syntax.sh \
test-linuxcnc-source-objects.sh \
test-linuxcnc-source-link.sh; do
if "./$script" "$duplicate_manifest" >"$duplicate_log" 2>&1; then
echo "$script accepted duplicate manifest source" >&2
exit 1
fi
if ! grep -F "duplicate manifest source: src/emc/rs274ngc/interp_arc.cc" "$duplicate_log" >/dev/null; then
echo "$script did not report duplicate manifest source clearly" >&2
sed -n '1,20p' "$duplicate_log" >&2
exit 1
fi
done
./list-linuxcnc-source-manifest-sources.sh "$manifest" core >/dev/null
native_manifest_core=$(./list-linuxcnc-source-manifest-sources.sh "$manifest" core)
grep -Fx "src/emc/rs274ngc/interp_arc.cc" <<<"$native_manifest_core" >/dev/null
native_manifest_binding=$(./list-linuxcnc-source-manifest-sources.sh "$manifest" binding)
grep -Fx "src/emc/rs274ngc/interpmodule.cc" <<<"$native_manifest_binding" >/dev/null
native_manifest_tooldata=$(./list-linuxcnc-source-manifest-sources.sh "$manifest" tooldata)
grep -Fx "src/emc/tooldata/tooldata_common.cc" <<<"$native_manifest_tooldata" >/dev/null
native_manifest_header=$(./list-linuxcnc-source-manifest-sources.sh "$manifest" header)
grep -Fx "src/emc/rs274ngc/rs274ngc_interp.hh" <<<"$native_manifest_header" >/dev/null
native_manifest_metadata=$(./list-linuxcnc-source-manifest-sources.sh "$manifest" metadata)
grep -Fx "src/emc/rs274ngc/Submakefile" <<<"$native_manifest_metadata" >/dev/null
grep -Fx "src/emc/rs274ngc/meson.build" <<<"$native_manifest_metadata" >/dev/null
rs274ngc_manifest_entries=$(./list-linuxcnc-source-manifest-sources.sh "$manifest" all | grep '^src/emc/rs274ngc/' | sort)
rs274ngc_source_entries=$(find "$linuxcnc_root/src/emc/rs274ngc" -maxdepth 1 -type f -printf 'src/emc/rs274ngc/%f\n' | sort)
if ! diff -u <(printf '%s\n' "$rs274ngc_source_entries") <(printf '%s\n' "$rs274ngc_manifest_entries") >/dev/null; then
echo "native rs274ngc manifest no longer covers the full LinuxCNC source directory" >&2
diff -u <(printf '%s\n' "$rs274ngc_source_entries") <(printf '%s\n' "$rs274ngc_manifest_entries") >&2 || true
exit 1
fi
if grep -E '\.(hh|h)$' <<<"$native_manifest_core" >/dev/null; then
echo "native manifest core compile group includes headers" >&2
exit 1
fi
if ./list-linuxcnc-source-manifest-sources.sh "$manifest" bogus >"$unknown_filter_log" 2>&1; then
echo "native manifest source lister accepted unknown filter" >&2
exit 1
fi
if ! grep -F "unknown manifest source filter: bogus" "$unknown_filter_log" >/dev/null; then
echo "native manifest source lister did not report unknown filter clearly" >&2
sed -n '1,20p' "$unknown_filter_log" >&2
exit 1
fi
if ./list-linuxcnc-source-manifest-sources.sh "$manifest" core bogus >"$unknown_output_log" 2>&1; then
echo "native manifest source lister accepted unknown output mode" >&2
exit 1
fi
if ! grep -F "unknown manifest source output mode: bogus" "$unknown_output_log" >/dev/null; then
echo "native manifest source lister did not report unknown output mode clearly" >&2
sed -n '1,20p' "$unknown_output_log" >&2
exit 1
fi
native_manifest_core_full=$(LINUXCNC_ROOT="$linuxcnc_root" ./list-linuxcnc-source-manifest-sources.sh "$manifest" core full)
grep -Fx "$linuxcnc_root/src/emc/rs274ngc/interp_arc.cc" <<<"$native_manifest_core_full" >/dev/null
kinematics_manifest_config=$(./list-linuxcnc-kinematics-manifest-sources.sh linuxcnc-kinematics-source-files.txt config)
grep -Fx "configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzac-trt.ini" <<<"$kinematics_manifest_config" >/dev/null
grep -Fx "configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzbc-trt.ini" <<<"$kinematics_manifest_config" >/dev/null
grep -Fx "configs/sim/axis/vismach/puma/puma560_dh.hal" <<<"$kinematics_manifest_config" >/dev/null
grep -Fx "HALCMD = sets :x-offset -20" "$linuxcnc_root/configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzbc-trt.ini" >/dev/null
grep -Fx "HALCMD = sets :z-offset -15" "$linuxcnc_root/configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzbc-trt.ini" >/dev/null
grep -Fx "HALCMD = setp xyzbc-trt-kins.x-rot-point 0" "$linuxcnc_root/configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzbc-trt.ini" >/dev/null
grep -Fx "HALCMD = setp xyzbc-trt-kins.conventional-directions 0" "$linuxcnc_root/configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzbc-trt.ini" >/dev/null
grep -Fx "HALCMD = sets :z-offset 10" "$linuxcnc_root/configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzac-trt.ini" >/dev/null
grep -Fx "HALCMD = setp xyzac-trt-kins.conventional-directions 0" "$linuxcnc_root/configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzac-trt.ini" >/dev/null
grep -Fx "setp genserkins.A-2 17" "$linuxcnc_root/configs/sim/axis/vismach/puma/puma560_dh.hal" >/dev/null
grep -Fx "setp genserkins.ALPHA-4 -1.570796326" "$linuxcnc_root/configs/sim/axis/vismach/puma/puma560_dh.hal" >/dev/null
grep -Fx "setp genserkins.D-0 26.45" "$linuxcnc_root/configs/sim/axis/vismach/puma/puma560_dh.hal" >/dev/null
./list-linuxcnc-rs274-dump-project-sources.sh >/dev/null
rs274_dump_source=$(./list-linuxcnc-rs274-dump-project-sources.sh linuxcnc_rs274_dump.cpp)
grep -Fx "core/tools/linuxcnc_rs274_dump.cpp" <<<"$rs274_dump_source" >/dev/null
rs274_dump_corexy_source=$(./list-linuxcnc-rs274-dump-project-sources.sh linuxcnc_corexykins_adapter.cpp)
grep -Fx "core/src/linuxcnc_corexykins_adapter.cpp" <<<"$rs274_dump_corexy_source" >/dev/null
rs274_dump_cubic_source=$(./list-linuxcnc-rs274-dump-project-sources.sh linuxcnc_cubic_adapter.cpp)
grep -Fx "core/src/linuxcnc_cubic_adapter.cpp" <<<"$rs274_dump_cubic_source" >/dev/null
rs274_dump_genhex_source=$(./list-linuxcnc-rs274-dump-project-sources.sh linuxcnc_genhexkins_adapter.cpp)
grep -Fx "core/src/linuxcnc_genhexkins_adapter.cpp" <<<"$rs274_dump_genhex_source" >/dev/null
rs274_dump_lineardelta_source=$(./list-linuxcnc-rs274-dump-project-sources.sh linuxcnc_lineardeltakins_adapter.cpp)
grep -Fx "core/src/linuxcnc_lineardeltakins_adapter.cpp" <<<"$rs274_dump_lineardelta_source" >/dev/null
rs274_dump_rotarydelta_source=$(./list-linuxcnc-rs274-dump-project-sources.sh linuxcnc_rotarydeltakins_adapter.cpp)
grep -Fx "core/src/linuxcnc_rotarydeltakins_adapter.cpp" <<<"$rs274_dump_rotarydelta_source" >/dev/null
rs274_dump_maxkins_source=$(./list-linuxcnc-rs274-dump-project-sources.sh linuxcnc_maxkins_adapter.cpp)
grep -Fx "core/src/linuxcnc_maxkins_adapter.cpp" <<<"$rs274_dump_maxkins_source" >/dev/null
rs274_dump_pentakins_source=$(./list-linuxcnc-rs274-dump-project-sources.sh linuxcnc_pentakins_adapter.cpp)
grep -Fx "core/src/linuxcnc_pentakins_adapter.cpp" <<<"$rs274_dump_pentakins_source" >/dev/null
rs274_dump_rosekins_source=$(./list-linuxcnc-rs274-dump-project-sources.sh linuxcnc_rosekins_adapter.cpp)
grep -Fx "core/src/linuxcnc_rosekins_adapter.cpp" <<<"$rs274_dump_rosekins_source" >/dev/null
rs274_dump_scorbot_source=$(./list-linuxcnc-rs274-dump-project-sources.sh linuxcnc_scorbot_kins_adapter.cpp)
grep -Fx "core/src/linuxcnc_scorbot_kins_adapter.cpp" <<<"$rs274_dump_scorbot_source" >/dev/null
rs274_dump_tripodkins_source=$(./list-linuxcnc-rs274-dump-project-sources.sh linuxcnc_tripodkins_adapter.cpp)
grep -Fx "core/src/linuxcnc_tripodkins_adapter.cpp" <<<"$rs274_dump_tripodkins_source" >/dev/null
if ./list-linuxcnc-rs274-dump-project-sources.sh does_not_exist.cc >"$missing_dump_source_log" 2>&1; then
echo "rs274 dump project source lister accepted missing source filter" >&2
exit 1
fi
if ! grep -F "missing LinuxCNC rs274 dump project source in list: does_not_exist.cc" "$missing_dump_source_log" >/dev/null; then
echo "rs274 dump project source lister did not report missing source filter clearly" >&2
sed -n '1,20p' "$missing_dump_source_log" >&2
exit 1
fi
./list-linuxcnc-rs274-api-project-sources.sh >/dev/null
rs274_api_source=$(./list-linuxcnc-rs274-api-project-sources.sh linuxcnc_rs274_backend.cpp)
grep -Fx "core/src/linuxcnc_rs274_backend.cpp" <<<"$rs274_api_source" >/dev/null
if ./list-linuxcnc-rs274-api-project-sources.sh smoke_gcode_parser.cpp >"$missing_api_source_log" 2>&1; then
echo "rs274 API project source lister included smoke backend source" >&2
exit 1
fi
if ! grep -F "missing LinuxCNC rs274 API project source in CMake list: smoke_gcode_parser.cpp" "$missing_api_source_log" >/dev/null; then
echo "rs274 API project source lister did not exclude smoke backend clearly" >&2
sed -n '1,20p' "$missing_api_source_log" >&2
exit 1
fi
if ./list-linuxcnc-rs274-api-project-sources.sh does_not_exist.cc >"$missing_api_source_log" 2>&1; then
echo "rs274 API project source lister accepted missing source filter" >&2
exit 1
fi
if ! grep -F "missing LinuxCNC rs274 API project source in CMake list: does_not_exist.cc" "$missing_api_source_log" >/dev/null; then
echo "rs274 API project source lister did not report missing source filter clearly" >&2
sed -n '1,20p' "$missing_api_source_log" >&2
exit 1
fi
./list-cnc-sim-core-sources.sh >/dev/null
if ./list-cnc-sim-core-sources.sh smoke_gcode_parser.cpp >"$missing_core_source_log" 2>&1; then
echo "default cnc sim core source lister included smoke backend source" >&2
exit 1
fi
if ! grep -F "missing cnc sim core source in CMake list: smoke_gcode_parser.cpp" "$missing_core_source_log" >/dev/null; then
echo "default cnc sim core source lister did not exclude smoke backend clearly" >&2
sed -n '1,20p' "$missing_core_source_log" >&2
exit 1
fi
cnc_sim_core_source=$(./list-cnc-sim-core-sources.sh --with-smoke smoke_gcode_parser.cpp)
grep -Fx "core/src/smoke_gcode_parser.cpp" <<<"$cnc_sim_core_source" >/dev/null
if ./list-cnc-sim-core-sources.sh does_not_exist.cc >"$missing_core_source_log" 2>&1; then
echo "cnc sim core source lister accepted missing source filter" >&2
exit 1
fi
if ! grep -F "missing cnc sim core source in CMake list: does_not_exist.cc" "$missing_core_source_log" >/dev/null; then
echo "cnc sim core source lister did not report missing source filter clearly" >&2
sed -n '1,20p' "$missing_core_source_log" >&2
exit 1
fi
./list-linuxcnc-bridge-smoke-project-sources.sh >/dev/null
bridge_smoke_source=$(./list-linuxcnc-bridge-smoke-project-sources.sh linuxcnc_canon_bridge.cpp)
grep -Fx "core/src/linuxcnc_canon_bridge.cpp" <<<"$bridge_smoke_source" >/dev/null
bridge_smoke_corexy_source=$(./list-linuxcnc-bridge-smoke-project-sources.sh linuxcnc_corexykins_adapter.cpp)
grep -Fx "core/src/linuxcnc_corexykins_adapter.cpp" <<<"$bridge_smoke_corexy_source" >/dev/null
bridge_smoke_cubic_source=$(./list-linuxcnc-bridge-smoke-project-sources.sh linuxcnc_cubic_adapter.cpp)
grep -Fx "core/src/linuxcnc_cubic_adapter.cpp" <<<"$bridge_smoke_cubic_source" >/dev/null
bridge_smoke_genhex_source=$(./list-linuxcnc-bridge-smoke-project-sources.sh linuxcnc_genhexkins_adapter.cpp)
grep -Fx "core/src/linuxcnc_genhexkins_adapter.cpp" <<<"$bridge_smoke_genhex_source" >/dev/null
bridge_smoke_lineardelta_source=$(./list-linuxcnc-bridge-smoke-project-sources.sh linuxcnc_lineardeltakins_adapter.cpp)
grep -Fx "core/src/linuxcnc_lineardeltakins_adapter.cpp" <<<"$bridge_smoke_lineardelta_source" >/dev/null
bridge_smoke_rotarydelta_source=$(./list-linuxcnc-bridge-smoke-project-sources.sh linuxcnc_rotarydeltakins_adapter.cpp)
grep -Fx "core/src/linuxcnc_rotarydeltakins_adapter.cpp" <<<"$bridge_smoke_rotarydelta_source" >/dev/null
bridge_smoke_maxkins_source=$(./list-linuxcnc-bridge-smoke-project-sources.sh linuxcnc_maxkins_adapter.cpp)
grep -Fx "core/src/linuxcnc_maxkins_adapter.cpp" <<<"$bridge_smoke_maxkins_source" >/dev/null
bridge_smoke_pentakins_source=$(./list-linuxcnc-bridge-smoke-project-sources.sh linuxcnc_pentakins_adapter.cpp)
grep -Fx "core/src/linuxcnc_pentakins_adapter.cpp" <<<"$bridge_smoke_pentakins_source" >/dev/null
bridge_smoke_rosekins_source=$(./list-linuxcnc-bridge-smoke-project-sources.sh linuxcnc_rosekins_adapter.cpp)
grep -Fx "core/src/linuxcnc_rosekins_adapter.cpp" <<<"$bridge_smoke_rosekins_source" >/dev/null
bridge_smoke_scorbot_source=$(./list-linuxcnc-bridge-smoke-project-sources.sh linuxcnc_scorbot_kins_adapter.cpp)
grep -Fx "core/src/linuxcnc_scorbot_kins_adapter.cpp" <<<"$bridge_smoke_scorbot_source" >/dev/null
bridge_smoke_tripodkins_source=$(./list-linuxcnc-bridge-smoke-project-sources.sh linuxcnc_tripodkins_adapter.cpp)
grep -Fx "core/src/linuxcnc_tripodkins_adapter.cpp" <<<"$bridge_smoke_tripodkins_source" >/dev/null
if ./list-linuxcnc-bridge-smoke-project-sources.sh does_not_exist.cc >"$missing_bridge_source_log" 2>&1; then
echo "LinuxCNC bridge smoke project source lister accepted missing source filter" >&2
exit 1
fi
if ! grep -F "missing LinuxCNC bridge smoke project source in list: does_not_exist.cc" "$missing_bridge_source_log" >/dev/null; then
echo "LinuxCNC bridge smoke project source lister did not report missing source filter clearly" >&2
sed -n '1,20p' "$missing_bridge_source_log" >&2
exit 1
fi
LINUXCNC_ROOT="$linuxcnc_root" ./list-linuxcnc-source-support-objects.sh >/dev/null
interpmodule_support_object=$(LINUXCNC_ROOT="$linuxcnc_root" ./list-linuxcnc-source-support-objects.sh interpmodule.o)
grep -F "/src/objects/emc/rs274ngc/interpmodule.o" <<<"$interpmodule_support_object" >/dev/null
if LINUXCNC_ROOT="$missing_root" ./list-linuxcnc-source-support-objects.sh >"$missing_support_object_log" 2>&1; then
echo "LinuxCNC support object lister accepted missing LinuxCNC root: $missing_root" >&2
exit 1
fi
if ! grep -F "missing LinuxCNC root: $missing_root" "$missing_support_object_log" >/dev/null; then
echo "LinuxCNC support object lister did not report missing LinuxCNC root clearly" >&2
sed -n '1,20p' "$missing_support_object_log" >&2
exit 1
fi
if LINUXCNC_ROOT="$linuxcnc_root" ./list-linuxcnc-source-support-objects.sh does_not_exist.o >"$missing_support_object_log" 2>&1; then
echo "LinuxCNC support object lister accepted missing object filter" >&2
exit 1
fi
if ! grep -F "missing LinuxCNC support object in list: does_not_exist.o" "$missing_support_object_log" >/dev/null; then
echo "LinuxCNC support object lister did not report missing object filter clearly" >&2
sed -n '1,20p' "$missing_support_object_log" >&2
exit 1
fi
printf 'core:src/emc/rs274ngc/does_not_exist.cc:test missing source\n' >"$missing_source_manifest"
if ./test-linuxcnc-source-syntax.sh "$missing_source_manifest" >"$missing_source_log" 2>&1; then
echo "test-linuxcnc-source-syntax.sh accepted missing manifest source" >&2
exit 1
fi
if ! grep -F "missing manifest source: src/emc/rs274ngc/does_not_exist.cc" "$missing_source_log" >/dev/null; then
echo "test-linuxcnc-source-syntax.sh did not report missing manifest source clearly" >&2
sed -n '1,20p' "$missing_source_log" >&2
exit 1
fi
./test-native.sh
./test-linuxcnc-source-syntax.sh "$manifest"
./test-linuxcnc-source-objects.sh "$manifest"
./test-linuxcnc-source-link.sh "$manifest"
./test-linuxcnc-bridge-native.sh
./test-linuxcnc-rs274-native.sh
./test-linuxcnc-api-native.sh
echo "all native tests passed"