Skip to content

Commit

Permalink
tests/capi: update blacklists with tests
Browse files Browse the repository at this point in the history
The commit 1538871 ("tests: disable lua_dump_test").
  • Loading branch information
ligurio committed Aug 18, 2024
1 parent 159a488 commit 4df678a
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions tests/capi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,21 @@ function(create_test)
add_dependencies(${test_name} ${LUA_TARGET})
string(REPLACE "_test" "" test_prefix ${test_name})
set(LIBFUZZER_OPTS "${LIBFUZZER_OPTS} -artifact_prefix=${test_name}_")
if (USE_LUAJIT AND (${test_name} STREQUAL "luaL_loadstring"))
set(LIBFUZZER_OPTS "${LIBFUZZER_OPTS} -only_ascii=1")
endif ()
if (USE_LUAJIT AND (${test_name} STREQUAL "luaL_loadbuffer_test"))
set(LIBFUZZER_OPTS "${LIBFUZZER_OPTS} -only_ascii=1")
endif ()
if (USE_LUAJIT AND (${test_name} STREQUAL "luaL_dostring_test"))
set(LIBFUZZER_OPTS "${LIBFUZZER_OPTS} -only_ascii=1")
endif ()
if (USE_LUAJIT AND (${test_name} STREQUAL "lua_dump_test"))
set(LIBFUZZER_OPTS "${LIBFUZZER_OPTS} -only_ascii=1")
endif ()
if (USE_LUAJIT AND (${test_name} STREQUAL "lua_load_test"))
set(LIBFUZZER_OPTS "${LIBFUZZER_OPTS} -only_ascii=1")
endif ()
set(dict_path ${PROJECT_SOURCE_DIR}/corpus/${test_name}.dict)
set(corpus_path ${PROJECT_SOURCE_DIR}/corpus/${test_prefix})
if (EXISTS ${dict_path})
Expand All @@ -100,18 +115,18 @@ function(create_test)
endif (USE_LUAJIT)
endfunction()

# Lua C functions unsupported by LuaJIT.
list(APPEND LUAJIT_BLACKLIST_TESTS "luaL_addgsub_test")
list(APPEND LUAJIT_BLACKLIST_TESTS "luaL_bufflen_test")
list(APPEND LUAJIT_BLACKLIST_TESTS "luaL_buffsub_test")
list(APPEND LUAJIT_BLACKLIST_TESTS "luaL_buffaddr_test")
list(APPEND LUAJIT_BLACKLIST_TESTS "lua_load_test")
list(APPEND LUAJIT_BLACKLIST_TESTS "lua_stringtonumber_test")

# https://github.com/ligurio/lua-c-api-tests/issues/19
list(APPEND BLACKLIST_TESTS "luaL_dostring_test")
list(APPEND BLACKLIST_TESTS "luaL_loadbuffer_test")
list(APPEND BLACKLIST_TESTS "luaL_loadstring_test")
list(APPEND BLACKLIST_TESTS "lua_dump_test")
# Lua C functions unsupported by LuaJIT.
# `LuaJIT ASSERT lj_bcread.c:123: bcread_byte: buffer read overflow`
# Workaround: -only_ascii=1.
# list(APPEND LUAJIT_BLACKLIST_TESTS "luaL_dostring_test")
# list(APPEND LUAJIT_BLACKLIST_TESTS "luaL_loadbuffer_test")
# list(APPEND LUAJIT_BLACKLIST_TESTS "luaL_loadstring_test")

file(GLOB tests LIST_DIRECTORIES false ${CMAKE_CURRENT_SOURCE_DIR} *.c *.cc)
foreach(filename ${tests})
Expand Down

0 comments on commit 4df678a

Please sign in to comment.