Refresh native regressions for shared reader core

Resolve fake USB fixtures from the selected shared transport package. Update speech control order, quick-setting and voice-profile navigation, phonetic and punctuation expectations, and persistence assertions while retaining keyboard isolation and cleanup checks.

Validated the full race-enabled Go suite, eight Python tests, vet, lint, the complete private-X11 terminal harness, and both fake-hardware suites for five synthesizers and both keyboard layouts. Live speech, physical input, Braille, and real synthesizers remain human acceptance checks.
This commit is contained in:
Storm Dragon committed 2026-11-16 23:41:22 -05:00
1 parent 1a0193030d
commit 6a02035373
5 files changed
+94 -34

No files matched your search

+19 -1
View File
@@ -414,9 +414,27 @@ To add a language or update a catalog, see the
Run the Go tests from the checkout root: Run the Go tests from the checkout root:
```bash ```bash
go test ./... GOWORK=off go test -race ./... -count=1
python3 -B -m unittest discover -s tests -p 'test_*.py'
``` ```
Build a fresh binary before running the private X11 integration checks:
```bash
export GOWORK=off
go build -o /tmp/fenrir-test ./cmd/fenrir
export FENRIR_TEST_BINARY=/tmp/fenrir-test
xvfb-run -a env FENRIR_PRIVATE_X11=1 python3 -B tests/native_terminal.py
xvfb-run -a env FENRIR_PRIVATE_X11=1 python3 -B tests/native_hardware_settings.py
xvfb-run -a env FENRIR_PRIVATE_X11=1 python3 -B tests/native_hardware_speech.py
```
Run these native checks sequentially so separate `xvfb-run` launches cannot
race for the same display. Hardware checks use private serial PTYs and a fake
USB library built from the selected `screenreader-common` transport's test
fixture. They do not require a physical synthesizer. `GOWORK=off` verifies the
pinned shared core; omit it when testing a sibling development workspace.
Device-free checks do not establish audible speech or real keyboard behavior. Device-free checks do not establish audible speech or real keyboard behavior.
Test changes affecting input, speech, or menus in the affected console or X11 Test changes affecting input, speech, or menus in the affected console or X11
workflow as well. workflow as well.
+18
View File
@@ -0,0 +1,18 @@
# Copyright (c) 2026 Storm Dragon
# SPDX-License-Identifier: GPL-3.0-or-later
"""Build the fake USB transport from the selected shared reader core."""
from pathlib import Path
import subprocess
def build_usb_fixture(libraryRoot):
repository = Path(__file__).resolve().parents[1]
transportDir = subprocess.check_output(
["go", "list", "-f", "{{.Dir}}",
"git.stormux.org/storm/screenreader-common/hardware/transport"],
cwd=repository, text=True,
).strip()
subprocess.run(
["cc", "-shared", "-fPIC", "-o", str(libraryRoot / "libusb-1.0.so.0"),
str(Path(transportDir) / "testdata/usb_fixture.c")], check=True,
)
+3 -3
View File
@@ -12,6 +12,7 @@ import tempfile
import tomllib import tomllib
from native_terminal import KeyboardFixture, SpeechServer, wait_for from native_terminal import KeyboardFixture, SpeechServer, wait_for
from hardware_fixture import build_usb_fixture
def main(): def main():
@@ -24,8 +25,7 @@ def main():
suiteRoot = Path(directory) suiteRoot = Path(directory)
libraryRoot = suiteRoot / "usb" libraryRoot = suiteRoot / "usb"
libraryRoot.mkdir() libraryRoot.mkdir()
subprocess.run(["cc", "-shared", "-fPIC", "-o", str(libraryRoot / "libusb-1.0.so.0"), build_usb_fixture(libraryRoot)
str(repository / "internal/speech/testdata/usb_fixture.c")], check=True)
keyboard = KeyboardFixture() keyboard = KeyboardFixture()
try: try:
for layout in ("desktop", "laptop"): for layout in ("desktop", "laptop"):
@@ -90,7 +90,7 @@ def main():
keyboard.key("Home", *("Down",) * index) keyboard.key("Home", *("Down",) * index)
start = len(server.events) start = len(server.events)
keyboard.key("Tab") keyboard.key("Tab")
spoken("Pitch" if driver == "dectalk-usb" else "Serial port entry", start) spoken("Rate" if driver == "dectalk-usb" else "Serial port entry", start)
if driver != "dectalk-usb": if driver != "dectalk-usb":
keyboard.key("ctrl+a") keyboard.key("ctrl+a")
subprocess.run(["xdotool", "type", "--delay", "1", os.ttyname(slave)], check=True) subprocess.run(["xdotool", "type", "--delay", "1", os.ttyname(slave)], check=True)
+4 -4
View File
@@ -12,6 +12,7 @@ import tempfile
import tomllib import tomllib
from native_terminal import KeyboardFixture, wait_for from native_terminal import KeyboardFixture, wait_for
from hardware_fixture import build_usb_fixture
def main(): def main():
@@ -24,8 +25,7 @@ def main():
suiteRoot = Path(directory) suiteRoot = Path(directory)
libraryRoot = suiteRoot / "usb" libraryRoot = suiteRoot / "usb"
libraryRoot.mkdir() libraryRoot.mkdir()
subprocess.run(["cc", "-shared", "-fPIC", "-o", str(libraryRoot / "libusb-1.0.so.0"), build_usb_fixture(libraryRoot)
str(repository / "internal/speech/testdata/usb_fixture.c")], check=True)
keyboard = KeyboardFixture() keyboard = KeyboardFixture()
try: try:
for driver in ("dectalk", "dectalk-usb", "litetalk", "doubletalk", "tripletalk"): for driver in ("dectalk", "dectalk-usb", "litetalk", "doubletalk", "tripletalk"):
@@ -72,8 +72,8 @@ def main():
subprocess.run(["xdotool", "windowfocus", "--sync", state["window"]], check=True) subprocess.run(["xdotool", "windowfocus", "--sync", state["window"]], check=True)
expect(b"prompt") expect(b"prompt")
start = len(output()) start = len(output())
keyboard.key("Insert+Right", "Insert+Right", "Insert+Right") keyboard.key("Insert+Right", "Insert+Right", "Insert+Right", "Insert+Right")
expect(b"speech rate 0", start) # Hardware wraps after volume. expect(b"speech rate 0", start) # Wrap after pitch, volume and voice profile.
start = len(output()) start = len(output())
keyboard.key("Insert+Up", "Insert+ctrl+s") keyboard.key("Insert+Up", "Insert+ctrl+s")
expect(b"Settings saved", start) expect(b"Settings saved", start)
+50 -26
View File
@@ -408,22 +408,37 @@ def main():
actual = [item for item in server.events[start:] if item != "CANCEL"] actual = [item for item in server.events[start:] if item != "CANCEL"]
assert actual == expected, (actual, expected) assert actual == expected, (actual, expected)
def select_quick(label):
# Select by its announced label; backend changes can rebuild
# the Speech category and reset its selected entry.
for chord in ["Insert+space"] + ["Insert+Right"] * 8:
before = len(server.events)
key(chord)
text = wait_for(lambda: next((item for item in reversed(server.events[before:])
if item != "CANCEL"), None), "quick setting")
if text.startswith(label + " "):
return
raise AssertionError("Quick settings did not offer " + label)
def recorded(): def recorded():
return (root / "input").read_bytes() if (root / "input").exists() else b"" return (root / "input").read_bytes() if (root / "input").exists() else b""
def save_menu(): def focus_menu(label):
# Follow announced controls rather than assuming how many # Follow announced controls as settings are added or reordered.
# Reading fields precede OK. Fail if traversal never reaches it.
for _ in range(64): for _ in range(64):
before = len(server.events) before = len(server.events)
key("Tab") key("Tab")
text = wait_for(lambda: next((item for item in reversed(server.events[before:]) text = wait_for(lambda: next((item for item in reversed(server.events[before:])
if item != "CANCEL"), None), "next menu control") if item != "CANCEL"), None), "next menu control")
if text == "OK button": if text == label:
key("Return")
spoken("Fenrir Menu closed", before)
return return
raise AssertionError("Menu traversal did not reach OK") raise AssertionError("Menu traversal did not reach " + label)
def save_menu():
focus_menu("OK button")
before = len(server.events)
key("Return")
spoken("Fenrir Menu closed", before)
xdo("windowfocus", "--sync", window) xdo("windowfocus", "--sync", window)
spoken("prompt") spoken("prompt")
@@ -724,8 +739,6 @@ def main():
start = len(server.events) start = len(server.events)
key(*(["Tab"] * 5)) key(*(["Tab"] * 5))
spoken("Speech. Speech enabled checked", start) spoken("Speech. Speech enabled checked", start)
key("Tab", "Up")
spoken("Rate 81", start)
key("Tab") key("Tab")
spoken("Driver combo box Speech Dispatcher", start) spoken("Driver combo box Speech Dispatcher", start)
xdo("type", "--delay", "10", "invented-driver") xdo("type", "--delay", "10", "invented-driver")
@@ -737,7 +750,14 @@ def main():
assert not any("Speech Dispatcher module combo box" in item for item in server.events[start:]), server.events[start:] assert not any("Speech Dispatcher module combo box" in item for item in server.events[start:]), server.events[start:]
key("Tab", "Shift_L+Tab") key("Tab", "Shift_L+Tab")
spoken("Speech Dispatcher module combo box fixture-module", start) spoken("Speech Dispatcher module combo box fixture-module", start)
key("Home", "Tab", "Tab", "Tab", "Tab", "Tab", "Tab", "Tab") key("Home", "Tab")
spoken("Speech language combo box default", start)
key("Tab")
spoken("Speech voice combo box default", start)
key("Tab", "Right")
spoken("Rate 81", start)
key("Tab", "Tab")
focus_menu("OK button")
spoken("OK button", start) spoken("OK button", start)
key("Tab") key("Tab")
spoken("Cancel button", start) spoken("Cancel button", start)
@@ -771,7 +791,10 @@ def main():
# Quick settings stay in the shared command path, never enter the # Quick settings stay in the shared command path, never enter the
# PTY, and configure the speaking client before their feedback. # PTY, and configure the speaking client before their feedback.
for chord, expected in [ for chord, expected in [
("Insert+space", "speech rate 80"), ("Insert+space", "Speech Dispatcher module default"),
("Insert+Right", "speech language default"),
("Insert+Right", "speech voice default"),
("Insert+Right", "speech rate 80"),
("Insert+Up", "90"), ("Insert+Up", "90"),
("Insert+Right", "speech pitch 0"), ("Insert+Right", "speech pitch 0"),
("Insert+Up", "10"), ("Insert+Up", "10"),
@@ -936,7 +959,7 @@ def main():
restart(layoutMode) restart(layoutMode)
spoken("prompt", start) spoken("prompt", start)
for chord, expected in [ for chord, expected in [
("Insert+space", "speech rate 80"), ("Insert+space", "Speech Dispatcher module default"),
("Insert+ctrl+Right", "Reading. Punctuation level some"), ("Insert+ctrl+Right", "Reading. Punctuation level some"),
("Insert+Up", "most"), ("Insert+Up", "most"),
("Insert+Up", "all"), ("Insert+Up", "all"),
@@ -950,7 +973,7 @@ def main():
("Insert+Right", "Echo on CapsLock unchecked"), ("Insert+Right", "Echo on CapsLock unchecked"),
("Insert+Up", "checked"), ("Insert+Up", "checked"),
("Insert+Right", "Character echo unchecked"), ("Insert+Right", "Character echo unchecked"),
("Insert+ctrl+Right", "Speech. speech rate 80"), ("Insert+ctrl+Right", "Speech. Speech Dispatcher module default"),
("Insert+ctrl+Left", "Keyboard. Character echo unchecked"), ("Insert+ctrl+Left", "Keyboard. Character echo unchecked"),
("Insert+Left", "Echo on CapsLock checked"), ("Insert+Left", "Echo on CapsLock checked"),
("Insert+ctrl+Left", "Reading. Punctuation level none"), ("Insert+ctrl+Left", "Reading. Punctuation level none"),
@@ -983,7 +1006,7 @@ def main():
start = len(server.events) start = len(server.events)
restart(layoutMode) restart(layoutMode)
spoken("prompt", start) spoken("prompt", start)
for chord, expected in [("Insert+space", "speech rate 80"), for chord, expected in [("Insert+space", "Speech Dispatcher module default"),
("Insert+ctrl+Left", "Keyboard. Character echo unchecked"), ("Insert+ctrl+Left", "Keyboard. Character echo unchecked"),
("Insert+Right", "Word echo checked"), ("Insert+Right", "Word echo checked"),
("Insert+Right", "Echo on CapsLock checked"), ("Insert+Right", "Echo on CapsLock checked"),
@@ -1061,7 +1084,7 @@ def main():
restart(layoutMode) restart(layoutMode)
spoken("prompt", start) spoken("prompt", start)
for expected in [time.strftime("%H hours and %M minutes"), for expected in [time.strftime("%H hours and %M minutes"),
time.strftime("%Y %m %d"), "speech rate 80"]: time.strftime("%Y %m %d"), "Speech Dispatcher module default"]:
start = len(server.events) start = len(server.events)
key("Insert+F1") key("Insert+F1")
spoken(expected, start) spoken(expected, start)
@@ -1089,7 +1112,7 @@ def main():
for chord in ["KP_Subtract", "KP_Divide", "Insert+bracketright"]: for chord in ["KP_Subtract", "KP_Divide", "Insert+bracketright"]:
start = len(server.events) start = len(server.events)
key(chord) key(chord)
spoken("80", start) spoken("Speech Dispatcher module default", start)
for expected in (["Progress monitoring disabled", "Progress monitoring enabled"] if layoutMode == "fixture" else []): for expected in (["Progress monitoring disabled", "Progress monitoring enabled"] if layoutMode == "fixture" else []):
# Ordinary bare KP+ must acquire the X11 grab itself. # Ordinary bare KP+ must acquire the X11 grab itself.
start = len(server.events) start = len(server.events)
@@ -1382,7 +1405,7 @@ def main():
key("KP_Right") key("KP_Right")
spoken("Hello world Subject", start) spoken("Hello world Subject", start)
for expected in [["Hello world Subject"], list("Hello") + ["space"] + list("world"), for expected in [["Hello world Subject"], list("Hello") + ["space"] + list("world"),
["Hotel", "echo", "lima", "lima", "oscar", "space", "whisky", "oscar", "romeo", "lima", "delta"]]: ["Hotel", "echo", "lima", "lima", "oscar", "space", "whiskey", "oscar", "romeo", "lima", "delta"]]:
start = len(server.events) start = len(server.events)
key("KP_Begin") key("KP_Begin")
speech_sequence(expected, start) speech_sequence(expected, start)
@@ -1453,7 +1476,8 @@ def main():
# Reading precedes the appended Keyboard table in this file. # Reading precedes the appended Keyboard table in this file.
key("Right", "Right", "Tab", "Tab", "Tab") key("Right", "Right", "Tab", "Tab", "Tab")
spoken("Character echo unchecked", start) spoken("Character echo unchecked", start)
key("space", "Tab", "space", "Tab", "space", "Tab", "Return") key("space", "Tab", "space", "Tab", "space")
save_menu()
wait_for(lambda: tomllib.loads((root / "settings.toml").read_text())["keyboard"]["character_echo"], "echo settings save") wait_for(lambda: tomllib.loads((root / "settings.toml").read_text())["keyboard"]["character_echo"], "echo settings save")
saved = tomllib.loads((root / "settings.toml").read_text())["keyboard"] saved = tomllib.loads((root / "settings.toml").read_text())["keyboard"]
assert saved["character_echo"] and not saved["word_echo"] and saved["echo_on_capslock"], saved assert saved["character_echo"] and not saved["word_echo"] and saved["echo_on_capslock"], saved
@@ -1564,9 +1588,7 @@ def main():
assert remote("SETTING RESET") == b"" assert remote("SETTING RESET") == b""
# Navigate all three new quick choices, then reset again. # Navigate all three new quick choices, then reset again.
for chord, expected in [ for chord, expected in [
("Insert+Right", "speech pitch 0"), ("Insert+space", "Speech Dispatcher module default"),
("Insert+Right", "speech volume 100"),
("Insert+Right", "Speech Dispatcher module default"),
("Insert+Up", "fixture-module"), ("Insert+Up", "fixture-module"),
("Insert+Right", "speech language default"), ("Insert+Right", "speech language default"),
("Insert+Up", "en-US"), ("Insert+Up", "en-US"),
@@ -1649,6 +1671,7 @@ def main():
for layoutMode in ["fixture", "laptop"]: for layoutMode in ["fixture", "laptop"]:
(root / "settings.toml").write_bytes(originalSettings + (root / "settings.toml").write_bytes(originalSettings +
b'[reading]\npunctuation_level="none"\nspellcheck=false\n') b'[reading]\npunctuation_level="none"\nspellcheck=false\n')
defaultSettings = (root / "settings.toml").read_bytes()
start = len(server.events) start = len(server.events)
restart(layoutMode) restart(layoutMode)
spoken("prompt", start) spoken("prompt", start)
@@ -1659,11 +1682,11 @@ def main():
assert tomllib.loads(exported.decode())["presentation"]["speech"]["rate"] == -60 assert tomllib.loads(exported.decode())["presentation"]["speech"]["rate"] == -60
assert tomllib.loads(exported.decode())["presentation"]["speech"]["voice"] == "Base Voice+Variant" assert tomllib.loads(exported.decode())["presentation"]["speech"]["voice"] == "Base Voice+Variant"
assert exportPath.stat().st_mode & 0o777 == 0o600 assert exportPath.stat().st_mode & 0o777 == 0o600
assert "rate" not in tomllib.loads((root / "settings.toml").read_text())["presentation"]["speech"] assert (root / "settings.toml").read_bytes() == defaultSettings, "SAVEAS changed the default file"
assert remote("SETTING SET speech#rate=0.8;sound#volume=0.8;speech#language=de;speech#voice=German") == b"" assert remote("SETTING SET speech#rate=0.8;sound#volume=0.8;speech#language=de;speech#voice=German") == b""
assert remote("SETTING RESET") == b"" assert remote("SETTING RESET") == b""
start = len(server.events) start = len(server.events)
key("Insert+space") select_quick("speech rate")
spoken("speech rate -60", start) spoken("speech rate -60", start)
for request in ["SETTING RESET extra", "SETTING SAVE extra", "SETTING SAVEAS", "SETTING SAVEAS " + str(root)]: for request in ["SETTING RESET extra", "SETTING SAVE extra", "SETTING SAVEAS", "SETTING SAVEAS " + str(root)]:
assert remote(request) != b"", request assert remote(request) != b"", request
@@ -1676,7 +1699,7 @@ def main():
assert remote("SETTING SET speech#rate=0.1") == b"" assert remote("SETTING SET speech#rate=0.1") == b""
assert remote("SETTING RESET") == b"" assert remote("SETTING RESET") == b""
start = len(server.events) start = len(server.events)
key("Insert+space") select_quick("speech rate")
spoken("speech rate 80", start) spoken("speech rate 80", start)
assert recorded() == b"", recorded() assert recorded() == b"", recorded()
key("Insert+q") key("Insert+q")
@@ -1686,7 +1709,7 @@ def main():
restart(layoutMode) restart(layoutMode)
spoken("prompt", start) spoken("prompt", start)
start = len(server.events) start = len(server.events)
key("Insert+space") select_quick("speech rate")
spoken("speech rate 80", start) spoken("speech rate 80", start)
key("Insert+q") key("Insert+q")
restored() restored()
@@ -1700,6 +1723,7 @@ def main():
start = len(server.events) start = len(server.events)
restart(layoutMode) restart(layoutMode)
spoken("prompt", start) spoken("prompt", start)
select_quick("speech rate")
start = len(server.events) start = len(server.events)
key("Insert+Up", "Insert+ctrl+s") key("Insert+Up", "Insert+ctrl+s")
spoken("Settings saved.", start) spoken("Settings saved.", start)
@@ -1819,7 +1843,7 @@ def main():
restart("spellcheck-missing") restart("spellcheck-missing")
spoken("prompt", start) spoken("prompt", start)
key("Insert+s") key("Insert+s")
spoken("dictionary for zz ZZ is unavailable", start) spoken("dictionary for zz line ZZ is unavailable", start)
key("Escape", "Insert+q") key("Escape", "Insert+q")
restored() restored()
print("PASS: spellcheck in both layouts, real Enchant suggestions/filter/copy, review source, automatic feedback, PATH/builtins without execution, add/delete/undo/copy, exception persistence, saved disabled startup, manual menu while disabled and missing dictionary") print("PASS: spellcheck in both layouts, real Enchant suggestions/filter/copy, review source, automatic feedback, PATH/builtins without execution, add/delete/undo/copy, exception persistence, saved disabled startup, manual menu while disabled and missing dictionary")