Subject: bug#48062: make check fails if configured with --program-prefix

From: Collin Funk <[email-masked]>
Date: Sun, 23 Jun 2024 03:14:48 -0700

Hi,

Jun T says:
> $ ./configure --program-prefix=g
> $ make
> $ make check
>
> then two tests diff3 and help-version fail.
> The reason is quite simple; the log contains lines like
>
> +diff3: subsidiary program 'gdiff' not found

I noticed this since I use --program-prefix=g too. More generally
--program-{prefix,suffix} are simpler forms of
--program-transform-name.

The error is because the sed pattern given to that option is only used
on the executable after 'make install'. I've attached a patch that
invokes diff3 and sdiff with --diff-program=diff which should make the
tests pass regardless of the options passed to ./configure.

Collin

>From 2a5c88a591ed6ecc904a8631207a82b4887ed386 Mon Sep 17 00:00:00 2001
From: Collin Funk <[email-masked]>
Date: Sun, 23 Jun 2024 03:00:21 -0700
Subject: [PATCH] tests: Don't fail when --program-transform-name is used

Problem reported by Jun T <https://bugs.gnu.org/48062>.
* tests/diff3: Use --diff-program=diff since --program-transform-name
is applied after install.
* tests/help-version (sdiff_setup, diff3_setup): Likewise.
---
 tests/diff3        | 8 +++++---
 tests/help-version | 8 ++++++--
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/tests/diff3 b/tests/diff3
index b591751..e468243 100644
--- a/tests/diff3
+++ b/tests/diff3
@@ -30,12 +30,14 @@ EOF
 
 fail=0
 
-diff3 a b c > out 2> err || fail=1
+# Use --diff-program=diff since --program-transform-name and similar are
+# applied after 'make install'.
+diff3 --diff-program=diff a b c > out 2> err || fail=1
 compare exp out || fail=1
 compare /dev/null err || fail=1
 
 # Repeat, but with all three files the same:
-diff3 a a a > out 2> err || fail=1
+diff3 --diff-program=diff a a a > out 2> err || fail=1
 compare /dev/null out || fail=1
 compare /dev/null err || fail=1
 
@@ -101,7 +103,7 @@ cat <<'EOF' > exp40 || framework_failure_
   3z
 EOF
 
-diff3 d e f > out 2> err
+diff3 --diff-program=diff d e f > out 2> err
 compare exp40 out || fail=1
 compare /dev/null err || fail=1
 
diff --git a/tests/help-version b/tests/help-version
index 7dc84d7..e03acea 100755
--- a/tests/help-version
+++ b/tests/help-version
@@ -170,8 +170,12 @@ egrep_setup () { args="0 $tmp_in"; }
 fgrep_setup () { args="0 $tmp_in"; }
 
 diff_setup () { args="$tmp_in $tmp_in2"; }
-sdiff_setup () { args="$tmp_in $tmp_in2"; }
-diff3_setup () { args="$tmp_in $tmp_in2 $tmp_in2"; }
+
+# Use --diff-program=diff since --program-transform-name and similar are
+# applied after 'make install'.
+sdiff_setup () { args="--diff-program=diff $tmp_in $tmp_in2"; }
+diff3_setup () { args="--diff-program=diff $tmp_in $tmp_in2 $tmp_in2"; }
+
 cp_setup () { args="$tmp_in $tmp_in2"; }
 ln_setup () { args="$tmp_in ln-target"; }
 ginstall_setup () { args="$tmp_in $tmp_in2"; }
-- 
2.45.2