diff --git a/distro-packages/Arch-Linux/cthulhu-git/PKGBUILD b/distro-packages/Arch-Linux/cthulhu-git/PKGBUILD index 2549c84..57ea9b9 100644 --- a/distro-packages/Arch-Linux/cthulhu-git/PKGBUILD +++ b/distro-packages/Arch-Linux/cthulhu-git/PKGBUILD @@ -5,7 +5,7 @@ pkgbase=cthulhu-git pkgname=cthulhu-git _pkgname=cthulhu pkgver=2026.10.31.r588.g9680b58 -pkgrel=2 +pkgrel=3 pkgdesc="Desktop-agnostic screen reader with speech, Braille, and Tentacle support" url="https://git.stormux.org/storm/cthulhu" arch=(x86_64 aarch64 armv7h) @@ -91,13 +91,20 @@ build() { fi } -check() { +check() ( cd "${_pkgname}" export CGO_ENABLED=1 export GOPATH="${srcdir}/go" export GOCACHE="${GOCACHE:-${srcdir}/go-build}" - go test -tags brlapi ./... -count=1 -} + # Keep activated services and runtime sockets away from the build desktop. + local runtimeDir + runtimeDir=$(mktemp -d -t cthulhu-check.XXXXXXXX) || return 1 + trap 'rm -rf -- "$runtimeDir"' EXIT + env -u DISPLAY -u WAYLAND_DISPLAY -u AT_SPI_BUS_ADDRESS \ + -u DBUS_SESSION_BUS_ADDRESS -u DBUS_STARTER_ADDRESS -u DBUS_STARTER_BUS_TYPE \ + XDG_RUNTIME_DIR="$runtimeDir" GOWORK=off \ + dbus-run-session -- go test -tags brlapi ./... -count=1 +) package() { cd "${_pkgname}" diff --git a/distro-packages/Arch-Linux/cthulhu/.SRCINFO b/distro-packages/Arch-Linux/cthulhu/.SRCINFO index 2a8dd5f..2f09552 100644 --- a/distro-packages/Arch-Linux/cthulhu/.SRCINFO +++ b/distro-packages/Arch-Linux/cthulhu/.SRCINFO @@ -1,7 +1,7 @@ pkgbase = cthulhu pkgdesc = Desktop-agnostic screen reader with speech, Braille, and Tentacle support pkgver = 2026.10.31 - pkgrel = 6 + pkgrel = 7 url = https://git.stormux.org/storm/cthulhu arch = x86_64 arch = aarch64 @@ -37,8 +37,10 @@ pkgbase = cthulhu options = !lto source = cthulhu::git+https://git.stormux.org/storm/cthulhu.git#tag=2026.10.31 source = ocr-descendant-test.patch + source = speech-history-test.patch sha512sums = SKIP sha512sums = d733908430bb0de8ce199b44680b9fb38165bd55d0f178f1b9f81cf5b8f9d36dd1c4ab360f6e1fad048a81ba3a52ee3f5f041e0e60aa5aeb0065429623a77a7e + sha512sums = 1fa70d8bf17a8469ef7dae342634a1d656a91bcdc2608e15ca906c4b3f88252042ec89401f9266372461d1e1e329ff7f3b8ff29d05fb04fc7c1f507c4634237a optdepends_x86_64 = wine-access: Wine, Proton, NVDA Controller, and Tolk integration pkgname = cthulhu diff --git a/distro-packages/Arch-Linux/cthulhu/PKGBUILD b/distro-packages/Arch-Linux/cthulhu/PKGBUILD index 5272356..67e16ec 100644 --- a/distro-packages/Arch-Linux/cthulhu/PKGBUILD +++ b/distro-packages/Arch-Linux/cthulhu/PKGBUILD @@ -3,7 +3,7 @@ pkgname=cthulhu pkgver=2026.10.31 -pkgrel=6 +pkgrel=7 pkgdesc="Desktop-agnostic screen reader with speech, Braille, and Tentacle support" url="https://git.stormux.org/storm/cthulhu" arch=(x86_64 aarch64 armv7h) @@ -55,13 +55,16 @@ makedepends=( options=(!debug !lto) # The release tag must exist upstream before makepkg can fetch this source. source=("${pkgname}::git+https://git.stormux.org/storm/${pkgname}.git#tag=${pkgver}" - "ocr-descendant-test.patch") + "ocr-descendant-test.patch" + "speech-history-test.patch") sha512sums=('SKIP' - 'd733908430bb0de8ce199b44680b9fb38165bd55d0f178f1b9f81cf5b8f9d36dd1c4ab360f6e1fad048a81ba3a52ee3f5f041e0e60aa5aeb0065429623a77a7e') + 'd733908430bb0de8ce199b44680b9fb38165bd55d0f178f1b9f81cf5b8f9d36dd1c4ab360f6e1fad048a81ba3a52ee3f5f041e0e60aa5aeb0065429623a77a7e' + '1fa70d8bf17a8469ef7dae342634a1d656a91bcdc2608e15ca906c4b3f88252042ec89401f9266372461d1e1e329ff7f3b8ff29d05fb04fc7c1f507c4634237a') prepare() { cd "${pkgname}" patch -Np1 -i "${srcdir}/ocr-descendant-test.patch" + patch -Np1 -i "${srcdir}/speech-history-test.patch" } build() { @@ -83,13 +86,20 @@ build() { fi } -check() { +check() ( cd "${pkgname}" export CGO_ENABLED=1 export GOPATH="${srcdir}/go" export GOCACHE="${GOCACHE:-${srcdir}/go-build}" - go test -tags brlapi ./... -count=1 -} + # Keep activated services and runtime sockets away from the build desktop. + local runtimeDir + runtimeDir=$(mktemp -d -t cthulhu-check.XXXXXXXX) || return 1 + trap 'rm -rf -- "$runtimeDir"' EXIT + env -u DISPLAY -u WAYLAND_DISPLAY -u AT_SPI_BUS_ADDRESS \ + -u DBUS_SESSION_BUS_ADDRESS -u DBUS_STARTER_ADDRESS -u DBUS_STARTER_BUS_TYPE \ + XDG_RUNTIME_DIR="$runtimeDir" GOWORK=off \ + dbus-run-session -- go test -tags brlapi ./... -count=1 +) package() { cd "${pkgname}" diff --git a/distro-packages/Arch-Linux/cthulhu/speech-history-test.patch b/distro-packages/Arch-Linux/cthulhu/speech-history-test.patch new file mode 100644 index 0000000..6f5dc7e --- /dev/null +++ b/distro-packages/Arch-Linux/cthulhu/speech-history-test.patch @@ -0,0 +1,78 @@ +diff --git a/internal/app/speech_history_test.go b/internal/app/speech_history_test.go +index d4eb637..d73811c 100644 +--- a/internal/app/speech_history_test.go ++++ b/internal/app/speech_history_test.go +@@ -194,12 +194,18 @@ func TestRunRoutesSpeechHistoryCommands(t *testing.T) { + settings := config.DefaultSettings() + settings.EnableSpeech = false + settings.EnableSound = false +- commands := &fakeCommands{commands: make(chan input.CommandEvent, 3)} ++ // An unbuffered command waits for startup before timing callback delivery. ++ commands := &fakeCommands{commands: make(chan input.CommandEvent)} + called := make(chan input.Command, 2) +- done := make(chan error, 1) ++ ctx, cancel := context.WithCancel(t.Context()) ++ done := make(chan struct{}) ++ var runError error + go func() { +- done <- Run(context.Background(), Options{ ++ defer close(done) ++ runError = Run(ctx, Options{ + Logger: slog.New(slog.DiscardHandler), Settings: &settings, ++ newSound: func() soundService { return silentSound{} }, ++ newSpeaker: func() Speaker { return &fakeSpeaker{} }, + newCommands: func() commandListener { return commands }, + newAdapter: func() Adapter { return &fakeAdapter{events: make(chan atspi.Event)} }, + newInput: func() InputListener { return &fakeInputListener{events: make(chan input.Event)} }, +@@ -207,24 +213,44 @@ func TestRunRoutesSpeechHistoryCommands(t *testing.T) { + onSpeechMonitor: func() { called <- input.ToggleSpeechMonitor }, + }) + }() ++ t.Cleanup(func() { ++ cancel() ++ select { ++ case <-done: ++ if runError != nil { ++ t.Errorf("Run: %v", runError) ++ } ++ case <-time.After(10 * time.Second): ++ t.Error("Run did not stop after cancellation") ++ } ++ }) ++ sendCommand := func(command input.Command) { ++ t.Helper() ++ select { ++ case commands.commands <- input.CommandEvent{Command: command}: ++ case <-done: ++ t.Fatalf("Run stopped before accepting %s: %v", command, runError) ++ case <-time.After(10 * time.Second): ++ t.Fatalf("Run was not ready to accept %s", command) ++ } ++ } + for _, command := range []input.Command{input.ShowSpeechHistory, input.ToggleSpeechMonitor} { +- commands.commands <- input.CommandEvent{Command: command} ++ sendCommand(command) + select { + case got := <-called: + if got != command { + t.Fatalf("routed %s, want %s", got, command) + } ++ case <-done: ++ t.Fatalf("Run stopped while routing %s: %v", command, runError) + case <-time.After(time.Second): + t.Fatalf("command %s was not routed", command) + } + } +- commands.commands <- input.CommandEvent{Command: input.Quit} ++ sendCommand(input.Quit) + select { +- case err := <-done: +- if err != nil { +- t.Fatal(err) +- } +- case <-time.After(time.Second): ++ case <-done: ++ case <-time.After(10 * time.Second): + t.Fatal("quit was not handled") + } + } diff --git a/internal/app/speech_history_test.go b/internal/app/speech_history_test.go index d4eb637..d73811c 100644 --- a/internal/app/speech_history_test.go +++ b/internal/app/speech_history_test.go @@ -194,12 +194,18 @@ func TestRunRoutesSpeechHistoryCommands(t *testing.T) { settings := config.DefaultSettings() settings.EnableSpeech = false settings.EnableSound = false - commands := &fakeCommands{commands: make(chan input.CommandEvent, 3)} + // An unbuffered command waits for startup before timing callback delivery. + commands := &fakeCommands{commands: make(chan input.CommandEvent)} called := make(chan input.Command, 2) - done := make(chan error, 1) + ctx, cancel := context.WithCancel(t.Context()) + done := make(chan struct{}) + var runError error go func() { - done <- Run(context.Background(), Options{ + defer close(done) + runError = Run(ctx, Options{ Logger: slog.New(slog.DiscardHandler), Settings: &settings, + newSound: func() soundService { return silentSound{} }, + newSpeaker: func() Speaker { return &fakeSpeaker{} }, newCommands: func() commandListener { return commands }, newAdapter: func() Adapter { return &fakeAdapter{events: make(chan atspi.Event)} }, newInput: func() InputListener { return &fakeInputListener{events: make(chan input.Event)} }, @@ -207,24 +213,44 @@ func TestRunRoutesSpeechHistoryCommands(t *testing.T) { onSpeechMonitor: func() { called <- input.ToggleSpeechMonitor }, }) }() + t.Cleanup(func() { + cancel() + select { + case <-done: + if runError != nil { + t.Errorf("Run: %v", runError) + } + case <-time.After(10 * time.Second): + t.Error("Run did not stop after cancellation") + } + }) + sendCommand := func(command input.Command) { + t.Helper() + select { + case commands.commands <- input.CommandEvent{Command: command}: + case <-done: + t.Fatalf("Run stopped before accepting %s: %v", command, runError) + case <-time.After(10 * time.Second): + t.Fatalf("Run was not ready to accept %s", command) + } + } for _, command := range []input.Command{input.ShowSpeechHistory, input.ToggleSpeechMonitor} { - commands.commands <- input.CommandEvent{Command: command} + sendCommand(command) select { case got := <-called: if got != command { t.Fatalf("routed %s, want %s", got, command) } + case <-done: + t.Fatalf("Run stopped while routing %s: %v", command, runError) case <-time.After(time.Second): t.Fatalf("command %s was not routed", command) } } - commands.commands <- input.CommandEvent{Command: input.Quit} + sendCommand(input.Quit) select { - case err := <-done: - if err != nil { - t.Fatal(err) - } - case <-time.After(time.Second): + case <-done: + case <-time.After(10 * time.Second): t.Fatal("quit was not handled") } } diff --git a/internal/app/speech_settings_test.go b/internal/app/speech_settings_test.go index c34c269..572fb47 100644 --- a/internal/app/speech_settings_test.go +++ b/internal/app/speech_settings_test.go @@ -133,6 +133,8 @@ func TestQuickSettingsCategoriesReadingAndKeyboard(t *testing.T) { applied = append(applied, next) return nil })) + // Category navigation must not query the build machine's speech service. + worker.catalog = speech.Catalog{"": {{Name: "default", Language: "en"}}} worker.live = &liveSettings{} worker.live.Store(settings) var messages []string diff --git a/internal/version/version.go b/internal/version/version.go index b00f5a6..7565eb7 100644 --- a/internal/version/version.go +++ b/internal/version/version.go @@ -21,7 +21,7 @@ import "strings" const Name = "Cthulhu" -const Version = "2026.11.16" +const Version = "2026.11.17" const Channel = "testing" var Build = Version diff --git a/tests/test_package_binaries.py b/tests/test_package_binaries.py index e13cee9..59a537f 100644 --- a/tests/test_package_binaries.py +++ b/tests/test_package_binaries.py @@ -25,6 +25,57 @@ target.chmod(0o755) class PackageBinaryTests(unittest.TestCase): + def test_checks_use_private_session_and_preserve_failure_status(self): + root = Path(__file__).resolve().parents[1] + recipes = sorted((root / "distro-packages").rglob("PKGBUILD")) + for recipe in recipes: + for exit_code in (0, 7): + with self.subTest(recipe=recipe.parent.name, exit_code=exit_code), \ + tempfile.TemporaryDirectory() as tmp: + work = Path(tmp) + (work / "cthulhu").mkdir() + desktop_runtime = work / "desktop-runtime" + desktop_runtime.mkdir() + canary = desktop_runtime / "canary" + canary.write_text("preserve\n") + runtime_record = work / "test-runtime" + tools = work / "tools" + tools.mkdir() + go = tools / "go" + go.write_text('''#!/usr/bin/env python3 +import os +from pathlib import Path +import stat +import sys +assert sys.argv[1:] == ["test", "-tags", "brlapi", "./...", "-count=1"] +assert os.environ["GOWORK"] == "off" +for name in ("DISPLAY", "WAYLAND_DISPLAY", "AT_SPI_BUS_ADDRESS", + "DBUS_STARTER_ADDRESS", "DBUS_STARTER_BUS_TYPE"): + assert name not in os.environ, name +assert os.environ["DBUS_SESSION_BUS_ADDRESS"] != "unix:path=/nonexistent-desktop-bus" +runtime = Path(os.environ["XDG_RUNTIME_DIR"]) +assert runtime != Path(os.environ["DESKTOP_RUNTIME"]) +assert stat.S_IMODE(runtime.stat().st_mode) == 0o700 +Path(os.environ["RUNTIME_RECORD"]).write_text(str(runtime)) +sys.exit(int(os.environ["CHECK_EXIT_CODE"])) +''') + go.chmod(0o755) + environment = dict( + os.environ, PATH=f"{tools}:{os.environ['PATH']}", srcdir=str(work), + XDG_RUNTIME_DIR=str(desktop_runtime), DESKTOP_RUNTIME=str(desktop_runtime), + DISPLAY=":9999", WAYLAND_DISPLAY="wayland-fixture", + AT_SPI_BUS_ADDRESS="unix:path=/nonexistent-atspi-bus", + DBUS_SESSION_BUS_ADDRESS="unix:path=/nonexistent-desktop-bus", + DBUS_STARTER_ADDRESS="unix:path=/nonexistent-starter-bus", + DBUS_STARTER_BUS_TYPE="session", GOWORK="/nonexistent/go.work", + RUNTIME_RECORD=str(runtime_record), CHECK_EXIT_CODE=str(exit_code)) + result = subprocess.run( + ["bash", "-ec", 'source "$1"\ncheck', "package-test", str(recipe)], + cwd=work, env=environment, capture_output=True, text=True, check=False) + self.assertEqual(result.returncode, exit_code, result.stderr) + self.assertFalse(Path(runtime_record.read_text()).exists()) + self.assertEqual(canary.read_text(), "preserve\n") + def test_build_and_install_source_supported_helpers(self): root = Path(__file__).resolve().parents[1] recipes = sorted((root / "distro-packages").rglob("PKGBUILD"))