From f01b651dfe9353550f0219ae2ff6b2bcfd1f9874 Mon Sep 17 00:00:00 2001 From: D Hoyt Date: Thu, 3 Sep 2026 14:07:22 -0400 Subject: [PATCH 1/2] test: cover threaded ApplySearch CLI --- .../iccdev-applysearch-cli-args-regression.sh | 38 +++++++++++++++++++ docs/ctest.md | 5 +++ 2 files changed, 43 insertions(+) diff --git a/.github/scripts/iccdev-applysearch-cli-args-regression.sh b/.github/scripts/iccdev-applysearch-cli-args-regression.sh index e0ed9c88d..8c09f345d 100755 --- a/.github/scripts/iccdev-applysearch-cli-args-regression.sh +++ b/.github/scripts/iccdev-applysearch-cli-args-regression.sh @@ -48,6 +48,7 @@ APPLY="$(find "$TOOLS_DIR" -maxdepth 2 -name iccApplySearch -type f 2>/dev/null DATA="$TESTING_DIR/ApplyDataFiles/rgb8bit.txt" SRGB="$TESTING_DIR/sRGB_v4_ICC_preference.icc" CFG="$OUTDIR/applysearch-cfg.json" +THREADED_DATA="$OUTDIR/rgb8bit-threaded.txt" fail() { echo " [FAIL] iccApplySearch-cli-args -- $1" @@ -147,9 +148,46 @@ require_file "$CFG" run_expect_success valid-cfg "$APPLY" -cfg "$CFG" run_expect_success valid-legacy "$APPLY" "$DATA" 0 0 "$SRGB" 1 "$SRGB" 1 -INIT 1 +# Repeat the tracked 16-row input until the batch is strictly larger than the +# 1,024-pixel bulk threshold. This makes all eight requested workers useful and +# keeps the fixture generated from an existing cross-platform input. +sed -n '1,2p' "$DATA" > "$THREADED_DATA" +for ((i = 0; i < 65; ++i)); do + sed -n '3,$p' "$DATA" >> "$THREADED_DATA" +done +threaded_rows="$(sed -n '3,$p' "$THREADED_DATA" | awk 'NF { count++ } END { print count + 0 }')" +if (( threaded_rows <= 1024 )); then + fail "threaded fixture has only $threaded_rows data rows" +fi + +run_expect_success valid-threads-default \ + "$APPLY" "$THREADED_DATA" 0 0 "$SRGB" 1 "$SRGB" 1 -INIT 1 +if [ ! -s "$OUTDIR/valid-threads-default.log" ]; then + fail "valid-threads-default produced no output" +fi +for nthreads in 0 1 2 4 8; do + run_expect_success "valid-threads-$nthreads" \ + "$APPLY" -threads "$nthreads" "$THREADED_DATA" 0 0 "$SRGB" 1 "$SRGB" 1 -INIT 1 + if [ ! -s "$OUTDIR/valid-threads-$nthreads.log" ]; then + fail "valid-threads-$nthreads produced no output" + fi + cmp "$OUTDIR/valid-threads-default.log" "$OUTDIR/valid-threads-$nthreads.log" || + fail "valid-threads-$nthreads output differs from the default output" +done +run_expect_success valid-threads-cfg "$APPLY" -threads 8 -cfg "$CFG" + # The #1674 guard this script exists for: everything past argv[2] used to be read # and dropped, leaving a zero exit behind. run_expect_reject cfg-extra "$APPLY" -cfg "$CFG" ignored-extra +run_expect_reject threads-negative "$APPLY" -threads -1 -cfg "$CFG" +run_expect_reject threads-too-large "$APPLY" -threads 257 -cfg "$CFG" +grep -Fq "expected 0..256" "$OUTDIR/threads-too-large.log" || + fail "threads-too-large diagnostic omitted the supported range" +run_expect_reject threads-not-a-number "$APPLY" -threads nope -cfg "$CFG" +run_expect_reject threads-missing-count "$APPLY" -threads +run_expect_reject threads-missing-command "$APPLY" -threads 8 +run_expect_reject threads-debugcalc \ + "$APPLY" -threads 8 -debugcalc "$DATA" 0 0 "$SRGB" 1 "$SRGB" 1 -INIT 1 # Already rejected on master; pinned so the surface cannot regress quietly. run_expect_reject init-missing-value "$APPLY" "$DATA" 0 0 "$SRGB" 1 "$SRGB" 1 -INIT diff --git a/docs/ctest.md b/docs/ctest.md index 45ab77103..69619cb50 100644 --- a/docs/ctest.md +++ b/docs/ctest.md @@ -186,6 +186,11 @@ The JSON round-trip uses a temporary directory for generated `.json` and round-trip `.icc` files so a passing Unix run does not remove or modify tracked files in `Testing/`. +`iccdev.applysearch-cli-args` derives a batch of more than 1,024 rows from the +tracked RGB input and requires byte-identical output for the default path and +`-threads 0`, `1`, `2`, `4`, and `8`. It also covers configuration mode, +malformed thread counts, and the single-thread requirement for `-debugcalc`. + `iccdev.tool-coverage` may add focused command-line regressions inside the existing script without changing the CTest suite count. When a bug is tied to an AFL-minimized crash or hang, embed the smallest stable reproducer in the script From 519347071b3a700bbc4c4291eb1e5f36ecbd282e Mon Sep 17 00:00:00 2001 From: D Hoyt Date: Thu, 3 Sep 2026 14:58:31 -0400 Subject: [PATCH 2/2] test: harden threaded ApplySearch regression --- .../iccdev-applysearch-cli-args-regression.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/scripts/iccdev-applysearch-cli-args-regression.sh b/.github/scripts/iccdev-applysearch-cli-args-regression.sh index 8c09f345d..f76663199 100755 --- a/.github/scripts/iccdev-applysearch-cli-args-regression.sh +++ b/.github/scripts/iccdev-applysearch-cli-args-regression.sh @@ -148,11 +148,17 @@ require_file "$CFG" run_expect_success valid-cfg "$APPLY" -cfg "$CFG" run_expect_success valid-legacy "$APPLY" "$DATA" 0 0 "$SRGB" 1 "$SRGB" 1 -INIT 1 -# Repeat the tracked 16-row input until the batch is strictly larger than the +# Repeat the tracked input until the batch is strictly larger than the # 1,024-pixel bulk threshold. This makes all eight requested workers useful and -# keeps the fixture generated from an existing cross-platform input. +# keeps the fixture generated from an existing cross-platform input even if its +# row count changes. sed -n '1,2p' "$DATA" > "$THREADED_DATA" -for ((i = 0; i < 65; ++i)); do +source_rows="$(sed -n '3,$p' "$DATA" | awk 'NF { count++ } END { print count + 0 }')" +if (( source_rows <= 0 )); then + fail "tracked input has no data rows" +fi +repeat_count=$((1024 / source_rows + 1)) +for ((i = 0; i < repeat_count; ++i)); do sed -n '3,$p' "$DATA" >> "$THREADED_DATA" done threaded_rows="$(sed -n '3,$p' "$THREADED_DATA" | awk 'NF { count++ } END { print count + 0 }')" @@ -188,6 +194,8 @@ run_expect_reject threads-missing-count "$APPLY" -threads run_expect_reject threads-missing-command "$APPLY" -threads 8 run_expect_reject threads-debugcalc \ "$APPLY" -threads 8 -debugcalc "$DATA" 0 0 "$SRGB" 1 "$SRGB" 1 -INIT 1 +grep -Fqx -- "-debugcalc requires -threads 1" "$OUTDIR/threads-debugcalc.log" || + fail "threads-debugcalc did not enforce the single-thread diagnostic" # Already rejected on master; pinned so the surface cannot regress quietly. run_expect_reject init-missing-value "$APPLY" "$DATA" 0 0 "$SRGB" 1 "$SRGB" 1 -INIT