From 856b526acbacce54a3cdde92a951c0617403898d Mon Sep 17 00:00:00 2001 From: cnc Date: Wed, 3 Jun 2026 20:03:43 +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=E3=80=82=E7=A6=81=E6=AD=A2=E9=A1=BA?= =?UTF-8?q?=E6=89=8B=E6=89=A9=E5=8A=9F=E8=83=BD=20smoke?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 结论:补齐 switchkins/remap 表 generator 的 CLI 拒绝守卫,锁住未知选项、缺失 all-output-dir、过多参数和空白输出目录,不新增 CNC 行为或 smoke 功能。 --- test-all-native.sh | 55 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/test-all-native.sh b/test-all-native.sh index c08bcb3..574e0bc 100755 --- a/test-all-native.sh +++ b/test-all-native.sh @@ -43,6 +43,10 @@ switchkins_checker_unknown_option_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_switchki switchkins_checker_too_many_args_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_switchkins_checker_too_many_args.XXXXXX.log") switchkins_cached_missing_cache_dir_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_switchkins_cached_missing_cache_dir.XXXXXX.log") switchkins_cached_whitespace_cache_dir_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_switchkins_cached_whitespace_cache_dir.XXXXXX.log") +switchkins_generator_unknown_option_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_switchkins_generator_unknown_option.XXXXXX.log") +switchkins_generator_missing_output_dir_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_switchkins_generator_missing_output_dir.XXXXXX.log") +switchkins_generator_too_many_args_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_switchkins_generator_too_many_args.XXXXXX.log") +switchkins_generator_whitespace_output_dir_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_switchkins_generator_whitespace_output_dir.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") @@ -84,6 +88,10 @@ cleanup_native_test_temps() { "$switchkins_checker_too_many_args_log" \ "$switchkins_cached_missing_cache_dir_log" \ "$switchkins_cached_whitespace_cache_dir_log" \ + "$switchkins_generator_unknown_option_log" \ + "$switchkins_generator_missing_output_dir_log" \ + "$switchkins_generator_too_many_args_log" \ + "$switchkins_generator_whitespace_output_dir_log" \ "$bad_line_manifest" \ "$bad_line_log" \ "$absolute_source_manifest" \ @@ -209,6 +217,10 @@ for forbidden_manual_cleanup in \ 'rm -f "$switchkins_checker_too_many_args_log"' \ 'rm -f "$switchkins_cached_missing_cache_dir_log"' \ 'rm -f "$switchkins_cached_whitespace_cache_dir_log"' \ + 'rm -f "$switchkins_generator_unknown_option_log"' \ + 'rm -f "$switchkins_generator_missing_output_dir_log"' \ + 'rm -f "$switchkins_generator_too_many_args_log"' \ + 'rm -f "$switchkins_generator_whitespace_output_dir_log"' \ 'rm -f "$bad_line_manifest" "$bad_line_log"' \ 'rm -f "$absolute_source_manifest" "$absolute_source_log"' \ 'rm -f "$invalid_build_jobs_log"' \ @@ -1344,6 +1356,49 @@ if ! grep -F "CNC_SIM_PREFLIGHT_CACHE_DIR must not contain whitespace: build/swi sed -n '1,20p' "$switchkins_cached_whitespace_cache_dir_log" >&2 exit 1 fi +if ./generate-linuxcnc-switchkins-remap-table.sh --unknown >"$switchkins_generator_unknown_option_log" 2>&1; then + echo "switchkins remap table generator accepted an unknown option" >&2 + exit 1 +fi +if ! grep -F "unknown switchkins remap table generator option: --unknown" \ + "$switchkins_generator_unknown_option_log" >/dev/null; then + echo "switchkins remap table generator did not report unknown options clearly" >&2 + sed -n '1,20p' "$switchkins_generator_unknown_option_log" >&2 + exit 1 +fi +if ./generate-linuxcnc-switchkins-remap-table.sh --all-output-dir \ + >"$switchkins_generator_missing_output_dir_log" 2>&1; then + echo "switchkins remap table generator accepted --all-output-dir without a directory" >&2 + exit 1 +fi +if ! grep -F "missing output directory for --all-output-dir" \ + "$switchkins_generator_missing_output_dir_log" >/dev/null; then + echo "switchkins remap table generator did not report missing output directories clearly" >&2 + sed -n '1,20p' "$switchkins_generator_missing_output_dir_log" >&2 + exit 1 +fi +if ./generate-linuxcnc-switchkins-remap-table.sh linuxcnc-kinematics-source-files.txt extra \ + >"$switchkins_generator_too_many_args_log" 2>&1; then + echo "switchkins remap table generator accepted too many arguments" >&2 + exit 1 +fi +if ! grep -F "too many switchkins remap table generator arguments" \ + "$switchkins_generator_too_many_args_log" >/dev/null; then + echo "switchkins remap table generator did not report too many arguments clearly" >&2 + sed -n '1,20p' "$switchkins_generator_too_many_args_log" >&2 + exit 1 +fi +if ./generate-linuxcnc-switchkins-remap-table.sh --all-output-dir "build/switchkins output" \ + linuxcnc-kinematics-source-files.txt >"$switchkins_generator_whitespace_output_dir_log" 2>&1; then + echo "switchkins remap table generator accepted whitespace in output dir" >&2 + exit 1 +fi +if ! grep -F "switchkins remap output directory must not contain whitespace: build/switchkins output" \ + "$switchkins_generator_whitespace_output_dir_log" >/dev/null; then + echo "switchkins remap table generator did not report whitespace output dirs clearly" >&2 + sed -n '1,20p' "$switchkins_generator_whitespace_output_dir_log" >&2 + exit 1 +fi 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