Skip to content

tests/lapi: add string tests #124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

@ligurio ligurio force-pushed the ligurio/gh-xxxx-lapi-string branch 12 times, most recently from 6cc9b5e to db026a5 Compare March 27, 2025 07:09
@ligurio ligurio force-pushed the ligurio/gh-xxxx-lapi-string branch 2 times, most recently from 3f59f73 to 13733c9 Compare April 12, 2025 19:34
ligurio and others added 7 commits April 15, 2025 11:03
The patch add a CMake module that builds a luzer [1],
a coverage-guided, native Lua fuzzing engine.

Needed for the following commit.

1. https://github.com/ligurio/luzer
While extending tests it is often required to append additional
path where Lua or Lua C auxiliary modules are located to LUA_PATH or
LUA_CPATH environment variables. Due to insane semicolon interpolation
in CMake strings (that converts such string to a list as a result),
we need to escape semicolon in LUA_PATH/LUA_CPATH strings while
building the resulting value.

The patch introduce MakeLuaPath.cmake module to make LUA_PATH and
LUA_CPATH definition convenient with <lapi_tests_make_lua_path>
helper. This function takes all paths given as a variable list
argument, joins them in a reverse order by a semicolon and yields
the resulting string to a specified CMake variable.

Needed for the following commit.
The patch adds initial infrastructure for Lua API tests and
changes existed infrastructure for running these tests and adds
a fuzzing tests for bitwise operations in PUC Rio (since 5.2) [1]
Lua and bitwise functions in LuaJIT [2][3].

PUC Rio Lua provided auto-coercion of string arguments to numbers
by default, but it has been removed from the core language in 5.4.
LuaJIT provides auto-coercion of string arguments to numbers
by default, but it doesn not tested by proposed tests.

The patch requires commit "cmake: allow to set a Lua library
outside" [4] in the `luzer` project.

The proposed bitop tests are capable to reproduce a LuaJIT issue
with bit op coercion for shifts in DUALNUM builds [5].

Rules from boolean algebra [6] has been used as invariants for
bitwise expressions.

1. https://www.lua.org/manual/5.2/manual.html#6.7
2. https://bitop.luajit.org/semantics.html
3. https://bitop.luajit.org/api.html
4. ligurio/luzer@4ce52a6
5. LuaJIT/LuaJIT@69bbf3c1
6. https://en.wikipedia.org/wiki/Bitwise_operation#Boolean_algebra
The patch introduces an option that enables Lua API tests.
The option is disabled by default because necessary dependencies
are not installed in OSS Fuzz and thus workflow is failed.
The patch adds a fuzzing tests for Lua string functions and
two helpers: `random_locale()`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant