Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-browser-engine

Source of release 0.6.1

0.6.1 / tests / ladybird / main.luc

# Ladybird's Layout, Ref, Crash and Screenshot tests (the copy in tests/libweb) through the
# headless runner tests/web_test, one worker process per test, against tests/expected_failures:
# an unexpected failure or an unexpected pass fails the run (DESIGN.md ยง6). The runner is
# built with the diagnostic profile, which fills `---` storage with 0xaa and checks frees, so
# a read of a field nobody wrote fails every time its path runs. What failed is written to
# build/tests/ladybird/results; after a change that makes tests pass or fail, review it and
# run `build/tests/ladybird/web_test --update-failures`.
from luce_std import files, paths, process
import platform

let failed = ErrorCode.package(1)

pub func main(arguments: list[str]) -> int!:
    let base = process.variable("LUCE_BASE") else "luce-base"
    let work = paths.join(process.current_directory(), "build/tests/ladybird")
    files.ensure_directory(work)
    let runner = paths.join(work, "web_test" + (".exe" if platform.windows else ""))
    let built = process.run(base, ["build", "tests/web_test", "-o", runner, "--profile", "diagnostic"])
    if built.exit_code != 0:
        error(failed, f"tests/web_test does not build\n{built.output}{built.error_output}")
    let results = paths.join(work, "results")
    let done = process.run(runner, ["layout", "ref", "crash", "screenshot", "--results", results])
    print(done.output.trim_end())
    if done.exit_code != 0:
        error(failed, f"web_test: exit status {done.exit_code}\n{done.error_output}")
    return 0