mirror of
https://github.com/baketnk/frame-yap.git
synced 2026-10-06 03:00:04 +02:00
Keep Redux loaded across capture failures and diagnose grip actions
This commit is contained in:
1 parent
18a66b021c
commit
9b4bf9f047
9 files changed
+134
-44
No files matched your search
@@ -27,5 +27,11 @@ int main() {
|
||||
CHECK(s.record()); CHECK(s.finish(16000)); CHECK(s.reply(s.id(), ""));
|
||||
CHECK(s.state() == State::Ready); CHECK(!s.take_insert());
|
||||
CHECK(s.record()); CHECK(s.finish(16000)); s.fail(); CHECK(!s.reply(s.id(), "bad"));
|
||||
// Request-local model or microphone errors can leave the worker loaded:
|
||||
// discard the failed session and record again without a new warmup state.
|
||||
s.cancel(); CHECK(s.state() == State::Ready);
|
||||
CHECK(s.record()); CHECK(s.finish(16000)); CHECK(s.reply(s.id(), "again"));
|
||||
CHECK(s.take_insert() == "again"); CHECK(s.record());
|
||||
s.fail(); s.cancel(); CHECK(s.record());
|
||||
std::cout << "core checks passed\n";
|
||||
}
|
||||
@@ -43,6 +43,7 @@ def fake_child():
|
||||
time.sleep(130)
|
||||
return
|
||||
worker.send_frame(1, b"Y")
|
||||
requests = 0
|
||||
while True:
|
||||
msg = worker.read_frame(0)
|
||||
if msg is None:
|
||||
@@ -52,6 +53,7 @@ def fake_child():
|
||||
time.sleep(70)
|
||||
continue
|
||||
assert len(msg) == 9 and msg[:1] == b"T"
|
||||
requests += 1
|
||||
clip = Path(args.clip_dir) / "clip.raw"
|
||||
assert clip.stat().st_size == 3200 * 4
|
||||
ident = msg[1:9]
|
||||
@@ -60,6 +62,9 @@ def fake_child():
|
||||
if args.model == "oversized-frame":
|
||||
os.write(1, struct.pack("<I", 65537))
|
||||
continue
|
||||
if args.model == "request-error" and requests == 1:
|
||||
worker.send_frame(1, b"E", ident + b"transcription failed")
|
||||
continue
|
||||
text = b"a" * 4097 if args.model == "long" else "héllo 世界".encode()
|
||||
worker.send_frame(1, b"R", ident + text)
|
||||
if args.model == "duplicate":
|
||||
|
||||
@@ -55,6 +55,15 @@ int main(int argc, char** argv) {
|
||||
(void)entry;
|
||||
throw std::runtime_error("private directory leaked");
|
||||
}
|
||||
worker.start(argv[1], argv[2], "request-error", 2);
|
||||
until([&] { worker.poll(); return worker.ready(); });
|
||||
worker.submit(200, clip);
|
||||
until([&] { reply = worker.poll(); return reply.has_value(); });
|
||||
assert(reply->id == 200 && reply->error == "transcription failed" && worker.ready());
|
||||
worker.submit(201, clip); // A request-local failure must not unload Redux.
|
||||
until([&] { reply = worker.poll(); return reply.has_value(); });
|
||||
assert(reply->id == 201 && reply->text == "héllo 世界" && worker.ready());
|
||||
worker.stop();
|
||||
worker.start(argv[1], argv[2], "fail", 2);
|
||||
bool failed = false;
|
||||
until([&] {
|
||||
|
||||
Reference in new issue
Block a user