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:
1 parent
1a0193030d
commit
6a02035373
5 files changed
+94
-34
No files matched your search
@@ -414,9 +414,27 @@ To add a language or update a catalog, see the
|
||||
Run the Go tests from the checkout root:
|
||||
|
||||
```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.
|
||||
Test changes affecting input, speech, or menus in the affected console or X11
|
||||
workflow as well.
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
@@ -12,6 +12,7 @@ import tempfile
|
||||
import tomllib
|
||||
|
||||
from native_terminal import KeyboardFixture, SpeechServer, wait_for
|
||||
from hardware_fixture import build_usb_fixture
|
||||
|
||||
|
||||
def main():
|
||||
@@ -24,8 +25,7 @@ def main():
|
||||
suiteRoot = Path(directory)
|
||||
libraryRoot = suiteRoot / "usb"
|
||||
libraryRoot.mkdir()
|
||||
subprocess.run(["cc", "-shared", "-fPIC", "-o", str(libraryRoot / "libusb-1.0.so.0"),
|
||||
str(repository / "internal/speech/testdata/usb_fixture.c")], check=True)
|
||||
build_usb_fixture(libraryRoot)
|
||||
keyboard = KeyboardFixture()
|
||||
try:
|
||||
for layout in ("desktop", "laptop"):
|
||||
@@ -90,7 +90,7 @@ def main():
|
||||
keyboard.key("Home", *("Down",) * index)
|
||||
start = len(server.events)
|
||||
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":
|
||||
keyboard.key("ctrl+a")
|
||||
subprocess.run(["xdotool", "type", "--delay", "1", os.ttyname(slave)], check=True)
|
||||
|
||||
@@ -12,6 +12,7 @@ import tempfile
|
||||
import tomllib
|
||||
|
||||
from native_terminal import KeyboardFixture, wait_for
|
||||
from hardware_fixture import build_usb_fixture
|
||||
|
||||
|
||||
def main():
|
||||
@@ -24,8 +25,7 @@ def main():
|
||||
suiteRoot = Path(directory)
|
||||
libraryRoot = suiteRoot / "usb"
|
||||
libraryRoot.mkdir()
|
||||
subprocess.run(["cc", "-shared", "-fPIC", "-o", str(libraryRoot / "libusb-1.0.so.0"),
|
||||
str(repository / "internal/speech/testdata/usb_fixture.c")], check=True)
|
||||
build_usb_fixture(libraryRoot)
|
||||
keyboard = KeyboardFixture()
|
||||
try:
|
||||
for driver in ("dectalk", "dectalk-usb", "litetalk", "doubletalk", "tripletalk"):
|
||||
@@ -72,8 +72,8 @@ def main():
|
||||
subprocess.run(["xdotool", "windowfocus", "--sync", state["window"]], check=True)
|
||||
expect(b"prompt")
|
||||
start = len(output())
|
||||
keyboard.key("Insert+Right", "Insert+Right", "Insert+Right")
|
||||
expect(b"speech rate 0", start) # Hardware wraps after volume.
|
||||
keyboard.key("Insert+Right", "Insert+Right", "Insert+Right", "Insert+Right")
|
||||
expect(b"speech rate 0", start) # Wrap after pitch, volume and voice profile.
|
||||
start = len(output())
|
||||
keyboard.key("Insert+Up", "Insert+ctrl+s")
|
||||
expect(b"Settings saved", start)
|
||||
|
||||
+50
-26
@@ -408,22 +408,37 @@ def main():
|
||||
actual = [item for item in server.events[start:] if item != "CANCEL"]
|
||||
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():
|
||||
return (root / "input").read_bytes() if (root / "input").exists() else b""
|
||||
|
||||
def save_menu():
|
||||
# Follow announced controls rather than assuming how many
|
||||
# Reading fields precede OK. Fail if traversal never reaches it.
|
||||
def focus_menu(label):
|
||||
# Follow announced controls as settings are added or reordered.
|
||||
for _ in range(64):
|
||||
before = len(server.events)
|
||||
key("Tab")
|
||||
text = wait_for(lambda: next((item for item in reversed(server.events[before:])
|
||||
if item != "CANCEL"), None), "next menu control")
|
||||
if text == "OK button":
|
||||
key("Return")
|
||||
spoken("Fenrir Menu closed", before)
|
||||
if text == label:
|
||||
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)
|
||||
spoken("prompt")
|
||||
@@ -724,8 +739,6 @@ def main():
|
||||
start = len(server.events)
|
||||
key(*(["Tab"] * 5))
|
||||
spoken("Speech. Speech enabled checked", start)
|
||||
key("Tab", "Up")
|
||||
spoken("Rate 81", start)
|
||||
key("Tab")
|
||||
spoken("Driver combo box Speech Dispatcher", start)
|
||||
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:]
|
||||
key("Tab", "Shift_L+Tab")
|
||||
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)
|
||||
key("Tab")
|
||||
spoken("Cancel button", start)
|
||||
@@ -771,7 +791,10 @@ def main():
|
||||
# Quick settings stay in the shared command path, never enter the
|
||||
# PTY, and configure the speaking client before their feedback.
|
||||
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+Right", "speech pitch 0"),
|
||||
("Insert+Up", "10"),
|
||||
@@ -936,7 +959,7 @@ def main():
|
||||
restart(layoutMode)
|
||||
spoken("prompt", start)
|
||||
for chord, expected in [
|
||||
("Insert+space", "speech rate 80"),
|
||||
("Insert+space", "Speech Dispatcher module default"),
|
||||
("Insert+ctrl+Right", "Reading. Punctuation level some"),
|
||||
("Insert+Up", "most"),
|
||||
("Insert+Up", "all"),
|
||||
@@ -950,7 +973,7 @@ def main():
|
||||
("Insert+Right", "Echo on CapsLock unchecked"),
|
||||
("Insert+Up", "checked"),
|
||||
("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+Left", "Echo on CapsLock checked"),
|
||||
("Insert+ctrl+Left", "Reading. Punctuation level none"),
|
||||
@@ -983,7 +1006,7 @@ def main():
|
||||
start = len(server.events)
|
||||
restart(layoutMode)
|
||||
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+Right", "Word echo checked"),
|
||||
("Insert+Right", "Echo on CapsLock checked"),
|
||||
@@ -1061,7 +1084,7 @@ def main():
|
||||
restart(layoutMode)
|
||||
spoken("prompt", start)
|
||||
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)
|
||||
key("Insert+F1")
|
||||
spoken(expected, start)
|
||||
@@ -1089,7 +1112,7 @@ def main():
|
||||
for chord in ["KP_Subtract", "KP_Divide", "Insert+bracketright"]:
|
||||
start = len(server.events)
|
||||
key(chord)
|
||||
spoken("80", start)
|
||||
spoken("Speech Dispatcher module default", start)
|
||||
for expected in (["Progress monitoring disabled", "Progress monitoring enabled"] if layoutMode == "fixture" else []):
|
||||
# Ordinary bare KP+ must acquire the X11 grab itself.
|
||||
start = len(server.events)
|
||||
@@ -1382,7 +1405,7 @@ def main():
|
||||
key("KP_Right")
|
||||
spoken("Hello world Subject", start)
|
||||
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)
|
||||
key("KP_Begin")
|
||||
speech_sequence(expected, start)
|
||||
@@ -1453,7 +1476,8 @@ def main():
|
||||
# Reading precedes the appended Keyboard table in this file.
|
||||
key("Right", "Right", "Tab", "Tab", "Tab")
|
||||
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")
|
||||
saved = tomllib.loads((root / "settings.toml").read_text())["keyboard"]
|
||||
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""
|
||||
# Navigate all three new quick choices, then reset again.
|
||||
for chord, expected in [
|
||||
("Insert+Right", "speech pitch 0"),
|
||||
("Insert+Right", "speech volume 100"),
|
||||
("Insert+Right", "Speech Dispatcher module default"),
|
||||
("Insert+space", "Speech Dispatcher module default"),
|
||||
("Insert+Up", "fixture-module"),
|
||||
("Insert+Right", "speech language default"),
|
||||
("Insert+Up", "en-US"),
|
||||
@@ -1649,6 +1671,7 @@ def main():
|
||||
for layoutMode in ["fixture", "laptop"]:
|
||||
(root / "settings.toml").write_bytes(originalSettings +
|
||||
b'[reading]\npunctuation_level="none"\nspellcheck=false\n')
|
||||
defaultSettings = (root / "settings.toml").read_bytes()
|
||||
start = len(server.events)
|
||||
restart(layoutMode)
|
||||
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"]["voice"] == "Base Voice+Variant"
|
||||
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 RESET") == b""
|
||||
start = len(server.events)
|
||||
key("Insert+space")
|
||||
select_quick("speech rate")
|
||||
spoken("speech rate -60", start)
|
||||
for request in ["SETTING RESET extra", "SETTING SAVE extra", "SETTING SAVEAS", "SETTING SAVEAS " + str(root)]:
|
||||
assert remote(request) != b"", request
|
||||
@@ -1676,7 +1699,7 @@ def main():
|
||||
assert remote("SETTING SET speech#rate=0.1") == b""
|
||||
assert remote("SETTING RESET") == b""
|
||||
start = len(server.events)
|
||||
key("Insert+space")
|
||||
select_quick("speech rate")
|
||||
spoken("speech rate 80", start)
|
||||
assert recorded() == b"", recorded()
|
||||
key("Insert+q")
|
||||
@@ -1686,7 +1709,7 @@ def main():
|
||||
restart(layoutMode)
|
||||
spoken("prompt", start)
|
||||
start = len(server.events)
|
||||
key("Insert+space")
|
||||
select_quick("speech rate")
|
||||
spoken("speech rate 80", start)
|
||||
key("Insert+q")
|
||||
restored()
|
||||
@@ -1700,6 +1723,7 @@ def main():
|
||||
start = len(server.events)
|
||||
restart(layoutMode)
|
||||
spoken("prompt", start)
|
||||
select_quick("speech rate")
|
||||
start = len(server.events)
|
||||
key("Insert+Up", "Insert+ctrl+s")
|
||||
spoken("Settings saved.", start)
|
||||
@@ -1819,7 +1843,7 @@ def main():
|
||||
restart("spellcheck-missing")
|
||||
spoken("prompt", start)
|
||||
key("Insert+s")
|
||||
spoken("dictionary for zz ZZ is unavailable", start)
|
||||
spoken("dictionary for zz line ZZ is unavailable", start)
|
||||
key("Escape", "Insert+q")
|
||||
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")
|
||||
|
||||
Reference in new issue
Block a user