Attached are tests for this bug.
From 3114a7ec5b7954c01baaaaa5193fc89794e6239e Mon Sep 17 00:00:00 2001
From: Richard Hansen <[email protected]>
Date: Mon, 18 Aug 2025 15:39:31 -0400
Subject: [PATCH] tests: add XFAIL tests for substitution/replacement variable
 refs

From https://bugs.gnu.org/79266.

* t/var-pattern-substitution-reference.sh: New (failing) test for
$(foo:a%b=c%d) pattern substitution variable references in TESTS.
* t/var-suffix-replacement-reference.sh: New (failing) test for
$(foo:.a=.b) suffix replacement variable references in TESTS.
* t/list-of-tests.mk (XFAIL_TESTS): Add them.
---
 t/list-of-tests.mk                      |  2 ++
 t/var-pattern-substitution-reference.sh | 46 +++++++++++++++++++++++++
 t/var-suffix-replacement-reference.sh   | 46 +++++++++++++++++++++++++
 3 files changed, 94 insertions(+)
 create mode 100644 t/var-pattern-substitution-reference.sh
 create mode 100644 t/var-suffix-replacement-reference.sh

diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index 6099d49a4..a168ea2f0 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -46,6 +46,8 @@ t/remake-timing-bug-pr8365.sh \
 t/lex-subobj-nodep.sh \
 t/remake-am-pr10111.sh \
 t/remake-m4-pr10111.sh \
+t/var-pattern-substitution-reference.sh \
+t/var-suffix-replacement-reference.sh \
 $(perl_fake_XFAIL_TESTS)
 
 perl_TESTS = \
diff --git a/t/var-pattern-substitution-reference.sh b/t/var-pattern-substitution-reference.sh
new file mode 100644
index 000000000..586a712c1
--- /dev/null
+++ b/t/var-pattern-substitution-reference.sh
@@ -0,0 +1,46 @@
+#! /bin/sh
+# Copyright (C) 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+# Regression test for bug #79266: Ensure that a pattern substitution variable
+# reference (added in POSIX Issue 8) is supported in TESTS.
+
+. test-init.sh
+
+cat >>configure.ac <<\EOF
+AC_OUTPUT
+EOF
+
+cat >Makefile.am <<\EOF
+foo = foo bar
+var = $(foo:%=pfx_%_sfx)
+TESTS = $(foo:%=pfx_%_sfx)
+show-var:
+	@printf %s\\n '$(var)'
+show-TESTS:
+	@printf %s\\n '$(TESTS)'
+EOF
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+./configure
+
+for v in var TESTS; do
+    out=$($MAKE "show-${v}")
+    [ "${out}" = "pfx_foo_sfx pfx_bar_sfx" ]
+done
+
+:
diff --git a/t/var-suffix-replacement-reference.sh b/t/var-suffix-replacement-reference.sh
new file mode 100644
index 000000000..11e209dd9
--- /dev/null
+++ b/t/var-suffix-replacement-reference.sh
@@ -0,0 +1,46 @@
+#! /bin/sh
+# Copyright (C) 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+# Regression test for bug #79266: Ensure that a suffix replacement variable
+# reference is supported in TESTS.
+
+. test-init.sh
+
+cat >>configure.ac <<\EOF
+AC_OUTPUT
+EOF
+
+cat >Makefile.am <<\EOF
+foo = foo.ext1 bar.ext2
+var = $(foo:.ext1=.ext2)
+TESTS = $(foo:%=pfx_%_sfx)
+show-var:
+	@printf %s\\n '$(var)'
+show-TESTS:
+	@printf %s\\n '$(TESTS)'
+EOF
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+./configure
+
+for v in var TESTS; do
+    out=$($MAKE "show-${v}")
+    [ "${out}" = "foo.ext2 bar.ext2" ]
+done
+
+:
-- 
2.50.1

Reply via email to