From 1ce460d1d5db7744cca2dad70a7bbfdff797be07 Mon Sep 17 00:00:00 2001 From: cnc Date: Wed, 3 Jun 2026 18:36:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=82=E8=80=83=E6=89=80=E6=9C=89=E5=88=86?= =?UTF-8?q?=E7=BB=84=EF=BC=8C=E5=AE=8C=E6=88=90=E5=B0=BD=E9=87=8F=E5=A4=9A?= =?UTF-8?q?=E7=9A=84=E5=86=85=E5=AE=B9=EF=BC=9A=E6=94=B6=E7=B4=A7=20CMake?= =?UTF-8?q?=20=E6=BA=90=E5=88=97=E8=A1=A8=E7=BC=BA=E5=A4=B1=E5=AE=88?= =?UTF-8?q?=E5=8D=AB=EF=BC=8C=E7=BB=93=E8=AE=BA=E6=B5=8B=E8=AF=95=E9=80=9A?= =?UTF-8?q?=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- list-cmake-set-plus-append-sources.sh | 12 ++++++++++++ list-cmake-set-sources.sh | 7 +++++++ test-all-native.sh | 28 +++++++++++++++++++++++++++ 3 files changed, 47 insertions(+) diff --git a/list-cmake-set-plus-append-sources.sh b/list-cmake-set-plus-append-sources.sh index 84cce5a..13140b9 100755 --- a/list-cmake-set-plus-append-sources.sh +++ b/list-cmake-set-plus-append-sources.sh @@ -18,6 +18,7 @@ relative_prefix=${3:-} awk -v set_name="$set_name" -v append_name="$append_name" -v relative_prefix="$relative_prefix" ' $0 ~ "^[[:space:]]*set\\(" set_name "([[:space:]]|$)" { + found_set = 1 in_set = 1 next } @@ -26,6 +27,7 @@ awk -v set_name="$set_name" -v append_name="$append_name" -v relative_prefix="$r next } $0 ~ "^[[:space:]]*list\\(APPEND " append_name "([[:space:]]|$)" { + found_append = 1 in_append = 1 next } @@ -46,4 +48,14 @@ awk -v set_name="$set_name" -v append_name="$append_name" -v relative_prefix="$r } print line } + END { + if (!found_set) { + print "missing CMake source set: " set_name > "/dev/stderr" + exit 1 + } + if (!found_append) { + print "missing CMake append source set: " append_name > "/dev/stderr" + exit 1 + } + } ' core/CMakeLists.txt diff --git a/list-cmake-set-sources.sh b/list-cmake-set-sources.sh index 90b9b8e..e4ba9f4 100755 --- a/list-cmake-set-sources.sh +++ b/list-cmake-set-sources.sh @@ -17,6 +17,7 @@ relative_prefix=${2:-} awk -v set_name="$set_name" -v relative_prefix="$relative_prefix" ' $0 ~ "^[[:space:]]*set\\(" set_name "([[:space:]]|$)" { + found_set = 1 in_list = 1 next } @@ -36,4 +37,10 @@ awk -v set_name="$set_name" -v relative_prefix="$relative_prefix" ' } print line } + END { + if (!found_set) { + print "missing CMake source set: " set_name > "/dev/stderr" + exit 1 + } + } ' core/CMakeLists.txt diff --git a/test-all-native.sh b/test-all-native.sh index ca6d449..bdcb81d 100755 --- a/test-all-native.sh +++ b/test-all-native.sh @@ -29,6 +29,8 @@ missing_api_source_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_missing_rs274_api_proje 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") escaped_project_source_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_escaped_project_source.XXXXXX.log") +missing_cmake_set_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_missing_cmake_set.XXXXXX.log") +missing_cmake_append_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_missing_cmake_append.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") @@ -59,6 +61,8 @@ cleanup_native_test_temps() { "$missing_core_source_log" \ "$missing_bridge_source_log" \ "$escaped_project_source_log" \ + "$missing_cmake_set_log" \ + "$missing_cmake_append_log" \ "$missing_support_object_log" \ "$missing_source_manifest" \ "$missing_source_log" \ @@ -174,6 +178,8 @@ for forbidden_manual_cleanup in \ 'rm -f "$missing_core_source_log"' \ 'rm -f "$missing_bridge_source_log"' \ 'rm -f "$escaped_project_source_log"' \ + 'rm -f "$missing_cmake_set_log"' \ + 'rm -f "$missing_cmake_append_log"' \ 'rm -f "$missing_support_object_log"' \ 'rm -f "$missing_source_manifest" "$missing_source_log"' \ 'rm -f "$kinematics_unknown_filter_log"' \ @@ -214,9 +220,31 @@ 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 'missing CMake source set: " set_name' list-cmake-set-sources.sh >/dev/null +grep -F 'missing CMake append source set: " append_name' list-cmake-set-plus-append-sources.sh >/dev/null grep -F 'echo "$missing_path_message: $path"' list-filtered-existing-paths.sh >/dev/null grep -F 'project source path must stay project-relative: $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 +if ./list-cmake-set-sources.sh does_not_exist_cmake_set >"$missing_cmake_set_log" 2>&1; then + echo "CMake source-set lister accepted a missing set" >&2 + exit 1 +fi +if ! grep -F "missing CMake source set: does_not_exist_cmake_set" "$missing_cmake_set_log" >/dev/null; then + echo "CMake source-set lister did not report missing sets clearly" >&2 + sed -n '1,20p' "$missing_cmake_set_log" >&2 + exit 1 +fi +if ./list-cmake-set-plus-append-sources.sh \ + cnc_sim_core_sources \ + does_not_exist_append_set >"$missing_cmake_append_log" 2>&1; then + echo "combined CMake source-set lister accepted a missing append set" >&2 + exit 1 +fi +if ! grep -F "missing CMake append source set: does_not_exist_append_set" "$missing_cmake_append_log" >/dev/null; then + echo "combined CMake source-set lister did not report missing append sets clearly" >&2 + sed -n '1,20p' "$missing_cmake_append_log" >&2 + exit 1 +fi if printf '../core/src/canon_event_sink.cpp\n' | ./list-filtered-existing-paths.sh \ --project-relative \ "" \