Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,12 @@ if(ANDROID)
list(APPEND common_SRCS porting_android.cpp)
endif()

option(IGNORE_LUA_DESTRUCTOR_TEST_FAILURE "Ignore failures in Lua destructor test" FALSE)

if(IGNORE_LUA_DESTRUCTOR_TEST_FAILURE)
add_compile_definitions(IGNORE_LUA_DESTRUCTOR_TEST_FAILURE)
endif()

if(BUILD_UNITTESTS)
add_subdirectory(unittest)
list(APPEND common_SRCS ${UNITTEST_SRCS})
Expand Down
7 changes: 7 additions & 0 deletions src/unittest/test_lua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "test.h"
#include "config.h"
#include "log.h"

#include <stdexcept>

Expand Down Expand Up @@ -82,7 +83,13 @@ void TestLua::testLuaDestructors()
}, &did_destruct);
lua_close(L);

#ifdef IGNORE_LUA_DESTRUCTOR_TEST_FAILURE
if (!did_destruct) {
warningstream << "The Lua destructor test has failed and you have elected to ignore it. You should know what you're doing. Memory leaks, deadlocks, and other nasty things are possible." << std::endl;
}
#else
UASSERT(did_destruct);
#endif
}

namespace {
Expand Down
Loading