On Wed, Jan 28, 2026 at 09:58:08AM +0100, Patrice Dumas wrote:
> > > I've got in mind to think about how to report status of XS code better
> > > for the test suite, but haven't been able to get to this yet.
> >
> > My current idea with the requiredifenabled possibility is to use it such
> > that there is no need to report anything, if the state is no exactly the
> > expected state, there would be a failure.
>
> I failed to do that. For modules that are not replaced as a whole and
> have overriden functions, right now it is not easy to avoid functions to
> be overriden in advance. This could be changed, but there is also the
> possibility to replace whole modules that could be more relevant, as it
> would simplify XS loading and also make clearer which functions are
> overriden.
I see you made "requiredifenabled" only use the environment variables,
not any configure-time settings.
I understand your idea for using the configure-time setting in the test
suite. This way the tests should be guaranteed to run according to what
configure found, which the user can check in config.log files or by seeing
the output of configure. It means the tests check that the XS modules load
and run as expected. (Printing the status of the XS code - or whether
ctexi2any is being used - when the test suite runs doesn't seem to be
easy to do.)
Here's an idea that only uses the configure-time settings. It's done
by setting the TEXINFO_XS environment variable in the environment for
the tests.
I used the option "requiredifconfigured" because you had already used
the option "requiredifenabled".
You can override the setting from the command line:
$ make check TEXINFO_XS_TESTS=omit
This allows testing the pure Perl modules without having to reconfigure.
I just did it for tta/perl/t but if you think it is a good idea it
should be possible to extend it to the other test suite as well.
diff --git a/tta/perl/Makefile.am b/tta/perl/Makefile.am
index c7b58389db..8a6a7d8008 100644
--- a/tta/perl/Makefile.am
+++ b/tta/perl/Makefile.am
@@ -417,8 +417,9 @@ T_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \
T_LOG_COMPILER = $(PERL)
AM_T_LOG_FLAGS = -w
-AM_TESTS_ENVIRONMENT = srcdir="$(srcdir)"; export srcdir;
t2a_srcdir="$(top_srcdir)"; export t2a_srcdir; t2a_builddir="$(top_builddir)";
export t2a_builddir;
+TEXINFO_XS_TESTS=requiredifconfigured
+AM_TESTS_ENVIRONMENT = srcdir="$(srcdir)"; export srcdir;
t2a_srcdir="$(top_srcdir)"; export t2a_srcdir; t2a_builddir="$(top_builddir)";
export t2a_builddir; TEXINFO_XS=$(TEXINFO_XS_TESTS); export TEXINFO_XS;
distclean-local:
rm -f t/results/*/*.pl.new
rm -rf t/results/*/*/out_*/
diff --git a/tta/perl/Texinfo/XSLoader.pm b/tta/perl/Texinfo/XSLoader.pm
index 8906fc7fa9..0f9a01f23e 100644
--- a/tta/perl/Texinfo/XSLoader.pm
+++ b/tta/perl/Texinfo/XSLoader.pm
@@ -258,6 +258,10 @@ sub init {
$TEXINFO_XS = '';
}
+ if ($TEXINFO_XS eq 'requiredifconfigured') {
+ $TEXINFO_XS = $disable_XS ? 'omit' : 'required';
+ }
+
if ($embedded_xs and $TEXINFO_XS eq 'omit') {
warn "ignoring TEXINFO_XS environment variable set to 'omit' ".
"for embedded Perl\n";