mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-06 17:41:04 +00:00
Extend error case tests
This commit is contained in:
parent
535db2be76
commit
d8640759d6
4 changed files with 25 additions and 4 deletions
2
.github/workflows/linux.yml
vendored
2
.github/workflows/linux.yml
vendored
|
@ -14,6 +14,7 @@ on:
|
||||||
- 'cmake/Modules/**'
|
- 'cmake/Modules/**'
|
||||||
- 'po/**.po'
|
- 'po/**.po'
|
||||||
- 'util/ci/**'
|
- 'util/ci/**'
|
||||||
|
- 'util/helper_mod/**'
|
||||||
- '.github/workflows/linux.yml'
|
- '.github/workflows/linux.yml'
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
|
@ -27,6 +28,7 @@ on:
|
||||||
- 'cmake/Modules/**'
|
- 'cmake/Modules/**'
|
||||||
- 'po/**.po'
|
- 'po/**.po'
|
||||||
- 'util/ci/**'
|
- 'util/ci/**'
|
||||||
|
- 'util/helper_mod/**'
|
||||||
- '.github/workflows/linux.yml'
|
- '.github/workflows/linux.yml'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
|
|
@ -51,7 +51,7 @@ elseif mode == "mapgen" then
|
||||||
elseif mode == "error" then
|
elseif mode == "error" then
|
||||||
|
|
||||||
local n = tonumber(core.settings:get("error_type"))
|
local n = tonumber(core.settings:get("error_type"))
|
||||||
local error_lua = core.get_modpath(core.get_current_modname()) .. "/error.lua"
|
local modpath = core.get_modpath(core.get_current_modname())
|
||||||
if n == 1 then
|
if n == 1 then
|
||||||
print("=> error during startup <=")
|
print("=> error during startup <=")
|
||||||
error("intentional")
|
error("intentional")
|
||||||
|
@ -60,10 +60,26 @@ elseif mode == "error" then
|
||||||
core.after(0, error, "intentional")
|
core.after(0, error, "intentional")
|
||||||
elseif n == 3 then
|
elseif n == 3 then
|
||||||
print("=> error in async script <=")
|
print("=> error in async script <=")
|
||||||
core.register_async_dofile(error_lua)
|
core.register_async_dofile(modpath .. "/error.lua")
|
||||||
elseif n == 4 then
|
elseif n == 4 then
|
||||||
print("=> error in mapgen script <=")
|
print("=> error in mapgen script <=")
|
||||||
core.register_mapgen_script(error_lua)
|
core.register_mapgen_script(modpath .. "/error.lua")
|
||||||
|
elseif n == 5 then
|
||||||
|
print("=> error in mapgen env callback <=")
|
||||||
|
core.register_mapgen_script(modpath .. "/mapgen_error.lua")
|
||||||
|
core.after(0, function()
|
||||||
|
-- emerge something to trigger it
|
||||||
|
core.emerge_area(vector.new(0,0,0), vector.new(1,1,1), function(pos, action)
|
||||||
|
print("action=" .. action)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
elseif n == 6 then
|
||||||
|
print("=> error in emerge_area callback <=")
|
||||||
|
core.after(0, function()
|
||||||
|
core.emerge_area(vector.new(0,0,0), vector.new(1,1,1), function()
|
||||||
|
error("intentional")
|
||||||
|
end)
|
||||||
|
end)
|
||||||
else
|
else
|
||||||
assert(false)
|
assert(false)
|
||||||
end
|
end
|
||||||
|
|
3
util/helper_mod/mapgen_error.lua
Normal file
3
util/helper_mod/mapgen_error.lua
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
core.register_on_generated(function()
|
||||||
|
error("intentional")
|
||||||
|
end)
|
|
@ -36,7 +36,7 @@ export ASAN_OPTIONS="exitcode=42"
|
||||||
export MSAN_OPTIONS="exitcode=42"
|
export MSAN_OPTIONS="exitcode=42"
|
||||||
|
|
||||||
# see helper_mod/init.lua for the different types
|
# see helper_mod/init.lua for the different types
|
||||||
for n in $(seq 1 4); do
|
for n in $(seq 1 6); do
|
||||||
write_config error_type=$n
|
write_config error_type=$n
|
||||||
run "$executable" "${args[@]}"
|
run "$executable" "${args[@]}"
|
||||||
echo "---------------"
|
echo "---------------"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue