| … | 23 unchanged lines hidden |
| 24 |
24 |
|
lua tools/test.lua <example> [--backend NAME] [--seconds N] [--frames N] [--json PATH] [--profile PATH] [--visual] [--screenshot PATH] [--no-screenshot] [--dry-run] |
| 25 |
25 |
|
lua tools/test.lua visual <example> [--backend NAME] [--frames N] [--compare PATH] [--no-screenshot] [--proof-readback PATH] [--proof-mode MODE] |
| 26 |
26 |
|
lua tools/test.lua visual-matrix [--backend LIST] [--scene LIST] [--frames N] [--json PATH] [--dry-run] |
|
27 |
+ |
lua tools/test.lua windows-visual-matrix [--backend d3d11,d3d12] [--scene LIST] [--frames N] [--json PATH] [--dry-run] |
| 27 |
28 |
|
lua tools/test.lua bench <example|all> [--backend NAME] [--seconds N] [--frames N] [--json PATH] |
| 28 |
29 |
|
]]) |
| 29 |
30 |
|
end |
| … | 290 unchanged lines hidden |
| 320 |
321 |
|
return process.run(cmd) |
| 321 |
322 |
|
end |
| 322 |
323 |
|
|
|
324 |
+ |
local function split_csv(value) |
|
325 |
+ |
local out = {} |
|
326 |
+ |
if not value or value == true or value == "" then return out end |
|
327 |
+ |
for item in tostring(value):gmatch("[^,]+") do |
|
328 |
+ |
local trimmed = item:gsub("^%s+", ""):gsub("%s+$", "") |
|
329 |
+ |
if trimmed ~= "" then out[#out + 1] = trimmed end |
|
330 |
+ |
end |
|
331 |
+ |
return out |
|
332 |
+ |
end |
|
333 |
+ |
|
|
334 |
+ |
local function windows_visual_matrix_strict_success(result) |
|
335 |
+ |
if not result or not result.summary or result.summary.total == 0 then return false end |
|
336 |
+ |
if result.summary.fail ~= 0 or result.summary.skip ~= 0 then return false end |
|
337 |
+ |
for _, row in ipairs(result.rows or {}) do |
|
338 |
+ |
if row.status ~= "pass" then return false end |
|
339 |
+ |
end |
|
340 |
+ |
return true |
|
341 |
+ |
end |
|
342 |
+ |
|
|
343 |
+ |
local function cmd_windows_visual_matrix(argv) |
|
344 |
+ |
local opts = parse_options(argv, 2) |
|
345 |
+ |
opts.backend = opts.backend or "d3d11,d3d12" |
|
346 |
+ |
for _, backend in ipairs(split_csv(opts.backend)) do |
|
347 |
+ |
if backend ~= "d3d11" and backend ~= "d3d12" then |
|
348 |
+ |
error("windows-visual-matrix only accepts d3d11,d3d12 backends") |
|
349 |
+ |
end |
|
350 |
+ |
end |
|
351 |
+ |
if not path.is_windows and not opts.dry_run then |
|
352 |
+ |
error("windows-visual-matrix must run on Windows unless --dry-run is supplied") |
|
353 |
+ |
end |
|
354 |
+ |
if not opts.dry_run and not opts.json then |
|
355 |
+ |
opts.json = path.join(root, ".build", "visual-matrix", "windows-d3d.json") |
|
356 |
+ |
end |
|
357 |
+ |
local visual_matrix = require("tools.visual_matrix") |
|
358 |
+ |
local result = visual_matrix.run(opts, { root = root, window_collection = window_collection }) |
|
359 |
+ |
print(json.encode(result)) |
|
360 |
+ |
return windows_visual_matrix_strict_success(result) and 0 or 1 |
|
361 |
+ |
end |
|
362 |
+ |
|
| 323 |
363 |
|
local function selftest() |
| 324 |
364 |
|
local visual_matrix = require("tools.visual_matrix") |
| 325 |
365 |
|
assert(json.encode({ b = 2, a = "x" }) == '{"a":"x","b":2}') |
| … | 12 unchanged lines hidden |
| 338 |
378 |
|
assert(process.command_exists("python3")) |
| 339 |
379 |
|
assert(process.run("python3 " .. path.shell_quote(path.join(root, "tools", "visual_assert.py")) .. " --selftest") == 0) |
| 340 |
380 |
|
visual_matrix.selftest(root) |
|
381 |
+ |
assert(not windows_visual_matrix_strict_success(visual_matrix.run({ |
|
382 |
+ |
dry_run = true, |
|
383 |
+ |
backend = "d3d11,d3d12", |
|
384 |
+ |
scene = "stencil_clip", |
|
385 |
+ |
}, { root = root }))) |
| 341 |
386 |
|
print("lua selftest ok") |
| 342 |
387 |
|
end |
| 343 |
388 |
|
|
| … | 52 unchanged lines hidden |
| 396 |
441 |
|
elseif cmd == "visual-matrix" then |
| 397 |
442 |
|
local visual_matrix = require("tools.visual_matrix") |
| 398 |
443 |
|
return visual_matrix.main(argv, { root = root, window_collection = window_collection }) |
|
444 |
+ |
elseif cmd == "windows-visual-matrix" then |
|
445 |
+ |
return cmd_windows_visual_matrix(argv) |
| 399 |
446 |
|
elseif cmd == "bench" then |
| 400 |
447 |
|
cmd_bench(argv) |
| 401 |
448 |
|
return 0 |
| … | 17 unchanged lines hidden |