Introduce infrastructure for running Lua API tests and add bitop tests#121
Merged
Introduce infrastructure for running Lua API tests and add bitop tests#121
Conversation
6593cea to
9461590
Compare
Owner
Author
https://github.com/ligurio/lua-c-api-tests/actions/runs/13946406205/job/39034554410?pr=121 |
9461590 to
b89866c
Compare
88cdf48 to
2a1da10
Compare
ligurio
added a commit
to ligurio/nanodata
that referenced
this pull request
Mar 26, 2025
Build Tarantool: ``` CFLAGS="-fsanitize=fuzzer-no-link" LDFLAGS="-fsanitize=fuzzer-no-link" CC=clang CXX=clang++ cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DENABLE_FUZZER=ON -DLUAJIT_NUMMODE=2 ``` Build luzer: ``` git clone https://github.com/ligurio/luzer CC=clang-21 CXX=clang++-21 cmake -S . -B build cmake --build build/ --parallel ``` Run test: ``` LUA_CPATH='./luzer/build/luzer/?.so;;' LUA_PATH='./luzer/?/init.lua;;' ./src/tarantool ./test/fuzz/lua-tests/src/tests/lapi/bitop_bxor_test.lua LSAN_OPTIONS=suppressions=$(pwd)/asan/lsan.supp ASAN_OPTIONS=heap_profile=0:unmap_shadow_on_exit=1:print_suppressions=0 tarantool tarantool_csv.lua ``` Follows up commit 8ad443d ("cmake: introduce a module to build fuzzing tests"). TODO: - integrate with LSAN_OPTIONS and ASAN_OPTIONS 1. ligurio/lunapark#121 NO_CHANGELOG=internal NO_DOC=internal NO_TEST=internal
ligurio
added a commit
to ligurio/nanodata
that referenced
this pull request
Mar 26, 2025
Build Tarantool: ``` CFLAGS="-fsanitize=fuzzer-no-link" LDFLAGS="-fsanitize=fuzzer-no-link" CC=clang CXX=clang++ cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DENABLE_FUZZER=ON -DLUAJIT_NUMMODE=2 ``` Build luzer: ``` git clone https://github.com/ligurio/luzer CC=clang-21 CXX=clang++-21 cmake -S . -B build cmake --build build/ --parallel ``` Run test: ``` LUA_CPATH='./luzer/build/luzer/?.so;;' LUA_PATH='./luzer/?/init.lua;;' ./src/tarantool ./test/fuzz/lua-tests/src/tests/lapi/bitop_bxor_test.lua LSAN_OPTIONS=suppressions=$(pwd)/asan/lsan.supp ASAN_OPTIONS=heap_profile=0:unmap_shadow_on_exit=1:print_suppressions=0 tarantool tarantool_csv.lua ``` Follows up commit 8ad443d ("cmake: introduce a module to build fuzzing tests"). TODO: - integrate with LSAN_OPTIONS and ASAN_OPTIONS 1. ligurio/lunapark#121 NO_CHANGELOG=internal NO_DOC=internal NO_TEST=internal
This was referenced Mar 26, 2025
37d8d5e to
6a381f9
Compare
ligurio
added a commit
to ligurio/nanodata
that referenced
this pull request
Mar 28, 2025
The commit 8ad443d ("cmake: introduce a module to build fuzzing tests") has added tests for LuaJIT. These tests mostly written in C and tests LuaJIT via Lua C API. The patch integrates tests that written in Lua and tests LuaJIT via Lua API, see [1]. Depends on: 1. ligurio/lunapark#121 2. tarantool#11056 NO_CHANGELOG=testing NO_DOC=testing
Buristan
reviewed
Apr 7, 2025
Buristan
approved these changes
Apr 7, 2025
Buristan
requested changes
Apr 8, 2025
Collaborator
Buristan
left a comment
There was a problem hiding this comment.
Hi, Sergey!
Thanks for the patch!
I believe that the most part of problems are from the bit library API misuse. It expects 32-bit integers for inputs, see details here.
Also we may provide more checks like the following.
Buristan
requested changes
Apr 8, 2025
ligurio
added a commit
to ligurio/nanodata
that referenced
this pull request
Apr 9, 2025
The commit 8ad443d ("cmake: introduce a module to build fuzzing tests") has added tests for LuaJIT. These tests mostly written in C and tests LuaJIT via Lua C API. The patch integrates tests that written in Lua and tests LuaJIT via Lua API, see [1]. Depends on: 1. ligurio/lunapark#121 2. tarantool#11056 NO_CHANGELOG=testing NO_DOC=testing
4a0af62 to
84f2aa3
Compare
84f2aa3 to
f234fcb
Compare
26c535a to
7fb04d3
Compare
3 tasks
3770f24 to
b7b0525
Compare
b7b0525 to
c3c3f05
Compare
Buristan
approved these changes
May 13, 2025
Collaborator
Buristan
left a comment
There was a problem hiding this comment.
Thanks for the fixes!
LGTM.
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]. Lua API tests can be enabled by CMake option ENABLE_LAPI_TESTS. The option is disabled by default, because necessary dependencies are not installed in OSS Fuzz and thus workflow is failed. 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
c3c3f05 to
5715005
Compare
ligurio
added a commit
to ligurio/lunapark-corpus
that referenced
this pull request
May 14, 2025
The commit "tests/lapi: add bitop tests" [1]. 1. ligurio/lunapark@d4b91f6 Follows up ligurio/lunapark#121 Related to tarantool/tarantool#11401 Related to tarantool/tarantool#11301
ligurio
added a commit
to ligurio/lunapark-corpus
that referenced
this pull request
May 14, 2025
The commit "tests/lapi: add bitop tests" [1]. 1. ligurio/lunapark@d4b91f6 Follows up ligurio/lunapark#121 Related to tarantool/tarantool#11401 Related to tarantool/tarantool#11301
ligurio
added a commit
to ligurio/nanodata
that referenced
this pull request
May 14, 2025
The commit 8ad443d ("cmake: introduce a module to build fuzzing tests") has added tests for LuaJIT. These tests mostly written in C and tests LuaJIT via Lua C API. The patch integrates tests that written in Lua and tests LuaJIT via Lua API, see [1]. Depends on: 1. ligurio/lunapark#121 2. tarantool#11056 NO_CHANGELOG=testing NO_DOC=testing
ligurio
added a commit
to ligurio/nanodata
that referenced
this pull request
Aug 6, 2025
The commit 8ad443d ("cmake: introduce a module to build fuzzing tests") has added tests for LuaJIT. These tests are mostly written in C and test LuaJIT via the Lua C API. The patch integrates tests that are written in Lua and tests LuaJIT via the Lua API, see [1]. 1. ligurio/lunapark#121 NO_CHANGELOG=build NO_DOC=build NO_TEST=build
ligurio
added a commit
to ligurio/nanodata
that referenced
this pull request
Aug 6, 2025
The commit 8ad443d ("cmake: introduce a module to build fuzzing tests") has added tests for LuaJIT. These tests are mostly written in C and test LuaJIT via the Lua C API. The patch integrates tests that are written in Lua and tests LuaJIT via the Lua API, see [1]. 1. ligurio/lunapark#121 Closes tarantool#11401 NO_CHANGELOG=build NO_DOC=build NO_TEST=build
ligurio
added a commit
to ligurio/nanodata
that referenced
this pull request
Aug 6, 2025
The commit 8ad443d ("cmake: introduce a module to build fuzzing tests") has added tests for LuaJIT. These tests are mostly written in C and test LuaJIT via the Lua C API. The patch integrates tests that are written in Lua and tests LuaJIT via the Lua API, see [1]. 1. ligurio/lunapark#121 Closes tarantool#11401 NO_CHANGELOG=build NO_DOC=build NO_TEST=build
ligurio
added a commit
to ligurio/lunapark-corpus
that referenced
this pull request
Apr 1, 2026
The commit "tests/lapi: add bitop tests" [1]. 1. ligurio/lunapark@d4b91f6 Follows up ligurio/lunapark#121 Related to tarantool/tarantool#11401 Related to tarantool/tarantool#11301
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It is needed to discuss the following questions on review:
-O1,-O2,-O3etc.) 1 and apply them?build_luzer()?Blocked by:
Footnotes
https://luajit.org/running.html ↩