70 lines
1.9 KiB
Bash
Executable File
70 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
linuxcnc_root=${LINUXCNC_ROOT:-../linuxcnc}
|
|
cxx=${CXX:-g++}
|
|
build_dir=$(mktemp -d "${TMPDIR:-/tmp}/cnc_sim_linuxcnc_wasm_tooldata_mmap_symbols.XXXXXX")
|
|
|
|
if [[ ! -d "$linuxcnc_root" ]]; then
|
|
echo "missing LinuxCNC root: $linuxcnc_root" >&2
|
|
exit 1
|
|
fi
|
|
trap 'rm -rf "$build_dir"' EXIT
|
|
|
|
common_flags=(
|
|
-std=c++17
|
|
-DULAPI
|
|
-I "$(pwd)/core/wasm_shims"
|
|
-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/include"
|
|
)
|
|
|
|
"$cxx" "${common_flags[@]}" \
|
|
-c core/wasm_shims/tooldata/tooldata_mmap_backend.cc \
|
|
-o "$build_dir/tooldata_mmap_backend.o"
|
|
|
|
nm --defined-only "$build_dir/tooldata_mmap_backend.o" \
|
|
| awk '$2 ~ /^[A-Z]$/ {print $3}' \
|
|
| LC_ALL=C sort -u \
|
|
> "$build_dir/backend.exports"
|
|
|
|
expected_exports=(
|
|
tool_mmap_close
|
|
tool_mmap_creator
|
|
tool_mmap_is_random_toolchanger
|
|
tool_mmap_user
|
|
tooldata_find_index_for_tool
|
|
tooldata_get
|
|
tooldata_last_index_get
|
|
tooldata_last_index_set
|
|
tooldata_put
|
|
tooldata_reset
|
|
)
|
|
|
|
printf '%s\n' "${expected_exports[@]}" | LC_ALL=C sort -u > "$build_dir/expected.exports"
|
|
|
|
if ! comm -23 "$build_dir/expected.exports" "$build_dir/backend.exports" > "$build_dir/missing.exports"; then
|
|
exit 1
|
|
fi
|
|
|
|
if [[ -s "$build_dir/missing.exports" ]]; then
|
|
echo "missing wasm tooldata mmap backend exports:" >&2
|
|
cat "$build_dir/missing.exports" >&2
|
|
exit 1
|
|
fi
|
|
|
|
comm -13 "$build_dir/expected.exports" "$build_dir/backend.exports" > "$build_dir/unexpected.exports"
|
|
if [[ -s "$build_dir/unexpected.exports" ]]; then
|
|
echo "unexpected wasm tooldata mmap backend exports:" >&2
|
|
cat "$build_dir/unexpected.exports" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "linuxcnc wasm tooldata_mmap symbol probe passed"
|