Skip to content

ligurio/lua-c-api-tests

Folders and files

NameName
Last commit message
Last commit date

Latest commit

0b0ac38 · Feb 20, 2025
Nov 30, 2024
Feb 1, 2025
Jan 23, 2025
Feb 3, 2024
Jan 23, 2025
Oct 14, 2024
Feb 20, 2025
Dec 6, 2023
Feb 1, 2024
Jan 30, 2025
Jan 23, 2025
Jun 21, 2024
Dec 12, 2023
Feb 1, 2025
Jan 30, 2025

Repository files navigation

PUC Rio Lua
LuaJIT
Tarantool

Lua C API tests

is a set of fuzzing tests for C implementations of Lua runtime (PUC Rio Lua and LuaJIT).

Building

git clone https://github.com/ligurio/lua-c-api-tests
cd lua-c-api-tests
git clone https://github.com/ligurio/lua-c-api-corpus
CC=clang CXX=clang++ cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DUSE_LUA=ON [-DUSE_LUAJIT=ON]
cmake --build build --parallel

CMake options:

  • USE_LUA enables building PUC Rio Lua.
  • USE_LUAJIT enables building LuaJIT.
  • LUA_VERSION could be a Git branch, tag or commit. By default LUA_VERSION is master for PUC Rio Lua and v2.1 for LuaJIT.
  • ENABLE_LUAJIT_RANDOM_RA enables randomness in a register allocation. Option is LuaJIT-specific.
  • ENABLE_ASAN enables AddressSanitizer.
  • ENABLE_UBSAN enables UndefinedBehaviorSanitizer.
  • ENABLE_COV enables coverage instrumentation.
  • ENABLE_LUA_ASSERT enables all assertions inside Lua source code.
  • ENABLE_LUA_APICHECK enables consistency checks on the C API.
  • OSS_FUZZ enables support of OSS Fuzz.
  • ENABLE_BUILD_PROTOBUF enables building Protobuf library, otherwise system library is used.
  • ENABLE_INTERNAL_TESTS enables internal tests.

Running

cmake --build build --target test
cd build && RUNS=100000 ctest -R luaL_gsub_test --verbose
<snipped>
1: Done 100000 runs in 5 second(s)

References

License

Copyright (C) 2022-2025 Sergey Bronnikov, released under the ISC license. See a full Copyright Notice in the LICENSE file.