From 2161499b4e6530e6e0579db3a8ed02fd91af67c8 Mon Sep 17 00:00:00 2001 From: Adam0 Date: Sun, 4 Oct 2026 02:10:52 +0200 Subject: [PATCH] Match Xberg CLI tests to enabled features --- pkgs/xberg/default.nix | 3 + pkgs/xberg/feature-gated-cli-help-tests.patch | 91 +++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 pkgs/xberg/feature-gated-cli-help-tests.patch diff --git a/pkgs/xberg/default.nix b/pkgs/xberg/default.nix index 6ea7e5e..af3f242 100644 --- a/pkgs/xberg/default.nix +++ b/pkgs/xberg/default.nix @@ -37,6 +37,9 @@ in hash = "sha256-+nkWIgrLZ7vx4wSOA9We/72cbw7S06wJKPxytAcpQ7s="; }; + # Keep help assertions aligned with the selected CLI feature profile. + patches = [./feature-gated-cli-help-tests.patch]; + # Release archives omit submodules required by the integration tests. postPatch = '' cp -r ${testDocuments}/. test_documents/ diff --git a/pkgs/xberg/feature-gated-cli-help-tests.patch b/pkgs/xberg/feature-gated-cli-help-tests.patch new file mode 100644 index 0000000..0a8fb08 --- /dev/null +++ b/pkgs/xberg/feature-gated-cli-help-tests.patch @@ -0,0 +1,91 @@ +--- a/crates/xberg-cli/tests/commands_test.rs ++++ b/crates/xberg-cli/tests/commands_test.rs +@@ -637,22 +637,36 @@ + let stdout = String::from_utf8_lossy(&output.stdout); + + let expected_flags = [ ++ #[cfg(feature = "ocr-surface")] + "--ocr", ++ #[cfg(feature = "ocr-surface")] + "--ocr-backend", ++ #[cfg(feature = "ocr-surface")] + "--ocr-language", ++ #[cfg(feature = "ocr-surface")] + "--force-ocr", + "--no-cache", ++ #[cfg(feature = "ocr-surface")] + "--ocr-auto-rotate", ++ #[cfg(any(feature = "core-cli", feature = "analysis"))] + "--chunk", ++ #[cfg(any(feature = "core-cli", feature = "analysis"))] + "--chunk-size", ++ #[cfg(any(feature = "core-cli", feature = "analysis"))] + "--chunk-overlap", ++ #[cfg(any(feature = "core-cli", feature = "analysis"))] + "--chunking-tokenizer", + "--content-format", + "--include-structure", ++ #[cfg(feature = "analysis")] + "--quality", ++ #[cfg(feature = "analysis")] + "--detect-language", ++ #[cfg(feature = "layout-detection")] + "--layout", ++ #[cfg(feature = "layout-detection")] + "--layout-confidence", ++ #[cfg(feature = "layout-detection")] + "--layout-table-model", + "--acceleration", + "--max-concurrent", +@@ -661,7 +675,9 @@ + "--page-markers", + "--extract-images", + "--target-dpi", ++ #[cfg(feature = "pdf-surface")] + "--pdf-password", ++ #[cfg(feature = "analysis")] + "--token-reduction", + "--msg-codepage", + ]; +@@ -695,19 +711,31 @@ + let batch_help = String::from_utf8_lossy(&batch_output.stdout); + + let shared_flags = [ ++ #[cfg(feature = "ocr-surface")] + "--ocr", ++ #[cfg(feature = "ocr-surface")] + "--ocr-backend", ++ #[cfg(feature = "ocr-surface")] + "--ocr-language", ++ #[cfg(feature = "ocr-surface")] + "--force-ocr", + "--no-cache", ++ #[cfg(any(feature = "core-cli", feature = "analysis"))] + "--chunk", ++ #[cfg(any(feature = "core-cli", feature = "analysis"))] + "--chunk-size", ++ #[cfg(any(feature = "core-cli", feature = "analysis"))] + "--chunk-overlap", + "--content-format", ++ #[cfg(feature = "analysis")] + "--quality", ++ #[cfg(feature = "analysis")] + "--detect-language", ++ #[cfg(feature = "layout-detection")] + "--layout", ++ #[cfg(feature = "layout-detection")] + "--layout-confidence", ++ #[cfg(feature = "layout-detection")] + "--layout-table-model", + "--acceleration", + "--max-concurrent", +@@ -716,7 +744,9 @@ + "--page-markers", + "--extract-images", + "--target-dpi", ++ #[cfg(feature = "pdf-surface")] + "--pdf-password", ++ #[cfg(feature = "analysis")] + "--token-reduction", + "--msg-codepage", + ]; -- 2.51.2