The X server, its start and its tools as one module. It provides x11-display with the machine's reach, gated by the host's seat capability. It writes a block at the start of ~/.xinitrc: the account's environment, an explicit import into the user manager, the mesh's X resources merged without cpp, autorandr, the xinitrc slots, ~/.xinitrc.local, and the session's exec from the last slot. Its Go tools serve the seat's displays and layout (autorandr profiles keyed by EDID), and set-mode, primary, dpi, input devices and settings, keyboard, a screenshot (xwd decoded in Go) and the server's log. internal/desktop is how every desktop tool finds the operator's session from the runtime, which has none: from the session's own processes, reading only its words, confirmed with logind.
43 lines
1.2 KiB
Go
43 lines
1.2 KiB
Go
package desktop
|
|
|
|
import (
|
|
"bytes"
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
// The desktop modules that carry this package. Each builds alone, so each has its own copy; this
|
|
// test, itself one of the copied files, holds them to one text wherever the siblings are present.
|
|
var carriers = []string{"xorg", "lemurs", "i3", "xterm", "adwaita"}
|
|
|
|
func TestEveryDesktopModuleCarriesTheSameCopy(t *testing.T) {
|
|
mine, err := filepath.Glob("*.go")
|
|
if err != nil || len(mine) == 0 {
|
|
t.Fatal("no files of this package found", err)
|
|
}
|
|
compared := 0
|
|
for _, module := range carriers {
|
|
dir := filepath.Join("..", "..", "..", module, "internal", "desktop")
|
|
if _, err := os.Stat(dir); err != nil {
|
|
continue
|
|
}
|
|
theirs, _ := filepath.Glob(filepath.Join(dir, "*.go"))
|
|
if len(theirs) != len(mine) {
|
|
t.Errorf("%s carries %d files of this package, this copy %d", module, len(theirs), len(mine))
|
|
continue
|
|
}
|
|
for _, f := range mine {
|
|
a, _ := os.ReadFile(f)
|
|
b, err := os.ReadFile(filepath.Join(dir, f))
|
|
if err != nil || !bytes.Equal(a, b) {
|
|
t.Errorf("%s's copy of %s differs from this one: change every copy together", module, f)
|
|
}
|
|
}
|
|
compared++
|
|
}
|
|
if compared == 0 {
|
|
t.Log("no sibling copies beside this module")
|
|
}
|
|
}
|