diff --git a/.github/workflows/process_test_results.yml b/.github/workflows/process_test_results.yml new file mode 100644 index 00000000000..cd1aad5f579 --- /dev/null +++ b/.github/workflows/process_test_results.yml @@ -0,0 +1,56 @@ +name: Process Test Results + +on: + workflow_run: + workflows: ["Run Tests"] + types: + - completed + +permissions: {} + +jobs: + process-test-results: + name: Process Test Results + runs-on: ubuntu-latest + if: github.event.workflow_run.conclusion != 'skipped' + + permissions: + checks: write + + # needed unless run with comment_mode: off + pull-requests: write + + # required by download step to access artifacts API + actions: read + + steps: + - name: Download Artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts + github-token: ${{ github.token }} + run-id: ${{ github.event.workflow_run.id }} + + - name: Create context file + run: | + printf '{ + "event": "${{github.event.workflow_run.event}}", + "branch": "${{github.event.workflow_run.head_branch}}" + }' >> artifacts/context.json + + - name: Upload Context File + uses: actions/upload-artifact@v4 + with: + name: Context File + path: artifacts/context.json + + - name: Publish Test Results + uses: EnricoMi/publish-unit-test-result-action@v2 + with: + action_fail_on_inconclusive: true + check_name: "Test Results (${{ github.event.workflow_run.event || github.event_name }})" + time_unit: milliseconds + commit: ${{ github.event.workflow_run.head_sha }} + event_file: artifacts/Event File/event.json + event_name: ${{ github.event.workflow_run.event }} + files: "artifacts/Test Results/*.json" diff --git a/.github/workflows/quick_deploy.yml b/.github/workflows/quick_deploy.yml index d6de550837e..7bcaf4a1edd 100644 --- a/.github/workflows/quick_deploy.yml +++ b/.github/workflows/quick_deploy.yml @@ -2,13 +2,35 @@ # on push to master much quicker without waiting for cron jobs. name: Deploy on: - push: - branches: - - master + workflow_run: + workflows: ["Process Test Results"] + types: + - completed jobs: + get_context: + runs-on: ubuntu-latest + if: | + github.repository == 'beyond-all-reason/Beyond-All-Reason' && + github.event.workflow_run.conclusion == 'success' + outputs: + event: ${{ fromJson(steps.context.outputs.data).event }} + branch: ${{ fromJson(steps.context.outputs.data).branch }} + steps: + - name: Download Artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts + github-token: ${{ github.token }} + run-id: ${{ github.event.workflow_run.id }} + - name: Get context json + id: context + run: echo "data=$(jq -c . < 'artifacts/Context File/context.json')" >> $GITHUB_OUTPUT deploy: + needs: [get_context] runs-on: ubuntu-latest - if: github.repository == 'beyond-all-reason/Beyond-All-Reason' + if: | + needs.get_context.outputs.event == 'push' && + needs.get_context.outputs.branch == 'master' permissions: id-token: write steps: diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml new file mode 100644 index 00000000000..ab1d65f6177 --- /dev/null +++ b/.github/workflows/run_tests.yml @@ -0,0 +1,35 @@ +name: Run Tests + +on: +# pull_request + workflow_dispatch: + pull_request: + push: + branches: + - 'master' + +jobs: + run-tests: + name: Run Tests + runs-on: ubuntu-latest + steps: + - name: Upload Event File + uses: actions/upload-artifact@v4 + with: + name: Event File + path: ${{ github.event_path }} + + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Run Tests + run: docker compose -f tools/headless_testing/docker-compose.yml up + timeout-minutes: 30 + + - name: Upload Test Results + if: always() + uses: actions/upload-artifact@v4 + with: + name: Test Results + path: | + tools/headless_testing/testlog/results.json diff --git a/common/testing/infologtest.lua b/common/testing/infologtest.lua new file mode 100644 index 00000000000..650be470159 --- /dev/null +++ b/common/testing/infologtest.lua @@ -0,0 +1,32 @@ +local maxErrors = 10 + +local function skipErrors(line) + if string.find(line, 'Could not finalize projectile-texture atlas', nil, true) then + return true + end +end + +local function infologTest() + local errors = {} + local infolog = VFS.LoadFile("infolog.txt") + if infolog then + local fileLines = string.lines(infolog) + for i, line in ipairs(fileLines) do + if string.find(line, 'Error:', nil, true) and not skipErrors(line) then + errors[#errors+1] = line + if #errors > maxErrors then + return errors + end + end + end + end + return errors +end + + +function test() + local errors = infologTest() + if #errors > 0 then + error(table.concat(errors, "\n"), 0) + end +end diff --git a/common/testing/mocha_json_reporter.lua b/common/testing/mocha_json_reporter.lua index 56b4570fd4e..a4d9ad40a47 100644 --- a/common/testing/mocha_json_reporter.lua +++ b/common/testing/mocha_json_reporter.lua @@ -8,11 +8,13 @@ function MochaJSONReporter:new() local obj = { totalTests = 0, totalPasses = 0, + totalSkipped = 0, totalFailures = 0, startTime = nil, endTime = nil, duration = nil, - tests = {} + tests = {}, + skipped = {} } setmetatable(obj, self) self.__index = self @@ -28,21 +30,37 @@ function MochaJSONReporter:endTests(duration) self.duration = duration end -function MochaJSONReporter:testResult(label, filePath, success, duration, errorMessage) +function MochaJSONReporter:extractError(text) + local errorIndex = text:match'^%[string "[%p%a%s]*%"]:[%d]+:().*' + if errorIndex and errorIndex > 0 then + text = text:sub(errorIndex + 1) + return text + end + errorIndex = text:match'^%[t=[%d%.:]*%]%[f=[%-%d]*%] ().*' + if errorIndex and errorIndex > 0 then + text = text:sub(errorIndex) + end + return text +end + +function MochaJSONReporter:testResult(label, filePath, success, skipped, duration, errorMessage) local result = { title = label, fullTitle = label, file = filePath, duration = duration, } - if success then + if skipped then + self.totalSkipped = self.totalSkipped + 1 + result.err = {} + elseif success then self.totalPasses = self.totalPasses + 1 result.err = {} else self.totalFailures = self.totalFailures + 1 if errorMessage ~= nil then result.err = { - message = errorMessage, + message = self:extractError(errorMessage), stack = errorMessage } else @@ -54,6 +72,9 @@ function MochaJSONReporter:testResult(label, filePath, success, duration, errorM self.totalTests = self.totalTests + 1 self.tests[#(self.tests) + 1] = result + if skipped then + self.skipped[#(self.skipped) + 1] = {fullTitle = label} + end end function MochaJSONReporter:report(filePath) @@ -63,12 +84,14 @@ function MochaJSONReporter:report(filePath) ["tests"] = self.totalTests, ["passes"] = self.totalPasses, ["pending"] = 0, + ["skipped"] = self.totalSkipped, ["failures"] = self.totalFailures, ["start"] = formatTimestamp(self.startTime), ["end"] = formatTimestamp(self.endTime), ["duration"] = self.duration }, - ["tests"] = self.tests + ["tests"] = self.tests, + ["pending"] = self.skipped } local encoded = Json.encode(output) diff --git a/luaui/Widgets/Tests/balance/test_arm_vs_cor_fighters.lua b/luaui/Widgets/Tests/balance/test_arm_vs_cor_fighters.lua new file mode 100644 index 00000000000..782878ceb4b --- /dev/null +++ b/luaui/Widgets/Tests/balance/test_arm_vs_cor_fighters.lua @@ -0,0 +1,97 @@ +function setup() + Test.clearMap() +end + +function cleanup() + Test.clearMap() + + Spring.SendCommands("setspeed " .. 1) +end + +function test() + local units = { + [0] = "armfig", + [1] = "corveng" + } + local n = 200 + + local midX, midZ = Game.mapSizeX / 2, Game.mapSizeZ / 2 + local xOffset = 1000 + local zStep = 10 + local startZ = midZ - zStep * n / 2 + + -- make two lines of units facing each other + SyncedRun(function(locals) + do + local x = locals.midX - locals.xOffset + for i = 1, locals.n do + local z = locals.startZ + locals.zStep * i + local y = Spring.GetGroundHeight(x, z) + local unitID = Spring.CreateUnit(locals.units[0], x, y, z, "east", 0) + end + end + + do + local x = locals.midX + locals.xOffset + for i = 1, locals.n do + local z = locals.startZ + locals.zStep * i + local y = Spring.GetGroundHeight(x, z) + local unitID = Spring.CreateUnit(locals.units[1], x, y, z, "west", 1) + end + + end + end) + + Test.waitFrames(1) + + if false then + Spring.GiveOrderToUnitArray(Spring.GetTeamUnits(0), CMD.FIGHT, { midX, 0, midZ }, 0) + Spring.GiveOrderToUnitArray(Spring.GetTeamUnits(1), CMD.FIGHT, { midX, 0, midZ }, 0) + else + SyncedRun(function(locals) + local midX = locals.midX + local midZ = locals.midZ + for _, unitID in ipairs(Spring.GetAllUnits()) do + local ux, uy, uz = Spring.GetUnitPosition(unitID) + + Spring.GiveOrderToUnit(unitID, CMD.FIGHT, { 2 * midX - ux, 0, uz }, 0) + Spring.GiveOrderToUnit(unitID, CMD.FIGHT, { midX, 0, midZ }, { "shift" }) + end + end) + end + + Spring.SendCommands("setspeed " .. 5) + + -- wait until one team has no units left + Test.waitUntil(function() + return #(Spring.GetTeamUnits(0)) == 0 or #(Spring.GetTeamUnits(1)) == 0 + end, 60 * 30) + + Spring.SendCommands("setspeed " .. 1) + + if #(Spring.GetTeamUnits(0)) > #(Spring.GetTeamUnits(1)) then + winner = 0 + elseif #(Spring.GetTeamUnits(1)) > #(Spring.GetTeamUnits(0)) then + winner = 1 + end + + resultStr = "RESULT: " + if winner ~= nil then + unitName = units[winner] + if UnitDefNames and units[winner] and UnitDefNames[units[winner]] then + unitName = UnitDefNames[units[winner]].translatedHumanName or units[winner] + end + unitsLeft = #(Spring.GetAllUnits()) + resultStr = resultStr .. "team " .. winner .. " wins" + resultStr = resultStr .. " with " .. unitsLeft + resultStr = resultStr .. " (" .. string.format("%.f%%", 100 * unitsLeft / n) .. ")" + resultStr = resultStr .. " " .. unitName .. " left" + else + resultStr = resultStr .. "tie" + end + + Spring.Echo(resultStr) + + -- cor fighters should win + assert(winner == 1) +end diff --git a/luaui/Widgets/Tests/balance/test_grunts_vs_pawns.lua b/luaui/Widgets/Tests/balance/test_grunts_vs_pawns.lua new file mode 100644 index 00000000000..336667142ba --- /dev/null +++ b/luaui/Widgets/Tests/balance/test_grunts_vs_pawns.lua @@ -0,0 +1,85 @@ +function skip() + return Game.mapName ~= "Full Metal Plate 1.5" +end + +function setup() + Test.clearMap() +end + +function cleanup() + Test.clearMap() + + Spring.SendCommands("setspeed " .. 1) +end + +function test() + local units = { + [0] = "armpw", + [1] = "corak" + } + local n = 20 + + local midX, midZ = Game.mapSizeX / 2, Game.mapSizeZ / 2 + local xOffset = 200 + local zStep = 30 + local startZ = midZ - zStep * n / 2 + + -- make two lines of units facing each other + SyncedRun(function(locals) + do + local x = locals.midX - locals.xOffset + for i = 1, locals.n do + local z = locals.startZ + local y = Spring.GetGroundHeight(x, z) + Spring.CreateUnit(locals.units[0], x, y, z + locals.zStep * i, "east", 0) + end + end + + do + local x = locals.midX + locals.xOffset + for i = 1, locals.n do + local z = locals.startZ + local y = Spring.GetGroundHeight(x, z) + Spring.CreateUnit(locals.units[1], x, y, z + locals.zStep * i, "west", 1) + end + + end + end) + + Test.waitFrames(1) + + Spring.GiveOrderToUnitArray(Spring.GetTeamUnits(0), CMD.FIGHT, { midX, 0, midZ }, 0) + Spring.GiveOrderToUnitArray(Spring.GetTeamUnits(1), CMD.FIGHT, { midX, 0, midZ }, 0) + + Spring.SendCommands("setspeed " .. 20) + + -- wait until one team has no units left + Test.waitUntil(function() + return #(Spring.GetTeamUnits(0)) == 0 or #(Spring.GetTeamUnits(1)) == 0 + end, 30 * 30) + + Spring.SendCommands("setspeed " .. 1) + + if #(Spring.GetTeamUnits(0)) > #(Spring.GetTeamUnits(1)) then + winner = 0 + elseif #(Spring.GetTeamUnits(1)) > #(Spring.GetTeamUnits(0)) then + winner = 1 + end + + resultStr = "RESULT: " + if winner ~= nil then + unitName = units[winner] + if UnitDefNames and units[winner] and UnitDefNames[units[winner]] then + unitName = UnitDefNames[units[winner]].translatedHumanName or units[winner] + end + resultStr = resultStr .. "team " .. winner .. " wins" + resultStr = resultStr .. " with " .. #(Spring.GetAllUnits()) .. " " .. unitName .. " left" + else + resultStr = resultStr .. "tie" + end + + Spring.Echo(resultStr) + + -- pawns should win + assert(winner == 0) +end diff --git a/luaui/Widgets/Tests/cmd_blueprint/test_cmd_blueprint_line.lua b/luaui/Widgets/Tests/cmd_blueprint/test_cmd_blueprint_line.lua index aa81b408f3a..53e1c5e50c5 100644 --- a/luaui/Widgets/Tests/cmd_blueprint/test_cmd_blueprint_line.lua +++ b/luaui/Widgets/Tests/cmd_blueprint/test_cmd_blueprint_line.lua @@ -16,9 +16,9 @@ function setup() initialCameraState = Spring.GetCameraState() - Spring.SetCameraState({ - mode = 5, - }) + --Spring.SetCameraState({ + -- mode = 5, + --}) end function cleanup() @@ -112,11 +112,13 @@ function test() end) local sx, sy = Spring.WorldToScreenCoords(x, y, z) + Spring.SetCameraTarget(x, y, z) Spring.WarpMouse(sx, sy) Script.LuaUI.MousePress(sx, sy, 1) sx, sy = Spring.WorldToScreenCoords(x, y, z + bpH * (bpCount - 1)) + Spring.SetCameraTarget(x, y, z + bpH * (bpCount - 1)) Spring.WarpMouse(sx, sy) Test.waitFrames(delay) diff --git a/luaui/Widgets/Tests/example/test_mock.lua b/luaui/Widgets/Tests/example/test_mock.lua new file mode 100644 index 00000000000..5bf0a34757c --- /dev/null +++ b/luaui/Widgets/Tests/example/test_mock.lua @@ -0,0 +1,9 @@ +function test() + mock_SpringGetModKeyState = Test.mock(Spring, "GetModKeyState", function() + return true, false, true, false + end) + + assertTablesEqual(pack(Spring.GetModKeyState()), {true, false, true, false}) + + assert(#(mock_SpringGetModKeyState.calls) == 1) +end diff --git a/luaui/Widgets/Tests/example/test_wait.lua b/luaui/Widgets/Tests/example/test_wait.lua new file mode 100644 index 00000000000..78140bea0c3 --- /dev/null +++ b/luaui/Widgets/Tests/example/test_wait.lua @@ -0,0 +1,36 @@ +function setup() + Test.clearMap() + Test.expectCallin("UnitCreated") +end + +function cleanup() + Test.clearMap() +end + +function test() + Spring.Echo("[test_wait] waiting 5 frames") + Test.waitFrames(5) + + local x, z = Game.mapSizeX / 2, Game.mapSizeZ / 2 + local y = Spring.GetGroundHeight(x, z) + + createdUnitID = SyncedRun(function(locals) + return Spring.CreateUnit("armpw", locals.x, locals.y, locals.z, 0, 0) + end) + + Spring.Echo("[test_wait] waiting for UnitCreated on unitID=" .. createdUnitID) + Test.waitUntilCallin("UnitCreated", function(unitID, unitDefID, unitTeam, builderID) + Spring.Echo("Saw UnitCreated for unitID=" .. unitID) + return unitID == createdUnitID + end, 10) + + startFrame = SyncedProxy.Spring.GetGameFrame() + + Spring.Echo("[test_wait] waiting 3 frames, but the hard way") + Test.waitUntil(function() + return (Spring.GetGameFrame() - startFrame > 3) + end) + + Spring.Echo("[test_wait] waiting 1000 ms") + Test.waitTime(1000) +end diff --git a/luaui/Widgets/TestsExamples/balance/test_arm_vs_cor_fighters.lua b/luaui/Widgets/TestsExamples/balance/test_arm_vs_cor_fighters.lua index 7aac181496d..2e6a0e44d28 100644 --- a/luaui/Widgets/TestsExamples/balance/test_arm_vs_cor_fighters.lua +++ b/luaui/Widgets/TestsExamples/balance/test_arm_vs_cor_fighters.lua @@ -52,12 +52,16 @@ function test() Spring.GiveOrderToUnitArray(Spring.GetTeamUnits(0), CMD.FIGHT, { midX, 0, midZ }, 0) Spring.GiveOrderToUnitArray(Spring.GetTeamUnits(1), CMD.FIGHT, { midX, 0, midZ }, 0) else - for _, unitID in ipairs(Spring.GetAllUnits()) do - local ux, uy, uz = Spring.GetUnitPosition(unitID) - - Spring.GiveOrderToUnit(unitID, CMD.FIGHT, { 2 * midX - ux, 0, uz }, 0) - Spring.GiveOrderToUnit(unitID, CMD.FIGHT, { midX, 0, midZ }, { "shift" }) - end + SyncedRun(function() + local midX = locals.midX + local midZ = locals.midZ + for _, unitID in ipairs(Spring.GetAllUnits()) do + local ux, uy, uz = Spring.GetUnitPosition(unitID) + + Spring.GiveOrderToUnit(unitID, CMD.FIGHT, { 2 * midX - ux, 0, uz }, 0) + Spring.GiveOrderToUnit(unitID, CMD.FIGHT, { midX, 0, midZ }, { "shift" }) + end + end) end Spring.SendCommands("setspeed " .. 5) diff --git a/luaui/Widgets/TestsExamples/test_utilities/test_wait.lua b/luaui/Widgets/TestsExamples/test_utilities/test_wait.lua index c01fb82b6b6..78140bea0c3 100644 --- a/luaui/Widgets/TestsExamples/test_utilities/test_wait.lua +++ b/luaui/Widgets/TestsExamples/test_utilities/test_wait.lua @@ -1,5 +1,6 @@ function setup() Test.clearMap() + Test.expectCallin("UnitCreated") end function cleanup() diff --git a/luaui/Widgets/api_blueprint.lua b/luaui/Widgets/api_blueprint.lua index 0b6dd3969ba..303b31b6e5c 100644 --- a/luaui/Widgets/api_blueprint.lua +++ b/luaui/Widgets/api_blueprint.lua @@ -227,6 +227,9 @@ local function makeInstanceVBO(layout, vertexVBO, numVertices) end local function initGL4() + if not gl.CreateShader then + return + end local outlineVBO, outlineVertices = makeOutlineVBO() outlineInstanceVBO = makeInstanceVBO(outlineInstanceVBOLayout, outlineVBO, outlineVertices) @@ -527,6 +530,9 @@ local BUILD_MODES_HANDLERS = { local instanceIDs = {} local function clearInstances() + if not gl.CreateShader then + return + end clearInstanceTable(outlineInstanceVBO) if WG.StopDrawUnitShapeGL4 then @@ -611,6 +617,9 @@ end ---@param buildPositions StartPoints ---@param teamID number local function updateInstances(blueprint, buildPositions, teamID) + if not gl.CreateShader then + return + end if not blueprint or not buildPositions then clearInstances() return @@ -668,6 +677,9 @@ local function drawOutlines() end function widget:DrawWorldPreUnit() + if not gl.CreateShader then + return + end if not activeBlueprint then return end @@ -725,17 +737,7 @@ local function setActiveBuilders(unitIDs) end function widget:Initialize() - if not gl.CreateShader then - -- no shader support, so just remove the widget itself, especially for headless - widgetHandler:RemoveWidget() - return - end - - if not initGL4() then - -- shader compile failed - widgetHandler:RemoveWidget() - return - end + initGL4() WG["api_blueprint"] = { setActiveBlueprint = setActiveBlueprint, @@ -757,6 +759,9 @@ end function widget:Shutdown() WG["api_blueprint"] = nil + if not gl.CreateShader then + return + end clearInstances() if outlineInstanceVBO and outlineInstanceVBO.VAO then diff --git a/luaui/Widgets/api_unit_tracker_gl4.lua b/luaui/Widgets/api_unit_tracker_gl4.lua index f0f3f3db52c..4f9cae9f5e1 100644 --- a/luaui/Widgets/api_unit_tracker_gl4.lua +++ b/luaui/Widgets/api_unit_tracker_gl4.lua @@ -7,7 +7,8 @@ function widget:GetInfo() license = "GNU GPL, v2 or later", layer = -828888, handler = true, - enabled = true + enabled = true, + depends = {'gl4'}, } end diff --git a/luaui/Widgets/cmd_extractor_snap.lua b/luaui/Widgets/cmd_extractor_snap.lua index 7e982dd9df4..852c0064d5f 100644 --- a/luaui/Widgets/cmd_extractor_snap.lua +++ b/luaui/Widgets/cmd_extractor_snap.lua @@ -323,5 +323,8 @@ end function widget:Shutdown() + if not WG.DrawUnitShapeGL4 then + return + end clear() end diff --git a/luaui/Widgets/dbg_test_runner.lua b/luaui/Widgets/dbg_test_runner.lua index 2c4bada6f2d..0ef45db9367 100644 --- a/luaui/Widgets/dbg_test_runner.lua +++ b/luaui/Widgets/dbg_test_runner.lua @@ -41,6 +41,8 @@ local config = { } local testReporter = nil +local headless = false +local origLogFlushLevel -- utils -- ===== @@ -71,6 +73,8 @@ local function logEndTests(duration) testReporter:endTests(duration) testReporter:report(config.testResultsFilePath) + headless = false + Spring.SetConfigInt("LogFlushLevel", origLogFlushLevel) end local function logTestResult(testResult) @@ -82,6 +86,7 @@ local function logTestResult(testResult) testResult.label, testResult.filename, (testResult.result == TestResults.TEST_RESULT.PASS), + (testResult.result == TestResults.TEST_RESULT.SKIP), testResult.milliseconds, testResult.error ) @@ -141,6 +146,9 @@ local function findAllTestFiles(patterns) result[#result + 1] = testFileInfo end end + if headless then + result[#result+1] = {label="infolog", filename="common/testing/infologtest.lua"} + end return result end @@ -1257,6 +1265,9 @@ function widget:Initialize() self, "runtestsheadless", function(cmd, optLine, optWords, data, isRepeat, release, actions) + headless = true + origLogFlushLevel = Spring.GetConfigInt("LogFlushLevel") + Spring.SetConfigInt("LogFlushLevel", 0) config.noColorOutput = true config.quitWhenDone = true config.gameStartTestPatterns = Util.splitPhrases(optLine) diff --git a/luaui/Widgets/gfx_deferred_rendering_GL4.lua b/luaui/Widgets/gfx_deferred_rendering_GL4.lua index a5bc8660b1a..47bd813ce65 100644 --- a/luaui/Widgets/gfx_deferred_rendering_GL4.lua +++ b/luaui/Widgets/gfx_deferred_rendering_GL4.lua @@ -9,7 +9,8 @@ function widget:GetInfo() date = "2022.06.10", license = "Lua code is GPL V2, GLSL is (c) Beherith (mysterme@gmail.com)", layer = -99999990, - enabled = true + enabled = true, + depends = {'gl4'}, } end @@ -1612,7 +1613,6 @@ function widget:TextCommand(command) end function widget:Initialize() - Spring.Debug.TraceEcho("Initialize DLGL4") if Spring.GetConfigString("AllowDeferredMapRendering") == '0' or Spring.GetConfigString("AllowDeferredModelRendering") == '0' then Spring.Echo('Deferred Rendering (gfx_deferred_rendering.lua) requires AllowDeferredMapRendering and AllowDeferredModelRendering to be enabled in springsettings.cfg!') diff --git a/luaui/Widgets/gfx_ssao.lua b/luaui/Widgets/gfx_ssao.lua index ef85e275c9d..ee125f31655 100644 --- a/luaui/Widgets/gfx_ssao.lua +++ b/luaui/Widgets/gfx_ssao.lua @@ -20,6 +20,7 @@ function widget:GetInfo() license = "GPL", layer = 999999, enabled = not isPotatoGpu, + depends = {'gl4'}, } end @@ -630,7 +631,6 @@ function widget:Update(dt) end function widget:Shutdown() - -- restore unit lighting settings if presets[preset].tonemapA then Spring.SetConfigFloat("tonemapA", initialTonemapA) diff --git a/luaui/Widgets/gfx_unit_stencil_gl4.lua b/luaui/Widgets/gfx_unit_stencil_gl4.lua index 7005bcf96ca..cd809992c07 100644 --- a/luaui/Widgets/gfx_unit_stencil_gl4.lua +++ b/luaui/Widgets/gfx_unit_stencil_gl4.lua @@ -187,6 +187,7 @@ void main(void) local function goodbye(reason) Spring.Echo("Unit Stencil GL4 widget exiting with reason: "..reason) + widgetHandler:RemoveWidget() end local resolution = 4 local vsx, vsy @@ -392,6 +393,9 @@ end function widget:Initialize() unitStencilShader = InitDrawPrimitiveAtUnit(shaderConfig, "unitStencils") + if not unitStencilShader then + return + end widget:ViewResize() WG['unitstencilapi'] = {} diff --git a/luaui/Widgets/gui_defenserange_gl4.lua b/luaui/Widgets/gui_defenserange_gl4.lua index 3cfa2cc3e82..59f68019d5b 100644 --- a/luaui/Widgets/gui_defenserange_gl4.lua +++ b/luaui/Widgets/gui_defenserange_gl4.lua @@ -8,7 +8,8 @@ function widget:GetInfo() date = "2021.04.26", license = "Lua: GPLv2, GLSL: (c) Beherith (mysterme@gmail.com)", layer = -100, - enabled = true + enabled = true, + depends = {'gl4'}, } end diff --git a/luaui/Widgets/gui_ground_ao_plates_gl4.lua b/luaui/Widgets/gui_ground_ao_plates_gl4.lua index 2efc5cd82de..5839e54e61a 100644 --- a/luaui/Widgets/gui_ground_ao_plates_gl4.lua +++ b/luaui/Widgets/gui_ground_ao_plates_gl4.lua @@ -7,6 +7,7 @@ function widget:GetInfo() license = "GNU GPL, v2 or later", layer = -1, enabled = true, + depends = {'gl4'}, } end diff --git a/tools/headless_testing/download-maps.sh b/tools/headless_testing/download-maps.sh index 8901c70e6f9..22b139819cf 100644 --- a/tools/headless_testing/download-maps.sh +++ b/tools/headless_testing/download-maps.sh @@ -1,3 +1,5 @@ #!/bin/bash -engine/*/pr-downloader --filesystem-writepath "$BAR_ROOT" --download-map "Supreme Isthmus v1.6.4" +#engine/*/pr-downloader --filesystem-writepath "$BAR_ROOT" --download-map "Full Metal Plate 1.5" +engine/*/pr-downloader --filesystem-writepath "$BAR_ROOT" --download-map "Supreme Isthmus v1.8" +#engine/*/pr-downloader --filesystem-writepath "$BAR_ROOT" --download-map "All That Glitters v2.2" diff --git a/tools/headless_testing/startscript.txt b/tools/headless_testing/startscript.txt index e41b9cf9f84..de123d076d9 100644 --- a/tools/headless_testing/startscript.txt +++ b/tools/headless_testing/startscript.txt @@ -1,6 +1,6 @@ [GAME] { - MapName=Supreme Isthmus v1.6.4; + MapName=Supreme Isthmus v1.8; GameType=Beyond All Reason $VERSION; GameStartDelay=0; StartPosType=0; @@ -10,7 +10,7 @@ FixedRNGSeed = 1; [MODOPTIONS] { - debugcommands=1:cheat|2:godmode|3:globallos|30:runtestsheadless; + debugcommands=1:cheat|2:godmode|30:runtestsheadless; deathmode=neverend; } [ALLYTEAM0]