Documentation
¶
Overview ¶
Package display is the harness of the display tests (build tag emetos_display, SPEC §15.1 "Real input"): it starts a debug build of Emetos isolated from the user's folders under a compositor, types and clicks into its window through internal/testenv/realinput, reads its state through the read-only dev commands over the dev server (SPEC §15.2), takes screenshots with grim, and stops everything when the test ends.
Run the tests that use it inside a headless compositor, which gives them WAYLAND_DISPLAY, XDG_RUNTIME_DIR and SWAYSOCK:
scripts/headless-wayland.sh -- go test -race -tags emetos_display ./cmd/emetos
scripts/realinput.sh --desktop runs them in a nested sway window on the desktop. Without a sway compositor in the environment the tests are skipped.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GPUEnv ¶
func GPUEnv() []string
GPUEnv is the environment that keeps an editor of the tests off the NVIDIA card (the user, 2026-10-30: "dont use my nvidia card to test"), as scripts/gpu-env.sh does for the scripts: EGL and GLX load Mesa only (glvnd would try NVIDIA's vendor library first), and the Vulkan loader sees every driver but NVIDIA's.
Types ¶
type FirstFrame ¶
type FirstFrame struct {
// SinceRun is the time from the start of Run to the frame, SinceProcessStart the time from the start of the process.
SinceRun, SinceProcessStart time.Duration
}
FirstFrame is the "first frame presented" line of Glutter's log.
func ParseFirstFrame ¶
func ParseFirstFrame(log string) (FirstFrame, bool)
ParseFirstFrame reads the line of the first frame presented; false when the log has none. Glutter writes it without GLUTTER_FRAME_STATS too.
type FrameSummary ¶
type FrameSummary struct {
// Frames is the number of frames drawn.
Frames int
// BuildAvg and RasterAvg are the averages per frame, BuildMax and RasterMax the worst frames.
BuildAvg, BuildMax, RasterAvg, RasterMax time.Duration
// Over16 is the number of frames over 16 ms.
Over16 int
}
FrameSummary is a run of FrameWindows put together.
func Summarize ¶
func Summarize(windows []FrameWindow) FrameSummary
Summarize puts the windows together: the averages are weighted by the frames of each window.
type FrameWindow ¶
type FrameWindow struct {
// Frames is the number of frames drawn in the second.
Frames int
// BuildAvg and BuildMax are the average and the worst time of the UI thread (build, layout and paint), RasterAvg and
// RasterMax those of the renderer.
BuildAvg, BuildMax, RasterAvg, RasterMax time.Duration
// Over16 is the number of frames whose build and raster took more than 16 ms together.
Over16 int
}
A FrameWindow is one "frames" line of Glutter's statistics (GLUTTER_FRAME_STATS=1): what it measured in one second.
func ParseFrameStats ¶
func ParseFrameStats(log string) []FrameWindow
ParseFrameStats reads the "frames" lines of the log of an editor that ran with GLUTTER_FRAME_STATS=1. The log lines are slog's text format ("... msg=frames fps=60 build_avg=1.2ms ...") or its console format ("INFO frames fps=60 ...").
type SlowFrame ¶
type SlowFrame struct {
// Time is when the frame ended (the time of the log line), on the clock of the test's machine.
Time time.Time
// Build is the time of the UI thread (build, layout and paint), Raster the time of the renderer.
Build, Raster time.Duration
}
A SlowFrame is one "slow frame" line of Glutter's log (GLUTTER_FRAME_STATS=1): a frame whose build and raster took over 16 ms together.
func ParseSlowFrames ¶
ParseSlowFrames reads the "slow frame" lines of the log of an editor that ran with GLUTTER_FRAME_STATS=1. A line with no readable time (the console format) has the zero Time.