lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

Over the last few weeks, I've been attempting to get the Lua testsuite to work in various configurations, including when built with a C++ compiler and/or shared or static, and/or on Windows.  Patch is attached.  The original changes are here: https://gitlab.com/codelibre/lua/lua-cmake/-/commits/lua-cmake-5.4?ref_type=heads

In order to adapt to different build configurations, several environment variables may be used to override the default behaviour:

LUA_LANGUAGE=C|CXX -- Language used when building
LUA_USE_READLINE=0|1 -- If readline was used (since it affects interactivity tests)
LUA_LIBRARY_LOADER=0|1 -- If library loading support is available (attrib.lua tests won't work if disabled)
LUA_TEST_DIR= -- Directory path for Lua test files (for out-of-source builds where the location isn't known)
LUA_PATH= -- override as needed to load test files with require
LUA_CPATH= -- override as needed to load test modules with require

For Windows, most of the tests in main.lua needed an alternative command to use with popen or system, so they will work with the cmd.exe shell instead of Bourne shell.  Mostly different quoting rules.  There was one I couldn't get working due to the difficulty passing a literal space, which is commented in the patch.  I also adapted the time tests to work with the supported time ranges on Windows.

An additional compatibility tweak is needed identified during testing: On Windows the gsub recursion test fails.  Windows needs LUAI_MAXCCALLS=150, not the 200 default.  The default in llimits.h might need to be conditional so that it's 150 on Windows, 200 otherwise.

I'm sure there are many additional improvements which could be made on top of this, but I hope this is a useful foundation for enabling proper testing of build configurations other than C on Unix with module loading enabled.

Kind regards,
Roger

Attachment: lua-tests-windows-compat.diff
Description: lua-tests-windows-compat.diff