Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions common/testing/infologtest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

local maxErrors = 10

function skip()
local function skip()
-- TODO: re-enable. disabled 2025-10-01 in order to get CICD working
return true
end
Expand Down Expand Up @@ -48,9 +48,11 @@ local function infologTest()
return errors
end

function test()
local function test()
local errors = infologTest()
if #errors > 0 then
error(table.concat(errors, "\n"), 0)
end
end

return { skip = skip, test = test }
15 changes: 5 additions & 10 deletions luarules/gadgets/pve_builder_controller.lua
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,11 @@ function gadget:GameFrame(frame)
if #turretOptions > 1 then
local turret = turretOptions[math.random(1, #turretOptions)]
local x, y, z = Spring.GetUnitPosition(unitID)
Spring.GiveOrderToUnit(
unitID,
-turret,
{
x + math.random(-data.range, data.range),
y,
z + math.random(-data.range, data.range),
},
{}
)
Spring.GiveOrderToUnit(unitID, -turret, {
x + math.random(-data.range, data.range),
y,
z + math.random(-data.range, data.range),
}, {})
if data.isFactory then
for i = 1, math.random(1, 5) do
Spring.GiveOrderToUnit(unitID, -turret, {
Expand Down
45 changes: 16 additions & 29 deletions luarules/gadgets/scav_spawner_defense.lua
Original file line number Diff line number Diff line change
Expand Up @@ -951,15 +951,12 @@ if gadgetHandler:IsSyncedCode() then
for j = 1, unitNumber, 1 do
if mRandom() <= config.spawnChance or j == 1 then
squadCounter = squadCounter + 1
table.insert(
spawnQueue,
{
burrow = burrowID,
unitName = scavName,
team = scavTeamID,
squadID = squadCounter,
}
)
table.insert(spawnQueue, {
burrow = burrowID,
unitName = scavName,
team = scavTeamID,
squadID = squadCounter,
})
end
end
elseif not UnitDefNames[scavName] then
Expand Down Expand Up @@ -2091,27 +2088,17 @@ if gadgetHandler:IsSyncedCode() then
if turretUnitID then
setScavXP(turretUnitID)
if UnitDefNames[uName].isFactory then
Spring.GiveOrderToUnit(
turretUnitID,
CMD.FIGHT,
{
spawnPosX + mRandom(-256, 256),
spawnPosY,
spawnPosZ + mRandom(-256, 256),
},
{ "meta" }
)
Spring.GiveOrderToUnit(turretUnitID, CMD.FIGHT, {
spawnPosX + mRandom(-256, 256),
spawnPosY,
spawnPosZ + mRandom(-256, 256),
}, { "meta" })
else
Spring.GiveOrderToUnit(
turretUnitID,
CMD.PATROL,
{
spawnPosX + mRandom(-128, 128),
spawnPosY,
spawnPosZ + mRandom(-128, 128),
},
{ "meta" }
)
Spring.GiveOrderToUnit(turretUnitID, CMD.PATROL, {
spawnPosX + mRandom(-128, 128),
spawnPosY,
spawnPosZ + mRandom(-128, 128),
}, { "meta" })
end
end
until turretUnitID or attempts > 10
Expand Down
15 changes: 6 additions & 9 deletions luarules/gadgets/unit_lightning_splash_dmg.lua
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,12 @@ function gadget:ProjectileDestroyed(proID)
projectileCacheTable["end"][2] = height2
projectileCacheTable["end"][3] = newz
--spSpawnProjectile(visual_chain_weapon, projectileCacheTable)
spSpawnProjectile(
visual_chain_weapon,
{
["pos"] = { lightning.x, height1, lightning.z },
["end"] = { newx, height2, newz },
["ttl"] = 2,
["owner"] = -1,
}
)
spSpawnProjectile(visual_chain_weapon, {
["pos"] = { lightning.x, height1, lightning.z },
["end"] = { newx, height2, newz },
["ttl"] = 2,
["owner"] = -1,
})
spSpawnCEG(terminal_spark_effect, newx, height2, newz, 0, 0, 0)
end

Expand Down
10 changes: 6 additions & 4 deletions luaui/Tests/cmd_blueprint/test_cmd_blueprint_filter.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
local widgetName = "Blueprint"

function skip()
local function skip()
-- TODO re-enable and debug. Disabled 2025-09-30 to unblock CICD
-- return Spring.GetGameFrame() <= 0
return true
end

function setup()
local function setup()
assert(widgetHandler.knownWidgets[widgetName] ~= nil)

Test.clearMap()
Expand All @@ -20,14 +20,14 @@ function setup()
})
end

function cleanup()
local function cleanup()
Test.clearMap()

Spring.SetCameraState(initialCameraState)
end

local delay = 5
function test()
local function test()
assert(widget)

mock_saveBlueprintsToFile = Test.mock(widget, "saveBlueprintsToFile")
Expand Down Expand Up @@ -88,3 +88,5 @@ function test()
widget.handleBlueprintDeleteAction()
assert(widget.selectedBlueprintIndex == nil, widget.selectedBlueprintIndex)
end

return { skip = skip, setup = setup, test = test, cleanup = cleanup }
10 changes: 6 additions & 4 deletions luaui/Tests/cmd_blueprint/test_cmd_blueprint_line.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
local widgetName = "Blueprint"

function skip()
local function skip()
return not Platform.gl
end

function setup()
local function setup()
assert(widgetHandler.knownWidgets[widgetName] ~= nil)

Test.clearMap()
Expand All @@ -21,14 +21,14 @@ function setup()
})
end

function cleanup()
local function cleanup()
Test.clearMap()

Spring.SetCameraState(initialCameraState)
end

local delay = 5
function test()
local function test()
widget = widgetHandler:FindWidget(widgetName)
assert(widget)

Expand Down Expand Up @@ -119,3 +119,5 @@ function test()
assert(#builderQueue == bpCount, #builderQueue)
assertEqual(builderQueue[1].id, -blueprintUnitDefID)
end

return { skip = skip, setup = setup, test = test, cleanup = cleanup }
8 changes: 5 additions & 3 deletions luaui/Tests/cmd_blueprint/test_cmd_blueprint_single.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local widgetName = "Blueprint"

function setup()
local function setup()
assert(widgetHandler.knownWidgets[widgetName] ~= nil)

Test.clearMap()
Expand All @@ -16,14 +16,14 @@ function setup()
})
end

function cleanup()
local function cleanup()
Test.clearMap()

Spring.SetCameraState(initialCameraState)
end

local delay = 5
function test()
local function test()
widget = widgetHandler:FindWidget(widgetName)
assert(widget)

Expand Down Expand Up @@ -96,3 +96,5 @@ function test()
assertEqual(#builderQueue, 1)
assertEqual(builderQueue[1].id, -blueprintUnitDefID)
end

return { setup = setup, test = test, cleanup = cleanup }
10 changes: 6 additions & 4 deletions luaui/Tests/cmd_stop_selfd/test_cmd_stop_selfd.lua
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
function skip()
local function skip()
return Spring.GetGameFrame() <= 0
end

function setup()
local function setup()
Test.clearMap()
-- Enable UnitCommand callin for tests
Test.expectCallin("UnitCommand")
end

function cleanup()
local function cleanup()
Test.clearMap()
end

function test()
local function test()
widget = widgetHandler:FindWidget("Stop means Stop")
assert(widget, "Stop means Stop widget not found via FindWidget")

Expand Down Expand Up @@ -74,3 +74,5 @@ function test()
)
)
end

return { skip = skip, setup = setup, test = test, cleanup = cleanup }
12 changes: 7 additions & 5 deletions luaui/Tests/critters/test_critters.lua
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
function skip()
local function skip()
-- TODO re-enable and debug. Disabled 2025-12-22 to unblock CICD
return true
end

function setup()
local function setup()
Test.clearMap()
Test.levelHeightMap()

Spring.SendCommands("globallos")
Spring.SendCommands("setspeed 5")
end

function cleanup()
local function cleanup()
Spring.SendCommands("globallos")
Spring.SendCommands("setspeed 1")

Test.clearMap()
end

function runCritterTest()
local function runCritterTest()
local WAIT_FRAMES = 204 -- enough to trigger critter cleanup/restoring by gaia_critters
local unitName = "armpw"
local critterName = "critter_crab"
Expand Down Expand Up @@ -188,6 +188,8 @@ function runCritterTest()
assert(countAliveCritters() == 36)
end

function test()
local function test()
runCritterTest()
end

return { skip = skip, setup = setup, test = test, cleanup = cleanup }
10 changes: 6 additions & 4 deletions luaui/Tests/gui_selfd_icons/test_gui_selfd_icons_armpw.lua
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
local widgetName = "Self-Destruct Icons"

function skip()
local function skip()
return Spring.GetGameFrame() <= 0
end

function setup()
local function setup()
Test.clearMap()

Test.prepareWidget(widgetName)
Test.expectCallin("UnitCommand")
end

function cleanup()
local function cleanup()
Test.clearMap()
end

function test()
local function test()
widget = widgetHandler:FindWidget(widgetName)
assert(widget)

Expand Down Expand Up @@ -54,3 +54,5 @@ function test()
return table.count(widget.activeSelfD) == 1 and table.count(widget.queuedSelfD) == 0
end, 10)
end

return { skip = skip, setup = setup, test = test, cleanup = cleanup }
10 changes: 6 additions & 4 deletions luaui/Tests/gui_selfd_icons/test_gui_selfd_icons_armvp.lua
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
local widgetName = "Self-Destruct Icons"

function skip()
local function skip()
return Spring.GetGameFrame() <= 0
end

function setup()
local function setup()
Test.clearMap()

Test.prepareWidget(widgetName)
Test.expectCallin("UnitCommand")
end

function cleanup()
local function cleanup()
Test.clearMap()
end

function test()
local function test()
widget = widgetHandler:FindWidget(widgetName)
assert(widget)

Expand Down Expand Up @@ -49,3 +49,5 @@ function test()
--assert(table.count(widget.activeSelfD) == 0)
--assert(table.count(widget.queuedSelfD) == 0)
end

return { skip = skip, setup = setup, test = test, cleanup = cleanup }
10 changes: 6 additions & 4 deletions luaui/Tests/mex-building/pregame_mex_queue.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
function skip()
local function skip()
return Spring.GetGameFrame() > 0
end

-- Test whether mexes are able to clear queued buildings by shift-clicking
function setup()
local function setup()
Test.clearMap()

local widget_cmd_extractor_snap = widgetHandler:FindWidget("Extractor Snap (mex/geo)")
Expand All @@ -25,7 +25,7 @@ function setup()
Test.waitTime(10)
end

function cleanup()
local function cleanup()
Test.clearMap()

WG["pregame-build"].setBuildQueue({})
Expand All @@ -35,7 +35,7 @@ function cleanup()
end

-- tests both pregame mex snap behavior, as well as basic queue and blueprint handling
function test()
local function test()
local mexUnitDefId = UnitDefNames["armmex"].id
local metalSpots = WG["resource_spot_finder"].metalSpotsList

Expand Down Expand Up @@ -111,3 +111,5 @@ function test()
local buildQueue = WG["pregame-build"].getBuildQueue()
assert(#buildQueue == 0, "Build queue should be empty")
end

return { skip = skip, setup = setup, test = test, cleanup = cleanup }
Loading
Loading