diff options
| author | Benoit Germain <benoit.germain@ubisoft.com> | 2025-03-13 12:31:16 +0100 |
|---|---|---|
| committer | Benoit Germain <benoit.germain@ubisoft.com> | 2025-03-13 12:31:16 +0100 |
| commit | c0555fd48ee1f56c9ea6f8df99af97f78bdcf6ce (patch) | |
| tree | 2d176f8d2acc914fb38949893e76858c13843bf8 /unit_tests | |
| parent | fb03f0e208801406400334014ebcf453ff6f1db0 (diff) | |
| download | lanes-c0555fd48ee1f56c9ea6f8df99af97f78bdcf6ce.tar.gz lanes-c0555fd48ee1f56c9ea6f8df99af97f78bdcf6ce.tar.bz2 lanes-c0555fd48ee1f56c9ea6f8df99af97f78bdcf6ce.zip | |
Disable unit test "lanes.stack checker" in Release builds
Diffstat (limited to 'unit_tests')
| -rw-r--r-- | unit_tests/scripts/lane/uncooperative_shutdown.lua | 2 | ||||
| -rw-r--r-- | unit_tests/shared.cpp | 27 |
2 files changed, 22 insertions, 7 deletions
diff --git a/unit_tests/scripts/lane/uncooperative_shutdown.lua b/unit_tests/scripts/lane/uncooperative_shutdown.lua index ce7df57..56c936b 100644 --- a/unit_tests/scripts/lane/uncooperative_shutdown.lua +++ b/unit_tests/scripts/lane/uncooperative_shutdown.lua | |||
| @@ -12,7 +12,7 @@ local lane = function() | |||
| 12 | end | 12 | end |
| 13 | 13 | ||
| 14 | -- the generator | 14 | -- the generator |
| 15 | local g1 = lanes.gen("*", lane) | 15 | local g1 = lanes.gen("*", {name = "auto"}, lane) |
| 16 | 16 | ||
| 17 | -- launch lane | 17 | -- launch lane |
| 18 | local h1 = g1() | 18 | local h1 = g1() |
diff --git a/unit_tests/shared.cpp b/unit_tests/shared.cpp index 08025f2..f9697a5 100644 --- a/unit_tests/shared.cpp +++ b/unit_tests/shared.cpp | |||
| @@ -104,12 +104,11 @@ namespace | |||
| 104 | // ################################################################################################# | 104 | // ################################################################################################# |
| 105 | // ################################################################################################# | 105 | // ################################################################################################# |
| 106 | 106 | ||
| 107 | #if HAVE_LUA_ASSERT() | ||
| 107 | TEST_CASE("lanes.stack checker") | 108 | TEST_CASE("lanes.stack checker") |
| 108 | { | 109 | { |
| 109 | LuaState _L{ LuaState::WithBaseLibs{ true }, LuaState::WithFixture{ false } }; | 110 | LuaState _L{ LuaState::WithBaseLibs{ true }, LuaState::WithFixture{ false } }; |
| 110 | #if HAVE_LUA_ASSERT() | ||
| 111 | StackChecker::CallsCassert = false; | 111 | StackChecker::CallsCassert = false; |
| 112 | #endif // HAVE_LUA_ASSERT() | ||
| 113 | 112 | ||
| 114 | auto _doStackCheckerTest = [&_L](lua_CFunction const _f, LuaError const _expected) { | 113 | auto _doStackCheckerTest = [&_L](lua_CFunction const _f, LuaError const _expected) { |
| 115 | lua_pushcfunction(_L, _f); | 114 | lua_pushcfunction(_L, _f); |
| @@ -152,11 +151,27 @@ TEST_CASE("lanes.stack checker") | |||
| 152 | return 0; | 151 | return 0; |
| 153 | }; | 152 | }; |
| 154 | 153 | ||
| 155 | _doStackCheckerTest(_unbalancedStack1, LuaError::ERRRUN); | 154 | SECTION("unbalanced stack") |
| 156 | _doStackCheckerTest(_balancedStack1, LuaError::OK); | 155 | { |
| 157 | _doStackCheckerTest(_goodStart, LuaError::OK); | 156 | _doStackCheckerTest(_unbalancedStack1, LuaError::ERRRUN); |
| 158 | _doStackCheckerTest(_badStart, LuaError::ERRRUN); | 157 | } |
| 158 | |||
| 159 | SECTION("balanced stack") | ||
| 160 | { | ||
| 161 | _doStackCheckerTest(_balancedStack1, LuaError::OK); | ||
| 162 | } | ||
| 163 | |||
| 164 | SECTION("good start") | ||
| 165 | { | ||
| 166 | _doStackCheckerTest(_goodStart, LuaError::OK); | ||
| 167 | } | ||
| 168 | |||
| 169 | SECTION("bad start") | ||
| 170 | { | ||
| 171 | _doStackCheckerTest(_badStart, LuaError::ERRRUN); | ||
| 172 | } | ||
| 159 | } | 173 | } |
| 174 | #endif // HAVE_LUA_ASSERT() | ||
| 160 | 175 | ||
| 161 | // ################################################################################################# | 176 | // ################################################################################################# |
| 162 | // ################################################################################################# | 177 | // ################################################################################################# |
