From 1c34733cbbcbbbd512eeac7374939efbaa651a3a Mon Sep 17 00:00:00 2001 From: kunitoki Date: Fri, 27 Sep 2024 10:03:36 +0200 Subject: [PATCH] Fix CI --- .github/workflows/build_macos.yml | 4 ++-- .github/workflows/build_windows.yml | 5 +++-- Tests/CMakeLists.txt | 22 +++++++++++----------- Tests/Lua/LuaLibrary.h | 20 ++++++++++---------- Tests/Lua/LuaLibrary5.1.5.c | 2 +- Tests/Lua/LuaLibrary5.2.4.c | 4 ++-- Tests/Lua/LuaLibrary5.3.6.c | 4 ++-- Tests/Lua/LuaLibrary5.4.6.c | 4 ++-- Tests/Lua/Luau.cpp | 4 ++-- Tests/Lua/LuauSplit.cpp | 4 ++-- Tests/Source/ClassExtensibleTests.cpp | 2 +- Tests/Source/CoroutineTests.cpp | 6 +++--- Tests/Source/DynamicLibraryTests.cpp | 2 +- Tests/Source/LuaRefTests.cpp | 16 ++++++++-------- Tests/Source/SharedCode.cpp | 8 ++++---- Tests/Source/SharedCode.h | 10 +++++----- 16 files changed, 59 insertions(+), 58 deletions(-) diff --git a/.github/workflows/build_macos.yml b/.github/workflows/build_macos.yml index 289f9bf1..9ac1214c 100644 --- a/.github/workflows/build_macos.yml +++ b/.github/workflows/build_macos.yml @@ -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 diff --git a/.github/workflows/build_windows.yml b/.github/workflows/build_windows.yml index 64f619f8..e328c251 100644 --- a/.github/workflows/build_windows.yml +++ b/.github/workflows/build_windows.yml @@ -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 diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 6162d1f0..6de0f558 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -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 @@ -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) @@ -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) diff --git a/Tests/Lua/LuaLibrary.h b/Tests/Lua/LuaLibrary.h index 8593046a..4b98e1e0 100644 --- a/Tests/Lua/LuaLibrary.h +++ b/Tests/Lua/LuaLibrary.h @@ -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 @@ -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 @@ -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 @@ -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 @@ -90,6 +90,6 @@ extern "C" { #else #error "Unknown LUA_VERSION_NUM" -#endif // LUABRIDGEDEMO_* +#endif // LUABRIDGE_TEST_* #endif // LUALIBRARY_SOURCE diff --git a/Tests/Lua/LuaLibrary5.1.5.c b/Tests/Lua/LuaLibrary5.1.5.c index 697051af..ba5a2443 100644 --- a/Tests/Lua/LuaLibrary5.1.5.c +++ b/Tests/Lua/LuaLibrary5.1.5.c @@ -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") diff --git a/Tests/Lua/LuaLibrary5.2.4.c b/Tests/Lua/LuaLibrary5.2.4.c index 24d0e911..2df937f6 100644 --- a/Tests/Lua/LuaLibrary5.2.4.c +++ b/Tests/Lua/LuaLibrary5.2.4.c @@ -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") @@ -133,4 +133,4 @@ extern "C" #else void dummy_symbol_lua52() {} -#endif // LUABRIDGEDEMO_LUA_VERSION == 502 +#endif // LUABRIDGE_TEST_LUA_VERSION == 502 diff --git a/Tests/Lua/LuaLibrary5.3.6.c b/Tests/Lua/LuaLibrary5.3.6.c index 1f75b9bf..1e359df1 100644 --- a/Tests/Lua/LuaLibrary5.3.6.c +++ b/Tests/Lua/LuaLibrary5.3.6.c @@ -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") @@ -134,4 +134,4 @@ extern "C" #else void dummy_symbol_lua53() {} -#endif // LUABRIDGEDEMO_LUA_VERSION == 503 +#endif // LUABRIDGE_TEST_LUA_VERSION == 503 diff --git a/Tests/Lua/LuaLibrary5.4.6.c b/Tests/Lua/LuaLibrary5.4.6.c index 1f9ce94a..e361c50b 100644 --- a/Tests/Lua/LuaLibrary5.4.6.c +++ b/Tests/Lua/LuaLibrary5.4.6.c @@ -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") @@ -135,4 +135,4 @@ extern "C" #else void dummy_symbol_lua54() {} -#endif // LUABRIDGEDEMO_LUA_VERSION = 504 +#endif // LUABRIDGE_TEST_LUA_VERSION = 504 diff --git a/Tests/Lua/Luau.cpp b/Tests/Lua/Luau.cpp index a5a26325..401e2a14 100644 --- a/Tests/Lua/Luau.cpp +++ b/Tests/Lua/Luau.cpp @@ -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") @@ -83,4 +83,4 @@ #else void dummy_symbol_luau() {} -#endif // LUABRIDGEDEMO_LUAU +#endif // LUABRIDGE_TEST_LUAU diff --git a/Tests/Lua/LuauSplit.cpp b/Tests/Lua/LuauSplit.cpp index 48d6b13f..f1de64fb 100644 --- a/Tests/Lua/LuauSplit.cpp +++ b/Tests/Lua/LuauSplit.cpp @@ -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") @@ -65,4 +65,4 @@ #else void dummy_symbol_luau2() {} -#endif // LUABRIDGEDEMO_LUAU +#endif // LUABRIDGE_TEST_LUAU diff --git a/Tests/Source/ClassExtensibleTests.cpp b/Tests/Source/ClassExtensibleTests.cpp index 54f33e7c..f6e28a27 100644 --- a/Tests/Source/ClassExtensibleTests.cpp +++ b/Tests/Source/ClassExtensibleTests.cpp @@ -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) diff --git a/Tests/Source/CoroutineTests.cpp b/Tests/Source/CoroutineTests.cpp index 47ac8523..b9987b03 100644 --- a/Tests/Source/CoroutineTests.cpp +++ b/Tests/Source/CoroutineTests.cpp @@ -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; @@ -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); diff --git a/Tests/Source/DynamicLibraryTests.cpp b/Tests/Source/DynamicLibraryTests.cpp index f2f089d9..ec24c557 100644 --- a/Tests/Source/DynamicLibraryTests.cpp +++ b/Tests/Source/DynamicLibraryTests.cpp @@ -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; diff --git a/Tests/Source/LuaRefTests.cpp b/Tests/Source/LuaRefTests.cpp index 62d4cbf4..42496434 100644 --- a/Tests/Source/LuaRefTests.cpp +++ b/Tests/Source/LuaRefTests.cpp @@ -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); @@ -440,7 +440,7 @@ TEST_F(LuaRefTests, Assignment) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wself-assign-overloaded" #endif - + value = value; #if __clang__ @@ -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()); @@ -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; }); @@ -710,7 +710,7 @@ TEST_F(LuaRefTests, RegisterLambdaInTable) return table; }) .endNamespace(); - + runLua("result = Entities.GetLocalHero().Health()"); ASSERT_EQ(500, result()); } @@ -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()); @@ -753,7 +753,7 @@ TEST_F(LuaRefTests, HookTesting) luabridge::getGlobalNamespace(L) .addFunction("Hook", hook); - + runLua(R"( function hook1(type, packet) print("lol") diff --git a/Tests/Source/SharedCode.cpp b/Tests/Source/SharedCode.cpp index 873ee066..49a4b0c3 100644 --- a/Tests/Source/SharedCode.cpp +++ b/Tests/Source/SharedCode.cpp @@ -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; @@ -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") diff --git a/Tests/Source/SharedCode.h b/Tests/Source/SharedCode.h index 59f6a642..c10e531a 100644 --- a/Tests/Source/SharedCode.h +++ b/Tests/Source/SharedCode.h @@ -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 namespace xyz { -class LUABRIDGEDEMO_SHARED_API ISharedClass +class LUABRIDGE_TEST_SHARED_API ISharedClass { public: ISharedClass();