This patch should *hopefully* cover the last newline issue in test
directories.

It seems that gnulib-tool.py strips the whitespace from Automake
snippets where gnulib-tool.sh doesn't. This can be seen by the
following diff:

$ diff -u ./test-create-megatestdir-1.result/ALL/configure.ac 
tmp500214-result/ALL/configure.ac
--- ./test-create-megatestdir-1.result/ALL/configure.ac 2024-03-22 
11:23:00.114344055 -0700
+++ tmp500214-result/ALL/configure.ac   2024-03-22 12:19:28.505341069 -0700
@@ -622,8 +609,7 @@
   gl_XALLOC
   gl_MODULE_INDICATOR([xalloc])
   gl_MODULE_INDICATOR([xalloc-die])
-  AC_REQUIRE([gl_YIELD])
-  m4_popdef([gl_MODULE_INDICATOR_CONDITION])
+  AC_REQUIRE([gl_YIELD])  m4_popdef([gl_MODULE_INDICATOR_CONDITION])
   m4_ifval(gltests_LIBSOURCES_LIST, [
     m4_syscmd([test ! -d ]m4_defn([gltests_LIBSOURCES_DIR])[ ||
       for gl_file in ]gltests_LIBSOURCES_LIST[ ; do

Collin
From 6fd480c18b7060c0ad596d5e9dd1fbc3f5f9ccb1 Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Fri, 22 Mar 2024 12:57:01 -0700
Subject: [PATCH 2/2] gnulib-tool.py: Don't remove newlines in testdir's
 Automake snippets.

* pygnulib/GLTestDir.py (GLTestDir.execute): Don't strip newlines from
Automake snippets.
---
 ChangeLog             | 6 ++++++
 pygnulib/GLTestDir.py | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 183a1e1996..c8f4063444 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-03-22  Collin Funk  <collin.fu...@gmail.com>
+
+	gnulib-tool.py: Don't remove newlines in testdir's Automake snippets.
+	* pygnulib/GLTestDir.py (GLTestDir.execute): Don't strip newlines from
+	Automake snippets.
+
 2024-03-22  Collin Funk  <collin.fu...@gmail.com>
 
 	gnulib-tool.py: Fix empty newline output in test directories.
diff --git a/pygnulib/GLTestDir.py b/pygnulib/GLTestDir.py
index 6f6a75931a..1807112e24 100644
--- a/pygnulib/GLTestDir.py
+++ b/pygnulib/GLTestDir.py
@@ -647,7 +647,7 @@ class GLTestDir(object):
             emit += '[$gl_module_indicator_condition])\n'
             snippets = self.emitter.autoconfSnippets(tests_modules, main_modules + tests_modules,
                                                      moduletable, 1, True, False, False, replace_auxdir)
-            emit += snippets.strip()
+            emit += snippets
             emit += '  m4_popdef([gl_MODULE_INDICATOR_CONDITION])\n'
             emit += self.emitter.initmacro_end('%stests' % macro_prefix, True)
         # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
-- 
2.44.0

Reply via email to