mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Some test printouts to help us debug the MinGW x86 explosion
This commit is contained in:
parent
b78d900d05
commit
d26f0ea0e5
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -116,3 +116,4 @@ scratch/
|
|||
.idea/
|
||||
cmake-build-debug/
|
||||
cmake-build-relwithdebinfo/
|
||||
cmake-build-release/
|
||||
|
|
33
.travis.yml
33
.travis.yml
|
@ -41,8 +41,8 @@ script:
|
|||
matrix:
|
||||
fast_finish: true
|
||||
allow_failures:
|
||||
- env:
|
||||
- ALLOW_FAILURE=true
|
||||
- os: osx
|
||||
|
||||
include:
|
||||
# GCC 4.9.x, 5.x, 6.x, 7.x
|
||||
- env:
|
||||
|
@ -148,12 +148,29 @@ matrix:
|
|||
GCC_VERSION=7
|
||||
PLATFORM=x64
|
||||
CI=true
|
||||
|
||||
- env:
|
||||
- LUA_VERSION=luajit-2.1.0-beta3
|
||||
GCC_VERSION=7
|
||||
PLATFORM=x64
|
||||
CI=true
|
||||
|
||||
# XCode / Mac builds
|
||||
- os: osx
|
||||
osx_image: xcode8.3
|
||||
env:
|
||||
- LUA_VERSION=lua-5.3.4
|
||||
LLVM_VERSION=5.0.1
|
||||
before_install:
|
||||
- brew update > /dev/null
|
||||
- brew install zsh git ninja cmake python
|
||||
script:
|
||||
- ./scripts/run.osx.sh
|
||||
|
||||
- os: osx
|
||||
osx_image: xcode9.2
|
||||
env:
|
||||
- LUA_VERSION=lua-5.3.4
|
||||
LLVM_VERSION=5.0.1
|
||||
before_install:
|
||||
- brew update > /dev/null
|
||||
- brew install zsh git ninja cmake python
|
||||
script:
|
||||
- ./scripts/run.osx.sh
|
||||
|
||||
notifications:
|
||||
webhooks:
|
||||
|
|
|
@ -70,7 +70,7 @@ add_library(${catch_lib} INTERFACE)
|
|||
target_include_directories(${catch_lib} INTERFACE ${catch_include_dirs})
|
||||
|
||||
if (MSVC)
|
||||
target_add_compile_options(${catch_lib} INTERFACE
|
||||
target_compile_options(${catch_lib} INTERFACE
|
||||
/D_SILENCE_CXX17_UNCAUGHT_EXCEPTION_DEPRECATION_WARNING)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -373,6 +373,11 @@ set_target_properties(${lualib}
|
|||
PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES C
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${LUA_JIT_SOURCE_DIR}")
|
||||
if (CMAKE_DL_LIBS)
|
||||
set_target_properties(${lualib}
|
||||
PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
if (XCODE)
|
||||
target_compile_options(${lualib}
|
||||
PUBLIC -pagezero_size 10000 -image_base 100000000)
|
||||
|
@ -380,7 +385,7 @@ endif ()
|
|||
|
||||
# # Lua Executable
|
||||
add_executable(${luainterpreter} IMPORTED)
|
||||
# Point EXE to fiel
|
||||
# Add location pointing to executable
|
||||
set_target_properties(${luainterpreter}
|
||||
PROPERTIES
|
||||
IMPORTED_LOCATION "${LUA_JIT_EXE_FILE}")
|
||||
|
|
|
@ -77,6 +77,9 @@ else()
|
|||
INTERFACE -Wno-noexcept-type
|
||||
PUBLIC -Wno-ignored-qualifiers -Wno-unused-parameter)
|
||||
endif()
|
||||
if (CMAKE_DL_LIBS)
|
||||
target_link_libraries(${toluapp_lib} PRIVATE ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
# add compatibility define
|
||||
target_compile_definitions(${toluapp_lib}
|
||||
PRIVATE COMPAT53_PREFIX=toluapp_compat53)
|
||||
|
|
19
scripts/run.osx.sh
Normal file
19
scripts/run.osx.sh
Normal file
|
@ -0,0 +1,19 @@
|
|||
mkdir -p build-sol2/Debug
|
||||
mkdir -p build-sol2/Release
|
||||
cd build-sol2
|
||||
|
||||
echo "=== Compiler and tool variables ==="
|
||||
ninja --version
|
||||
cmake --version
|
||||
|
||||
cd Debug
|
||||
cmake ${SOL2_DIR} -G Xcode -DCMAKE_BUILD_TYPE=Debug -DLUA_VERSION="${LUA_VERSION}" -DCI=ON -DPLATFORM=${PLATFORM} -DBUILD_LUA=ON -DBUILD_LUA_AS_DLL=OFF -DTESTS=ON -DEXAMPLES=ON -DSINGLE=ON -DTESTS_EXAMPLES=ON -DEXAMPLES_SINGLE=ON -DTESTS_SINGLE=ON
|
||||
cmake --build . --config Debug
|
||||
ctest --build-config Debug --output-on-failure
|
||||
cd ..
|
||||
|
||||
cd Release
|
||||
cmake ${SOL2_DIR} -G Xcode -DCMAKE_BUILD_TYPE=Release -DLUA_VERSION="${LUA_VERSION}" -DCI=ON -DPLATFORM=${PLATFORM} -DBUILD_LUA=ON -DBUILD_LUA_AS_DLL=OFF -DTESTS=ON -DEXAMPLES=ON -DSINGLE=ON -DTESTS_EXAMPLES=ON -DEXAMPLES_SINGLE=ON -DTESTS_SINGLE=ON
|
||||
cmake --build . --config Release
|
||||
ctest --build-config Release --output-on-failure
|
||||
cd ..
|
|
@ -532,53 +532,53 @@ end
|
|||
}
|
||||
|
||||
TEST_CASE("coroutines/yielding", "test that a sol2 bound function can yield when marked yieldable") {
|
||||
sol::state lua;
|
||||
lua.open_libraries(sol::lib::base, sol::lib::coroutine);
|
||||
|
||||
int i = 0;
|
||||
auto func = [&i]() {
|
||||
++i;
|
||||
return i;
|
||||
};
|
||||
|
||||
struct h {
|
||||
int x = 500;
|
||||
int func() const {
|
||||
return x;
|
||||
}
|
||||
} hobj{};
|
||||
|
||||
lua["f"] = sol::yielding(func);
|
||||
lua["g"] = sol::yielding([]() { return 300; });
|
||||
lua["h"] = sol::yielding(&h::func);
|
||||
lua["hobj"] = &hobj;
|
||||
|
||||
sol::string_view code = R"(
|
||||
co1 = coroutine.create(f)
|
||||
success1, value1 = coroutine.resume(co1)
|
||||
co2 = coroutine.create(g)
|
||||
success2, value2 = coroutine.resume(co2)
|
||||
co3 = coroutine.create(function()
|
||||
h(hobj)
|
||||
end)
|
||||
success3, value3 = coroutine.resume(co3)
|
||||
)";
|
||||
|
||||
auto result = lua.safe_script(code);
|
||||
REQUIRE(result.valid());
|
||||
sol::state lua;
|
||||
lua.open_libraries(sol::lib::base, sol::lib::coroutine);
|
||||
|
||||
bool success1 = lua["success1"];
|
||||
int value1 = lua["value1"];
|
||||
REQUIRE(success1);
|
||||
int i = 0;
|
||||
auto func = [&i]() {
|
||||
++i;
|
||||
return i;
|
||||
};
|
||||
|
||||
struct h {
|
||||
int x = 500;
|
||||
int func() const {
|
||||
return x;
|
||||
}
|
||||
} hobj{};
|
||||
|
||||
lua["f"] = sol::yielding(func);
|
||||
lua["g"] = sol::yielding([]() { return 300; });
|
||||
lua["h"] = sol::yielding(&h::func);
|
||||
lua["hobj"] = &hobj;
|
||||
|
||||
sol::string_view code = R"(
|
||||
co1 = coroutine.create(function () return f() end)
|
||||
success1, value1 = coroutine.resume(co1)
|
||||
co2 = coroutine.create(function () return g() end)
|
||||
success2, value2 = coroutine.resume(co2)
|
||||
co3 = coroutine.create(function()
|
||||
h(hobj)
|
||||
end)
|
||||
success3, value3 = coroutine.resume(co3)
|
||||
)";
|
||||
|
||||
auto result = lua.safe_script(code);
|
||||
REQUIRE(result.valid());
|
||||
|
||||
bool success1 = lua["success1"];
|
||||
int value1 = lua["value1"];
|
||||
REQUIRE(success1);
|
||||
REQUIRE(value1 == 1);
|
||||
|
||||
bool success2 = lua["success2"];
|
||||
int value2 = lua["value2"];
|
||||
REQUIRE(success2);
|
||||
bool success2 = lua["success2"];
|
||||
int value2 = lua["value2"];
|
||||
REQUIRE(success2);
|
||||
REQUIRE(value2 == 300);
|
||||
|
||||
bool success3 = lua["success3"];
|
||||
int value3 = lua["value3"];
|
||||
REQUIRE(success3);
|
||||
bool success3 = lua["success3"];
|
||||
int value3 = lua["value3"];
|
||||
REQUIRE(success3);
|
||||
REQUIRE(value3 == 500);
|
||||
}
|
||||
|
|
|
@ -645,6 +645,7 @@ TEST_CASE("usertype/nonmember-functions", "let users set non-member functions th
|
|||
}
|
||||
giver& g = lua.get<giver>("t");
|
||||
REQUIRE(g.a == 20);
|
||||
std::cout << "----- end of 1" << std::endl;
|
||||
}
|
||||
|
||||
TEST_CASE("usertype/unique-shared-ptr", "manage the conversion and use of unique and shared pointers ('unique usertypes')") {
|
||||
|
@ -673,6 +674,7 @@ TEST_CASE("usertype/unique-shared-ptr", "manage the conversion and use of unique
|
|||
REQUIRE(moreref.use_count() == sharedintref.use_count());
|
||||
}
|
||||
REQUIRE(preusecount == sharedint.use_count());
|
||||
std::cout << "----- end of 2" << std::endl;
|
||||
}
|
||||
|
||||
TEST_CASE("regressions/one", "issue number 48") {
|
||||
|
@ -691,18 +693,24 @@ TEST_CASE("regressions/one", "issue number 48") {
|
|||
REQUIRE(my_var_ref.boop == 1);
|
||||
REQUIRE(my_var_ptr->boop == 1);
|
||||
REQUIRE(std::addressof(my_var_ref) == my_var_ptr);
|
||||
std::cout << "----- end of 3" << std::endl;
|
||||
}
|
||||
|
||||
TEST_CASE("usertype/get-set-references", "properly get and set with std::ref semantics. Note that to get, we must not use Unqualified<T> on the type...") {
|
||||
std::cout << "----- in 4" << std::endl;
|
||||
sol::state lua;
|
||||
|
||||
lua.new_usertype<vars>("vars",
|
||||
"boop", &vars::boop);
|
||||
vars var{};
|
||||
vars rvar{};
|
||||
std::cout << "setting beep" << std::endl;
|
||||
lua.set("beep", var);
|
||||
std::cout << "setting rbeep" << std::endl;
|
||||
lua.set("rbeep", std::ref(rvar));
|
||||
std::cout << "getting my_var" << std::endl;
|
||||
auto& my_var = lua.get<vars>("beep");
|
||||
std::cout << "setting rbeep" << std::endl;
|
||||
auto& ref_var = lua.get<std::reference_wrapper<vars>>("rbeep");
|
||||
vars& proxy_my_var = lua["beep"];
|
||||
std::reference_wrapper<vars> proxy_ref_var = lua["rbeep"];
|
||||
|
@ -719,6 +727,7 @@ TEST_CASE("usertype/get-set-references", "properly get and set with std::ref sem
|
|||
REQUIRE(std::addressof(proxy_ref_var.get()) == std::addressof(rvar));
|
||||
REQUIRE(rvar.boop == 5);
|
||||
REQUIRE(rvar.boop == ref_var.boop);
|
||||
std::cout << "----- end of 4" << std::endl;
|
||||
}
|
||||
|
||||
TEST_CASE("usertype/private-constructible", "Check to make sure special snowflake types from Enterprise thingamahjongs work properly.") {
|
||||
|
@ -749,6 +758,7 @@ TEST_CASE("usertype/private-constructible", "Check to make sure special snowflak
|
|||
int expectednumkilled = numkilled + 1;
|
||||
REQUIRE(expectednumsaved == factory_test::num_saved);
|
||||
REQUIRE(expectednumkilled == factory_test::num_killed);
|
||||
std::cout << "----- end of 5" << std::endl;
|
||||
}
|
||||
|
||||
TEST_CASE("usertype/const-pointer", "Make sure const pointers can be taken") {
|
||||
|
@ -769,6 +779,7 @@ TEST_CASE("usertype/const-pointer", "Make sure const pointers can be taken") {
|
|||
lua.safe_script("x = b:foo(a)");
|
||||
int x = lua["x"];
|
||||
REQUIRE(x == 201);
|
||||
std::cout << "----- end of 6" << std::endl;
|
||||
}
|
||||
|
||||
TEST_CASE("usertype/overloading", "Check if overloading works properly for usertypes") {
|
||||
|
@ -806,6 +817,7 @@ TEST_CASE("usertype/overloading", "Check if overloading works properly for usert
|
|||
REQUIRE((lua["c"] == bark_58));
|
||||
auto result = lua.safe_script("r:func(1,2,'meow')", sol::script_pass_on_error);
|
||||
REQUIRE_FALSE(result.valid());
|
||||
std::cout << "----- end of 7" << std::endl;
|
||||
}
|
||||
|
||||
TEST_CASE("usertype/overloading_values", "ensure overloads handle properly") {
|
||||
|
@ -840,6 +852,7 @@ TEST_CASE("usertype/overloading_values", "ensure overloads handle properly") {
|
|||
|
||||
REQUIRE(res3 == 524);
|
||||
REQUIRE(res4 == 524);
|
||||
std::cout << "----- end of 8" << std::endl;
|
||||
}
|
||||
|
||||
TEST_CASE("usertype/reference-and-constness", "Make sure constness compiles properly and errors out at runtime") {
|
||||
|
|
Loading…
Reference in New Issue
Block a user