Keep speech regression gate current with shared voice profiles
This commit is contained in:
1 parent
5fd5a26120
commit
758b038e1a
3 files changed
+81
-5
No files matched your search
+5
-2
@@ -93,8 +93,11 @@ existing hook rather than overwriting it. The old Python version hook and
|
|||||||
### Speech regression push check
|
### Speech regression push check
|
||||||
|
|
||||||
Run `python3 tests/check_speech.py` for speech queue, title, Wine review metadata,
|
Run `python3 tests/check_speech.py` for speech queue, title, Wine review metadata,
|
||||||
held-key repeat and fresh-key interruption regressions. This uses a private
|
held-key repeat, fresh-key interruption, voice-profile persistence and defaults,
|
||||||
D-Bus session, the race detector and the native build dependencies above;
|
preview restoration, and combo selection regressions. The check uses the pinned
|
||||||
|
shared reader core with `GOWORK=off`, including when launched from a development
|
||||||
|
workspace. It uses a private D-Bus session, the race detector and the native
|
||||||
|
build dependencies above;
|
||||||
it requires Python 3 and `dbus-run-session`. Required tests must pass: deleting
|
it requires Python 3 and `dbus-run-session`. Required tests must pass: deleting
|
||||||
or skipping a required test fails the check. It does not use the active reader,
|
or skipping a required test fails the check. It does not use the active reader,
|
||||||
the desktop display, or audible speech.
|
the desktop display, or audible speech.
|
||||||
|
|||||||
+18
-3
@@ -26,6 +26,16 @@ requiredTests = {
|
|||||||
"TestEchoSpeakerSwitchesBothVoicesTransactionally",
|
"TestEchoSpeakerSwitchesBothVoicesTransactionally",
|
||||||
"TestSpeechWorkerKeyEchoCompletesBeforeCaretSpeech",
|
"TestSpeechWorkerKeyEchoCompletesBeforeCaretSpeech",
|
||||||
"TestSpeechWorkerKeyEchoWaitStillAllowsInputInterruption",
|
"TestSpeechWorkerKeyEchoWaitStillAllowsInputInterruption",
|
||||||
|
"TestQuickVoiceProfilesFailurePersistenceAndApplicationInheritance",
|
||||||
|
"TestQuickVoiceProfileDefaultRestoresSavedVoiceFromCustom",
|
||||||
|
"TestQuickVoiceProfileDefaultIsFocusedApplicationVoice",
|
||||||
|
"TestAppliedNewVoiceProfileIsImmediatelyAvailableAcrossApplications",
|
||||||
|
"TestProfileVoicePreviewReachesBackendWithoutCommitting",
|
||||||
|
"TestPreferencesVoicePreviewDoesNotCommitAndCancelRestores",
|
||||||
|
"TestPreferencesSessionRestoresPreviewAfterRejectedApplyAndReopen",
|
||||||
|
"TestVoiceProfilesPersistencePrimaryScopeAndApplicationSave",
|
||||||
|
"TestClosedGTKComboSelectionSpeaksOnlyNewValue",
|
||||||
|
"TestComboHistoryKeepsFocusedValueAcrossOtherComboUpdates",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -37,13 +47,18 @@ def run_checks(sourceRoot: Path) -> None:
|
|||||||
del testEnv[name]
|
del testEnv[name]
|
||||||
testEnv.pop("DISPLAY", None)
|
testEnv.pop("DISPLAY", None)
|
||||||
testEnv.pop("WAYLAND_DISPLAY", None)
|
testEnv.pop("WAYLAND_DISPLAY", None)
|
||||||
|
# A pushed snapshot must use its pinned dependency, even when the caller
|
||||||
|
# develops against a sibling screenreader-common workspace.
|
||||||
|
testEnv["GOWORK"] = "off"
|
||||||
testEnv["CTHULHU_WINE_TITLE_DBUS"] = "1"
|
testEnv["CTHULHU_WINE_TITLE_DBUS"] = "1"
|
||||||
|
testPattern = ("^Test.*(Title|Repeat|Interrupt|Echo)|^Test(SpeechWorker|Cancel|WineReview)|"
|
||||||
|
"^(" + "|".join(sorted(requiredTests)) + ")$")
|
||||||
command = [
|
command = [
|
||||||
"dbus-run-session", "--", "go", "test", "-json", "-race", "-count=1",
|
"dbus-run-session", "--", "go", "test", "-json", "-race", "-count=1",
|
||||||
"-timeout=60s", "-run", "^Test.*(Title|Repeat|Interrupt|Echo)|^Test(SpeechWorker|Cancel|WineReview)",
|
"-timeout=60s", "-run", testPattern,
|
||||||
"./internal/app", "./internal/input", "./internal/presentation", "./internal/speech", "./internal/wine",
|
"./internal/app", "./internal/config", "./internal/input", "./internal/presentation", "./internal/speech", "./internal/wine",
|
||||||
]
|
]
|
||||||
print("Checking speech queues, key echo, Wine metadata and key interruption...", flush=True)
|
print("Checking speech queues, key echo, voice profiles, previews, combo feedback and key interruption...", flush=True)
|
||||||
result = run_private_session(command, cwd=sourceRoot, env=testEnv, text=True,
|
result = run_private_session(command, cwd=sourceRoot, env=testEnv, text=True,
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=False)
|
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=False)
|
||||||
passedTests = set()
|
passedTests = set()
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
# Copyright (c) 2026 Storm Dragon
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
"""Check required regression selection and failure handling without live speech."""
|
||||||
|
import contextlib
|
||||||
|
import io
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
import re
|
||||||
|
import subprocess
|
||||||
|
import unittest
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
import check_speech
|
||||||
|
|
||||||
|
|
||||||
|
class SpeechCheckTests(unittest.TestCase):
|
||||||
|
def run_check(self, events, returnCode=0):
|
||||||
|
result = subprocess.CompletedProcess([], returnCode, "\n".join(
|
||||||
|
json.dumps(event) for event in events))
|
||||||
|
with patch("check_speech.run_private_session", return_value=result) as run, \
|
||||||
|
contextlib.redirect_stdout(io.StringIO()), \
|
||||||
|
contextlib.redirect_stderr(io.StringIO()):
|
||||||
|
check_speech.run_checks(Path("/private/source"))
|
||||||
|
return run.call_args
|
||||||
|
|
||||||
|
def passing_events(self):
|
||||||
|
return [{"Action": "pass", "Test": name} for name in check_speech.requiredTests]
|
||||||
|
|
||||||
|
def test_selects_required_tests_from_standalone_snapshot(self):
|
||||||
|
with patch.dict("os.environ", {"GOWORK": "/private/go.work",
|
||||||
|
"GIT_DIR": "/private/other/.git"}):
|
||||||
|
call = self.run_check(self.passing_events())
|
||||||
|
command = call.args[0]
|
||||||
|
pattern = command[command.index("-run") + 1]
|
||||||
|
for name in check_speech.requiredTests:
|
||||||
|
self.assertIsNotNone(re.search(pattern, name), name)
|
||||||
|
self.assertIn("./internal/config", command)
|
||||||
|
self.assertEqual(call.kwargs["env"]["GOWORK"], "off")
|
||||||
|
self.assertNotIn("GIT_DIR", call.kwargs["env"])
|
||||||
|
self.assertEqual(call.kwargs["cwd"], Path("/private/source"))
|
||||||
|
|
||||||
|
def test_missing_required_test_fails(self):
|
||||||
|
with self.assertRaisesRegex(RuntimeError, "speech regression check failed"):
|
||||||
|
self.run_check(self.passing_events()[1:])
|
||||||
|
|
||||||
|
def test_skipped_required_test_fails(self):
|
||||||
|
events = self.passing_events()
|
||||||
|
events[0]["Action"] = "skip"
|
||||||
|
with self.assertRaisesRegex(RuntimeError, "speech regression check failed"):
|
||||||
|
self.run_check(events)
|
||||||
|
|
||||||
|
def test_process_failure_fails_even_when_required_tests_pass(self):
|
||||||
|
with self.assertRaisesRegex(RuntimeError, "speech regression check failed"):
|
||||||
|
self.run_check(self.passing_events(), returnCode=1)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
unittest.main()
|
||||||
Reference in new issue
Block a user