Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
kunitoki committed Sep 27, 2024
1 parent c019e63 commit 1c34733
Show file tree
Hide file tree
Showing 16 changed files with 59 additions and 58 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ jobs:
- name: Test LuaJIT
working-directory: ${{runner.workspace}}/build/Tests
# run: ./LuaBridgeTestsLuaJIT
run: ./LuaBridgeTestsLuaJITNoexcept
run: ./LuaBridgeTestsLuaJIT
# run: ./LuaBridgeTestsLuaJITNoexcept

luau:
runs-on: macos-latest
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,9 @@ jobs:
- name: Test LuaJIT
working-directory: ${{runner.workspace}}/build/Tests/Release
shell: bash
# run: ./LuaBridgeTestsLuaJIT.exe
run: ./LuaBridgeTestsLuaJITNoexcept.exe
run: |
./LuaBridgeTestsLuaJIT.exe
./LuaBridgeTestsLuaJITNoexcept.exe
luau:
runs-on: windows-latest
Expand Down
22 changes: 11 additions & 11 deletions Tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ macro (add_test_app LUABRIDGE_TEST_NAME LUA_VERSION LUABRIDGE_TEST_LUA_LIBRARY_F
${LUABRIDGE_TEST_LUA_LIBRARY_FILES})

target_compile_definitions (${LUABRIDGE_TESTLIB_NAME} PRIVATE
LUABRIDGEDEMO_SHARED_EXPORT=1
LUABRIDGE_TEST_SHARED_EXPORT=1
${LUABRIDGE_DEFINES})

target_include_directories (${LUABRIDGE_TESTLIB_NAME} PRIVATE
Expand Down Expand Up @@ -286,22 +286,22 @@ macro (add_test_app LUABRIDGE_TEST_NAME LUA_VERSION LUABRIDGE_TEST_LUA_LIBRARY_F
target_include_directories (${LUABRIDGE_TEST_NAME} PRIVATE "${LUABRIDGE_LUAU_LOCATION}/Ast/include")
target_include_directories (${LUABRIDGE_TEST_NAME} PRIVATE "${LUABRIDGE_LUAU_LOCATION}/Compiler/include")
target_include_directories (${LUABRIDGE_TEST_NAME} PRIVATE "${LUABRIDGE_LUAU_LOCATION}/Common/include")
target_compile_definitions (${LUABRIDGE_TEST_NAME} PRIVATE LUABRIDGEDEMO_LUAU=1)
target_compile_definitions (${LUABRIDGE_TEST_NAME} PRIVATE LUABRIDGE_TEST_LUAU=1)

target_include_directories (${LUABRIDGE_TESTLIB_NAME} PRIVATE "${LUABRIDGE_LUAU_LOCATION}/VM/include")
target_include_directories (${LUABRIDGE_TESTLIB_NAME} PRIVATE "${LUABRIDGE_LUAU_LOCATION}/Ast/include")
target_include_directories (${LUABRIDGE_TESTLIB_NAME} PRIVATE "${LUABRIDGE_LUAU_LOCATION}/Compiler/include")
target_include_directories (${LUABRIDGE_TESTLIB_NAME} PRIVATE "${LUABRIDGE_LUAU_LOCATION}/Common/include")
target_compile_definitions (${LUABRIDGE_TESTLIB_NAME} PRIVATE LUABRIDGEDEMO_LUAU=1)
target_compile_definitions (${LUABRIDGE_TESTLIB_NAME} PRIVATE LUABRIDGE_TEST_LUAU=1)
elseif (${LUA_VERSION} STREQUAL "LUAJIT")
target_compile_definitions (${LUABRIDGE_TEST_NAME} PRIVATE LUABRIDGEDEMO_LUAJIT=1)
target_compile_definitions (${LUABRIDGE_TESTLIB_NAME} PRIVATE LUABRIDGEDEMO_LUAJIT=1)
target_compile_definitions (${LUABRIDGE_TEST_NAME} PRIVATE LUABRIDGE_TEST_LUAJIT=1)
target_compile_definitions (${LUABRIDGE_TESTLIB_NAME} PRIVATE LUABRIDGE_TEST_LUAJIT=1)
elseif (${LUA_VERSION} STREQUAL "RAVI")
target_compile_definitions (${LUABRIDGE_TEST_NAME} PRIVATE LUABRIDGEDEMO_RAVI=1)
target_compile_definitions (${LUABRIDGE_TESTLIB_NAME} PRIVATE LUABRIDGEDEMO_RAVI=1)
target_compile_definitions (${LUABRIDGE_TEST_NAME} PRIVATE LUABRIDGE_TEST_RAVI=1)
target_compile_definitions (${LUABRIDGE_TESTLIB_NAME} PRIVATE LUABRIDGE_TEST_RAVI=1)
else () # if(${LUA_VERSION} MATCHES "^[0-9]*")
target_compile_definitions (${LUABRIDGE_TEST_NAME} PRIVATE LUABRIDGEDEMO_LUA_VERSION=${LUA_VERSION})
target_compile_definitions (${LUABRIDGE_TESTLIB_NAME} PRIVATE LUABRIDGEDEMO_LUA_VERSION=${LUA_VERSION})
target_compile_definitions (${LUABRIDGE_TEST_NAME} PRIVATE LUABRIDGE_TEST_LUA_VERSION=${LUA_VERSION})
target_compile_definitions (${LUABRIDGE_TESTLIB_NAME} PRIVATE LUABRIDGE_TEST_LUA_VERSION=${LUA_VERSION})
endif ()

if (WIN32)
Expand All @@ -312,8 +312,8 @@ macro (add_test_app LUABRIDGE_TEST_NAME LUA_VERSION LUABRIDGE_TEST_LUA_LIBRARY_F
set (LUABRIDGE_TEST_SHARED_LIBRARY "lib${LUABRIDGE_TESTLIB_NAME}.so")
endif ()
target_compile_definitions (${LUABRIDGE_TEST_NAME} PRIVATE
LUABRIDGEDEMO_SHARED_LIBRARY="${LUABRIDGE_TEST_SHARED_LIBRARY}"
LUABRIDGEDEMO_SHARED_EXPORT=0)
LUABRIDGE_TEST_SHARED_LIBRARY="${LUABRIDGE_TEST_SHARED_LIBRARY}"
LUABRIDGE_TEST_SHARED_EXPORT=0)

if (NOT ${LUABRIDGE_EXCEPTIONS})
target_compile_definitions (${LUABRIDGE_TEST_NAME} PRIVATE LUA_USE_LONGJMP=1)
Expand Down
20 changes: 10 additions & 10 deletions Tests/Lua/LuaLibrary.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,24 @@
// This determines which version of Lua to use.
// The value is the same as LUA_VERSION_NUM in lua.h

#ifndef LUABRIDGEDEMO_LUA_VERSION
#define LUABRIDGEDEMO_LUA_VERSION 504 // By default use 5.4
#ifndef LUABRIDGE_TEST_LUA_VERSION
#define LUABRIDGE_TEST_LUA_VERSION 504 // By default use 5.4
#endif

#if !defined(LUALIBRARY_SOURCE)

#if LUABRIDGEDEMO_LUAU
#if LUABRIDGE_TEST_LUAU
#include "../../ThirdParty/luau/VM/include/lua.h"
#include "../../ThirdParty/luau/VM/include/luaconf.h"
#include "../../ThirdParty/luau/VM/include/lualib.h"

#elif LUABRIDGEDEMO_RAVI
#elif LUABRIDGE_TEST_RAVI
#include "../../ThirdParty/ravi/include/lua.hpp"

#elif LUABRIDGEDEMO_LUAJIT
#elif LUABRIDGE_TEST_LUAJIT
#include "LuaJIT.2.1/src/lua.hpp"

#elif LUABRIDGEDEMO_LUA_VERSION >= 504
#elif LUABRIDGE_TEST_LUA_VERSION >= 504
#ifdef __cplusplus
#include "Lua.5.4.6/src/lua.hpp"
#else
Expand All @@ -58,7 +58,7 @@
#include "Lua.5.4.6/src/lauxlib.h"
#endif

#elif LUABRIDGEDEMO_LUA_VERSION >= 503
#elif LUABRIDGE_TEST_LUA_VERSION >= 503
#ifdef __cplusplus
#include "Lua.5.3.6/src/lua.hpp"
#else
Expand All @@ -67,7 +67,7 @@
#include "Lua.5.3.6/src/lauxlib.h"
#endif

#elif LUABRIDGEDEMO_LUA_VERSION >= 502
#elif LUABRIDGE_TEST_LUA_VERSION >= 502
#ifdef __cplusplus
#include "Lua.5.2.4/src/lua.hpp"
#else
Expand All @@ -76,7 +76,7 @@
#include "Lua.5.2.4/src/lauxlib.h"
#endif

#elif LUABRIDGEDEMO_LUA_VERSION >= 501
#elif LUABRIDGE_TEST_LUA_VERSION >= 501
#ifdef __cplusplus
extern "C" {
#endif
Expand All @@ -90,6 +90,6 @@ extern "C" {
#else
#error "Unknown LUA_VERSION_NUM"

#endif // LUABRIDGEDEMO_*
#endif // LUABRIDGE_TEST_*

#endif // LUALIBRARY_SOURCE
2 changes: 1 addition & 1 deletion Tests/Lua/LuaLibrary5.1.5.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#define LUALIBRARY_SOURCE
#include "LuaLibrary.h"

#if LUABRIDGEDEMO_LUA_VERSION == 501
#if LUABRIDGE_TEST_LUA_VERSION == 501

#if _MSC_VER
#pragma push_macro("_CRT_SECURE_NO_WARNINGS")
Expand Down
4 changes: 2 additions & 2 deletions Tests/Lua/LuaLibrary5.2.4.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#define LUALIBRARY_SOURCE
#include "Lua/LuaLibrary.h"

#if LUABRIDGEDEMO_LUA_VERSION == 502
#if LUABRIDGE_TEST_LUA_VERSION == 502

#if _MSC_VER
#pragma push_macro("_CRT_SECURE_NO_WARNINGS")
Expand Down Expand Up @@ -133,4 +133,4 @@ extern "C"
#else
void dummy_symbol_lua52() {}

#endif // LUABRIDGEDEMO_LUA_VERSION == 502
#endif // LUABRIDGE_TEST_LUA_VERSION == 502
4 changes: 2 additions & 2 deletions Tests/Lua/LuaLibrary5.3.6.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#define LUALIBRARY_SOURCE
#include "Lua/LuaLibrary.h"

#if LUABRIDGEDEMO_LUA_VERSION == 503
#if LUABRIDGE_TEST_LUA_VERSION == 503

#if _MSC_VER
#pragma push_macro("_CRT_SECURE_NO_WARNINGS")
Expand Down Expand Up @@ -134,4 +134,4 @@ extern "C"
#else
void dummy_symbol_lua53() {}

#endif // LUABRIDGEDEMO_LUA_VERSION == 503
#endif // LUABRIDGE_TEST_LUA_VERSION == 503
4 changes: 2 additions & 2 deletions Tests/Lua/LuaLibrary5.4.6.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#define LUALIBRARY_SOURCE
#include "Lua/LuaLibrary.h"

#if LUABRIDGEDEMO_LUA_VERSION == 504
#if LUABRIDGE_TEST_LUA_VERSION == 504

#if _MSC_VER
#pragma push_macro("_CRT_SECURE_NO_WARNINGS")
Expand Down Expand Up @@ -135,4 +135,4 @@ extern "C"
#else
void dummy_symbol_lua54() {}

#endif // LUABRIDGEDEMO_LUA_VERSION = 504
#endif // LUABRIDGE_TEST_LUA_VERSION = 504
4 changes: 2 additions & 2 deletions Tests/Lua/Luau.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#define LUALIBRARY_SOURCE
#include "Lua/LuaLibrary.h"

#if LUABRIDGEDEMO_LUAU
#if LUABRIDGE_TEST_LUAU

#if _MSC_VER
#pragma push_macro("_CRT_SECURE_NO_WARNINGS")
Expand Down Expand Up @@ -83,4 +83,4 @@
#else
void dummy_symbol_luau() {}

#endif // LUABRIDGEDEMO_LUAU
#endif // LUABRIDGE_TEST_LUAU
4 changes: 2 additions & 2 deletions Tests/Lua/LuauSplit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#define LUALIBRARY_SOURCE
#include "Lua/LuaLibrary.h"

#if LUABRIDGEDEMO_LUAU
#if LUABRIDGE_TEST_LUAU

#if _MSC_VER
#pragma push_macro("_CRT_SECURE_NO_WARNINGS")
Expand Down Expand Up @@ -65,4 +65,4 @@
#else
void dummy_symbol_luau2() {}

#endif // LUABRIDGEDEMO_LUAU
#endif // LUABRIDGE_TEST_LUAU
2 changes: 1 addition & 1 deletion Tests/Source/ClassExtensibleTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ TEST_F(ClassExtensibleTests, MetatableSecurity)
}
}

#if ! LUABRIDGEDEMO_LUAU && LUABRIDGEDEMO_LUA_VERSION >= 502
#if ! LUABRIDGE_TEST_LUAU && LUABRIDGE_TEST_LUA_VERSION >= 502
TEST_F(ClassExtensibleTests, MetatablePrinting)
{
luabridge::getGlobalNamespace(L)
Expand Down
6 changes: 3 additions & 3 deletions Tests/Source/CoroutineTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
namespace {
int lua_resume_x(lua_State* L, int nargs)
{
#if LUABRIDGEDEMO_LUAJIT || LUA_VERSION_NUM == 501
#if LUABRIDGE_TEST_LUAJIT || LUA_VERSION_NUM == 501
return lua_resume(L, nargs);
#elif LUABRIDGEDEMO_LUAU || LUABRIDGEDEMO_RAVI || LUA_VERSION_NUM < 504
#elif LUABRIDGE_TEST_LUAU || LUABRIDGE_TEST_RAVI || LUA_VERSION_NUM < 504
return lua_resume(L, nullptr, nargs);
#else
[[maybe_unused]] int nresults = 0;
Expand Down Expand Up @@ -163,7 +163,7 @@ TEST_F(CoroutineTests, ThreadedRegistration)
auto env = luaL_ref(thread1, LUA_REGISTRYINDEX);
lua_rawgeti(thread1, LUA_REGISTRYINDEX, env);

#if LUABRIDGEDEMO_LUAU || LUABRIDGEDEMO_LUAJIT || LUABRIDGEDEMO_LUA_VERSION == 501
#if LUABRIDGE_TEST_LUAU || LUABRIDGE_TEST_LUAJIT || LUABRIDGE_TEST_LUA_VERSION == 501
lua_setfenv(thread1, 1);
#else
auto upvalue = lua_setupvalue(thread1, -2, 1);
Expand Down
2 changes: 1 addition & 1 deletion Tests/Source/DynamicLibraryTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ struct DynamicLibraryTests : TestBase
if (! executablePath.has_value())
return nullptr;

auto libraryPath = executablePath->remove_filename() / LUABRIDGEDEMO_SHARED_LIBRARY;
auto libraryPath = executablePath->remove_filename() / LUABRIDGE_TEST_SHARED_LIBRARY;
if (! std::filesystem::exists(libraryPath))
return nullptr;

Expand Down
16 changes: 8 additions & 8 deletions Tests/Source/LuaRefTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,13 +337,13 @@ TEST_F(LuaRefTests, Comparison)
EXPECT_TRUE(t2 == t2);
EXPECT_FALSE(t2 == t3);

#if LUABRIDGEDEMO_LUA_VERSION >= 503 && !LUABRIDGE_ON_LUAU && !LUABRIDGE_ON_LUAJIT
#if LUABRIDGE_TEST_LUA_VERSION >= 503 && !LUABRIDGE_ON_LUAU && !LUABRIDGE_ON_LUAJIT
// This has changed in lua 5.3 and is quite a behaviour change
EXPECT_TRUE(t2 == t4);
#else
EXPECT_FALSE(t2 == t4);
#endif

EXPECT_TRUE(t3 == t3);
EXPECT_FALSE(t3 == t4);

Expand Down Expand Up @@ -440,7 +440,7 @@ TEST_F(LuaRefTests, Assignment)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wself-assign-overloaded"
#endif

value = value;

#if __clang__
Expand Down Expand Up @@ -497,7 +497,7 @@ TEST_F(LuaRefTests, Callable)
runLua("x = 1");
auto x = luabridge::getGlobal(L, "x");
EXPECT_FALSE(x.isCallable());

runLua("meta1 = { __call = function(self) return 5 end }");
auto meta1 = luabridge::getGlobal(L, "meta1");
EXPECT_FALSE(meta1.isCallable());
Expand Down Expand Up @@ -701,7 +701,7 @@ TEST_F(LuaRefTests, RegisterLambdaInTable)
.addFunction("GetLocalHero", [&]() {
auto table = luabridge::newTable(L);
table.push(L);

luabridge::getNamespaceFromStack(L)
.addProperty("index", [] { return 150; })
.addFunction("Health", [&] { return 500; });
Expand All @@ -710,7 +710,7 @@ TEST_F(LuaRefTests, RegisterLambdaInTable)
return table;
})
.endNamespace();

runLua("result = Entities.GetLocalHero().Health()");
ASSERT_EQ(500, result<int>());
}
Expand All @@ -735,7 +735,7 @@ TEST_F(LuaRefTests, RegisterLambdaInFunction)

luabridge::setGlobal(L, luabridge::newFunction(L, [](const Class* obj, int x) { return obj->test() + x; }), "takeClass");
luabridge::setGlobal(L, luabridge::newFunction(L, [](Class* obj, int x, int y, lua_State* L) { return obj->test() + x + y + lua_gettop(L); }), "takeClassState");

runLua("obj = Class(); result = takeClass (obj, 10)");
ASSERT_EQ(1 + 10, result<int>());

Expand All @@ -753,7 +753,7 @@ TEST_F(LuaRefTests, HookTesting)

luabridge::getGlobalNamespace(L)
.addFunction("Hook", hook);

runLua(R"(
function hook1(type, packet)
print("lol")
Expand Down
8 changes: 4 additions & 4 deletions Tests/Source/SharedCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class SharedClass : public ISharedClass
int value = 42;
};

class LUABRIDGEDEMO_SHARED_API AnotherClass
class LUABRIDGE_TEST_SHARED_API AnotherClass
{
public:
AnotherClass() = default;
Expand All @@ -42,17 +42,17 @@ class LUABRIDGEDEMO_SHARED_API AnotherClass
} // namespace xyz

extern "C" {
LUABRIDGEDEMO_SHARED_API xyz::ISharedClass* allocator()
LUABRIDGE_TEST_SHARED_API xyz::ISharedClass* allocator()
{
return new xyz::SharedClass();
}

LUABRIDGEDEMO_SHARED_API void deallocator(xyz::ISharedClass* ptr)
LUABRIDGE_TEST_SHARED_API void deallocator(xyz::ISharedClass* ptr)
{
delete ptr;
}

LUABRIDGEDEMO_SHARED_API void registerAnotherClass(lua_State* L)
LUABRIDGE_TEST_SHARED_API void registerAnotherClass(lua_State* L)
{
luabridge::getGlobalNamespace(L)
.beginNamespace("dll")
Expand Down
10 changes: 5 additions & 5 deletions Tests/Source/SharedCode.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
#include "Lua/LuaLibrary.h"

#if _WIN32
#if LUABRIDGEDEMO_SHARED_EXPORT
#define LUABRIDGEDEMO_SHARED_API __declspec(dllexport)
#if LUABRIDGE_TEST_SHARED_EXPORT
#define LUABRIDGE_TEST_SHARED_API __declspec(dllexport)
#else
#define LUABRIDGEDEMO_SHARED_API __declspec(dllimport)
#define LUABRIDGE_TEST_SHARED_API __declspec(dllimport)
#endif
#else
#define LUABRIDGEDEMO_SHARED_API
#define LUABRIDGE_TEST_SHARED_API
#endif

#include <string>

namespace xyz {

class LUABRIDGEDEMO_SHARED_API ISharedClass
class LUABRIDGE_TEST_SHARED_API ISharedClass
{
public:
ISharedClass();
Expand Down

0 comments on commit 1c34733

Please sign in to comment.