On Fri, Jan 30, 2026 at 10:24:25PM +0000, Gavin Smith wrote:
> 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 did, but not because I didn't want to, but because it did not work.
If I recall well there were two issues, one that may possibly be solved
now, by using BUILD_C_CODE, which was that with iconv not found the
requiredifenabled would have not correctly determined that XS could not
be used for the parser, structuring and converter.

The other issue is that if TEXINFO_XS_STRUCTURE=0 or
TEXINFO_XS_CONVERT=0, it is not possible to determine if the modules are
correctly loaded because it is not module loading and fallback but
series of functions overriding.  I would like to solve this issue by
using more whole module replacement and less (or even only for MisxXS if
possible) functions overriding.  But it should be for the next release.

I still think that we should use requiredifenabled for configure-time
settings, but since it did not work, I did not document it like that.

> 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.

I do not think that it will work as expected, to me there should only be
one possibility for the TEXINFO_XS value set for tests, so it should
work as expected for both configure/build time and environment/run time
customization.

> 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

It should not be disable_XS that is used here, but something based on
BUILD_C_CODE.  Otherwise, there will be failures if disable_XS is set to
yes, while there are no XS modules/no C code.

> --- 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";
> 

Reply via email to