From 58d8ddbb07cf8253f0164e49277727961f9a49e7 Mon Sep 17 00:00:00 2001 From: luoye-cpu <3412829159@qq.com> Date: Sun, 8 Nov 2026 04:34:17 +0800 Subject: [PATCH 1/2] test(tools): pin user-facing CLI text against golden transcripts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The gap audit (issue #3214, rows C15-01..C15-13) found that the text a user actually reads — the vmaf/vmafx help, --version output, the sidecar usage blocks, and the option-error and geometry-error transcripts — could change without any test noticing. The codegen unit tests shape synthetic fixtures, dnn/test_cli.sh greps three flag strings, and the error-path tests assert exit codes and single substrings; none guards the bytes the built binary serves (ADR-3402). - test_vmaf_cli_text_golden.sh: the vmaf --help transcript, the --version format on both binaries, the vmafx alias behaviour (byte-identical help modulo argv[0]; its own VMAFX precision=max version line), the --width/--precision/--model error transcripts, and the raw-yuv geometry refusals (exit 2, exact sizes in the message). - test_vmaf_roi_vpl_usage.sh: the hand-written vmaf_roi and vmaf_vpl usage blocks; the vpl half skips (exit 77) outside Linux SYCL builds and is verified by the Ubuntu SYCL lanes. - test_vmaf_per_shot.sh: pin per_shot_print_usage() on both its --help (stdout, exit 0) and no-args (stderr, exit 1) paths. Goldens live under core/tools/test/golden/ with argv[0] normalised and \r stripped on both sides (Windows CRT writes CRLF through a pipe); the vpl golden embeds the current VMAF_DEFAULT_MODEL_VERSION value on purpose — a default-model bump regenerates it. A text change is made by consciously regenerating its golden in the same pull request, so the review diff shows the exact user-visible change. ## Deliverables (ADR-0108) - [ ] **Research digest**: no digest needed: the gap is the #3214 audit itself; the transcript pins execute its prescription. - [ ] **Decision matrix**: no alternatives to weigh beyond ADR-3402's recorded ones (codegen idempotency only, heredoc goldens, argv[0]-pinning) — all rejected there with reasons. - [ ] **AGENTS.md invariant note**: no rebase-sensitive invariants: self-contained new test files plus one meson.build registration carry no ordering a rebase could silently break. - [x] **Reproducer / smoke-test command** — `meson test -C build test_vmaf_cli_text_golden test_vmaf_roi_vpl_usage test_vmaf_per_shot` (the golden halves verified against the MinGW build on Windows 11; the vpl half exercises on the Ubuntu SYCL lanes). - [ ] **CHANGELOG fragment**: no changelog entry needed: test-only, no user-discoverable surface change. Closes #3214 rows C15-01, C15-02, C15-03, C15-07, C15-09, C15-10, C15-11, C15-12 and C15-13. C15-08 no longer applies on master: test_vmaf_read_error_exit.sh already greps the user-facing stderr strings ("problem while reading pictures", "ended before"). C15-04/05/06 stay open pending a validation-dependency decision (JSON Schema, XSD and CSV-column validation would introduce dependencies the repo does not carry), and the C15-17..25 rows need a Go toolchain this contribution does not assume. Signed-off-by: luoye-cpu <3412829159@qq.com> --- REUSE.toml | 8 + core/tools/test/golden/vmaf_help.txt | 189 +++++++++++++++ core/tools/test/golden/vmaf_per_shot_help.txt | 18 ++ core/tools/test/golden/vmaf_roi_help.txt | 20 ++ core/tools/test/golden/vmaf_vpl_help.txt | 13 ++ core/tools/test/meson.build | 42 ++++ core/tools/test/test_vmaf_cli_text_golden.sh | 218 ++++++++++++++++++ core/tools/test/test_vmaf_per_shot.sh | 36 +++ core/tools/test/test_vmaf_roi_vpl_usage.sh | 92 ++++++++ docs/adr/3402-cli-text-golden-pins.md | 90 ++++++++ .../3402-cli-text-golden-pins.md | 1 + 11 files changed, 727 insertions(+) create mode 100644 core/tools/test/golden/vmaf_help.txt create mode 100644 core/tools/test/golden/vmaf_per_shot_help.txt create mode 100644 core/tools/test/golden/vmaf_roi_help.txt create mode 100644 core/tools/test/golden/vmaf_vpl_help.txt create mode 100644 core/tools/test/test_vmaf_cli_text_golden.sh create mode 100644 core/tools/test/test_vmaf_roi_vpl_usage.sh create mode 100644 docs/adr/3402-cli-text-golden-pins.md create mode 100644 docs/adr/_index_fragments/3402-cli-text-golden-pins.md diff --git a/REUSE.toml b/REUSE.toml index c2463a40ac..26464b42da 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -9,6 +9,14 @@ precedence = "closest" SPDX-FileCopyrightText = "2026 Lusoris" SPDX-License-Identifier = "EUPL-1.2" +# The CLI golden transcripts (ADR-3402) are diff targets: no inline SPDX +# header may precede the pinned bytes, so their terms are annotated here +# (ADR-3401: outside contributors name themselves as holders). +[[annotations]] +path = ["core/tools/test/golden/*.txt"] +precedence = "override" +SPDX-FileCopyrightText = "2026 luoye-cpu" +SPDX-License-Identifier = "EUPL-1.2" # These six files descend from Netflix/vmaf root files. ADR-1250 requires # inherited work, and every fork contribution to it, to remain on the terms it # already carried rather than being swept into the fork-local EUPL default. diff --git a/core/tools/test/golden/vmaf_help.txt b/core/tools/test/golden/vmaf_help.txt new file mode 100644 index 0000000000..93599e6a07 --- /dev/null +++ b/core/tools/test/golden/vmaf_help.txt @@ -0,0 +1,189 @@ +Usage: [options] + +Supported options: + --reference/-r $path: Reference video: a .y4m file, or raw planar .yuv + together with the width, height, pixel format and + bit depth. + --distorted/-d $path: Distorted video, in the same form as the + reference. + --width/-w $unsigned: Width of raw .yuv input in pixels. + --height/-h $unsigned: Height of raw .yuv input in pixels. + --width_ref $unsigned: Width of the raw .yuv reference in pixels, if it + differs from --width. Only models that scale + their inputs accept different sizes. + --width_dist $unsigned: Width of the raw .yuv distorted video in pixels, + if it differs from --width. Only models that + scale their inputs accept different sizes. + --height_ref $unsigned: Height of the raw .yuv reference in pixels, if it + differs from --height. Only models that scale + their inputs accept different sizes. + --height_dist $unsigned: Height of the raw .yuv distorted video in pixels, + if it differs from --height. Only models that + scale their inputs accept different sizes. + --pixel_format/-p $string: Layout of raw .yuv input: 400 (luma only), 420, + 422 or 444 planar, or a layout of the input + format table (semi-planar, packed, or RGB + converted to Y'CbCr with the rgb_* statement, + ADR-2145, ADR-2146). One of: + 400|420|422|444|nv12|nv16|nv24|p010|p016|p210|p216|p410|p416|yuyv422|uyvy422|v210|y210|y212|xv30|xv36|vuyx|ayuv|yuv444p16msb|rgb|rgba|bgra. + --bitdepth/-b $unsigned: Bits per sample of raw .yuv input, 8 to 16 + (implied by a layout that fixes it). + --check-sample-range, --check_sample_range: + Refuse a frame with a sample above 2^bpc - 1 and + name the plane, row, column and value (ADR-1918). + --color_range_ref $string: Colour range of the reference input. One of: + unknown|limited|full. + --color_range_dist $string: Colour range of the distorted input. One of: + unknown|limited|full. + --color_primaries_ref $string: + Colour primaries of the reference input. One of: + unknown|bt709|bt2020. + --color_primaries_dist $string: + Colour primaries of the distorted input. One of: + unknown|bt709|bt2020. + --color_trc_ref $string: Transfer characteristic of the reference input. + One of: unknown|bt709|smpte2084|pq. + --color_trc_dist $string: Transfer characteristic of the distorted input. + One of: unknown|bt709|smpte2084|pq. + --color_matrix_ref $string: Matrix coefficients of the reference input. One + of: unknown|bt709|bt2020nc|ictcp. + --color_matrix_dist $string: Matrix coefficients of the distorted input. One + of: unknown|bt709|bt2020nc|ictcp. + --rgb_matrix $string: Raw rgb, rgba and bgra input: the Y'CbCr matrix + of the conversion; no default, the input is + refused without it (ADR-2146). One of: + bt601|bt709|bt2020ncl. + --rgb_range $string: Raw RGB input: the range of the R'G'B' samples; + no default. One of: limited|full. + --rgb_transfer $string: Raw RGB input: the transfer characteristic of the + R'G'B' samples (checked, not applied); no + default. One of: bt709|srgb|pq|hlg. + --rgb_out_range $string: Raw RGB input: the range of the Y'CbCr frame + made; limited is the range the VMAF models are + trained on; no default. One of: limited|full. + --model/-m $params: Model, colon-delimited: version= a built-in + model, path= a model file, name= the name in the + report, disable_clip, enable_transform, + .