diff --git a/corelink/core_link.cpp b/corelink/core_link.cpp index 9304905..39c353d 100644 --- a/corelink/core_link.cpp +++ b/corelink/core_link.cpp @@ -326,9 +326,11 @@ bool CoreLink::states_supported() const { bool CoreLink::replays_supported() const { return states_supported() && link_has_replays(identity_.protocol_minor); } -bool CoreLink::request_recording(bool record, const fs::path& path) { +bool CoreLink::request_recording(bool record, const fs::path& path, bool diagnostics) { if (!replays_supported() || !can_grant()) return false; - ReplayControlMsg m{}; m.h.type=Msg::ReplayControl; m.record=record ? 1 : 0; + ReplayControlMsg m{}; + m.h.type = Msg::ReplayControl; + m.record = record ? (diagnostics ? 2 : 1) : 0; const auto p=path_utf8(path); if (p.size()>=sizeof m.path) return false; std::memcpy(m.path,p.c_str(),p.size()+1); diff --git a/corelink/core_link.hpp b/corelink/core_link.hpp index 8b1937c..75795c9 100644 --- a/corelink/core_link.hpp +++ b/corelink/core_link.hpp @@ -182,7 +182,7 @@ class CoreLink { // answers with a failure naming that. std::optional take_state_result(); bool replays_supported() const; - bool request_recording(bool record, const fs::path& path = {}); + bool request_recording(bool record, const fs::path& path = {}, bool diagnostics = false); bool replay_pending() const { return replay_pending_; } const ReplayStatusMsg& replay_status() const { return replay_status_; } diff --git a/corelink/link_protocol.hpp b/corelink/link_protocol.hpp index 348630d..164a6ed 100644 --- a/corelink/link_protocol.hpp +++ b/corelink/link_protocol.hpp @@ -182,7 +182,9 @@ struct MsgHeader { enum class ReplayState : std::uint32_t { Idle, Recording, Saved, Playing, TakenOver, Failed, Complete, Stopped }; struct ReplayControlMsg { MsgHeader h; - std::uint32_t record; // 1: start at a restored anchor, 0: stop recording + // 0: stop, 1: start full recording, 2: start a diagnostics recording. + // Use 2 only when the runner advertises safe_interactive_recording. + std::uint32_t record; char path[4096]; // exclusive destination, never overwrite }; struct ReplayStatusMsg { diff --git a/corelink/link_test_main.cpp b/corelink/link_test_main.cpp index c7eceb3..f008c13 100644 --- a/corelink/link_test_main.cpp +++ b/corelink/link_test_main.cpp @@ -105,6 +105,7 @@ int main(int argc, char** argv) { std::uint64_t at; bool save; std::string path; + bool diagnostics = false; }; std::vector state_ops; std::vector record_ops; @@ -203,10 +204,11 @@ int main(int argc, char** argv) { if (comma == std::string::npos) break; start = comma + 1; } - } else if (a == "--record-start-at") { + } else if (a == "--record-start-at" || a == "--diagnostic-record-start-at") { const auto v=val(); const auto colon=v.find(':'); if (colon==std::string::npos) die("--record-start-at K:PATH"); - record_ops.push_back({std::strtoull(v.substr(0,colon).c_str(),nullptr,10),true,v.substr(colon+1)}); + record_ops.push_back({std::strtoull(v.substr(0,colon).c_str(),nullptr,10),true, + v.substr(colon+1),a=="--diagnostic-record-start-at"}); } else if (a == "--record-stop-at") { record_ops.push_back({std::strtoull(val().c_str(),nullptr,10),false,{}}); } else if (a == "--state-save-at") { @@ -340,7 +342,8 @@ int main(int argc, char** argv) { if (clean_route_end) break; for (const StateOp& op : record_ops) { if (op.at!=k || !ok) continue; - if (!link.request_recording(op.save,utf8_path(op.path))) die("replay request refused"); + if (!link.request_recording(op.save,utf8_path(op.path),op.diagnostics)) + die("replay request refused"); while (link.replay_pending() && link.state()==LinkState::Ready) link.pump(100); const auto& status=link.replay_status(); std::printf("replay: %s at %llu state %u fields %llu %s\n",op.save ? "start" : "stop", diff --git a/corelink/runner_probe.cpp b/corelink/runner_probe.cpp index 7873fce..86bf34e 100644 --- a/corelink/runner_probe.cpp +++ b/corelink/runner_probe.cpp @@ -64,6 +64,7 @@ bool probe_runner(const fs::path& runner, RunnerVersion& out, std::string* error v.version = fields["version"]; v.commit = fields["commit"]; v.gl = fields["gl"] == "1"; + v.safe_interactive_recording = fields["safe_interactive_recording"] == "1"; if (fields.count("game_package") && !num("game_package", v.game_package)) { return fail("--version printed an unreadable game_package line"); } diff --git a/corelink/runner_probe.hpp b/corelink/runner_probe.hpp index d51e068..9c7400d 100644 --- a/corelink/runner_probe.hpp +++ b/corelink/runner_probe.hpp @@ -11,6 +11,8 @@ #include #include +#define RETRO_CORELINK_HAS_SAFE_INTERACTIVE_RECORDING 1 + namespace retro::corelink { struct RunnerVersion { @@ -19,6 +21,9 @@ struct RunnerVersion { std::uint32_t link_major = 0, link_minor = 0; std::uint32_t abi_major = 0, draft_revision = 0; bool gl = false; + // Interactive replays cannot interrupt play on a write failure and seal + // before a player state operation. Old runners omit this capability. + bool safe_interactive_recording = false; // 1 when the runner takes --package (GAME_PACKAGE cores); 0 for a runner // from before it did, which prints no game_package line. std::uint32_t game_package = 0; diff --git a/docs/BOOT_ROUTES.md b/docs/BOOT_ROUTES.md index 4c861eb..406b31b 100644 --- a/docs/BOOT_ROUTES.md +++ b/docs/BOOT_ROUTES.md @@ -59,6 +59,14 @@ reports divergence instead of weakening checkpoints. Anchors are limited to must wait for the response before granting another frame and display recording status only after confirmation. Controls are unavailable with older peers, netplay, accessories, or an active playback. Existing-file destinations refuse. + +A runner advertising `safe_interactive_recording 1` also accepts automatic +gameplay diagnostics. These recordings keep every input and clock callback +with a checkpoint at the first field and every 120 fields. They carry a +`D 1` marker and omit picture and audio digests so capture works alongside +normal presentation. Saving or loading a state seals the active interactive +recording first. Capture failures are reported to the launcher and play +continues. The frontend can list sealed `.route` files and start playback in a fresh runner using `RETRO_PLAY_ROUTE`. `RETRO_ROUTE_VERDICT` selects the result path. The hub supplies presentation and pacing. Normal completion ends the runner; @@ -96,7 +104,8 @@ configuration, not every game or future core version. ## Interrupted recording -The active file is `.partial`. The writer flushes each complete field. +The active file is `.partial`. Full recordings flush each complete +field. Automatic diagnostics flush at checkpoints. A normal link Quit or headless Ctrl+C seals completed fields in the requested route file. A fault leaves the partial file. An unsealed partial file refuses normal playback. diff --git a/runner/host_session.cpp b/runner/host_session.cpp index e8d803a..f91e0c8 100644 --- a/runner/host_session.cpp +++ b/runner/host_session.cpp @@ -64,10 +64,11 @@ std::uint32_t HostSession::h_video_acquire_cpu(void* ctx, std::uint32_t width, (format == RCORE_PIXEL_RGBA8_X2 && width > UINT32_MAX / 2) || width > UINT32_MAX / 4 || std::size_t(height) > SIZE_MAX / (std::size_t(width) * 4)) return 0; auto* s = self(ctx); + const bool observes_av = s->route_ && s->route_->observes_av(); // Replay observers retain the canonical full-width byte oracle. - if (format == RCORE_PIXEL_RGBA8_X2 && s->route_) return 0; + if (format == RCORE_PIXEL_RGBA8_X2 && observes_av) return 0; // Route observers request pictures even when the host does not display. - if (!s->video_requested_ && !s->route_) return 0; + if (!s->video_requested_ && !observes_av) return 0; // The producer always gets our full local object; an older core lends // only the rev13 prefix. Never write our appended flags into its stack. const auto supplied = std::min(out->struct_size, sizeof *out); @@ -275,12 +276,13 @@ void HostSession::h_report(void* ctx, const rcore_event* e) { } void HostSession::h_video(void* ctx, const rcore_frame* f) { - if (f && self(ctx)->route_) self(ctx)->route_->video(*f); + auto* s = self(ctx); + const bool observes_av = s->route_ && s->route_->observes_av(); + if (f && observes_av) s->route_->video(*f); if (f) { - auto* s = self(ctx); s->sink_.video_progress(f->frame_number, f->struct_size >= offsetof(rcore_frame, game_frame) + sizeof f->game_frame ? f->game_frame : 0); - if (s->video_requested_ || s->route_) s->sink_.frame(*f); + if (s->video_requested_ || observes_av) s->sink_.frame(*f); } } @@ -288,12 +290,13 @@ std::uint32_t HostSession::h_video_requested(void* ctx, std::uint64_t frame, std auto* s = self(ctx); s->sink_.video_progress(frame, picture); // Routes/recordings observe per-field pictures; never suppress those. - return s->video_requested_ || s->route_ != nullptr; + return s->video_requested_ || (s->route_ && s->route_->observes_av()); } void HostSession::h_audio(void* ctx, const std::int16_t* s, std::uint32_t n) { - if (self(ctx)->route_) self(ctx)->route_->audio(s, n); - self(ctx)->sink_.audio(s, n); + auto* host = self(ctx); + if (host->route_ && host->route_->observes_av()) host->route_->audio(s, n); + host->sink_.audio(s, n); } void HostSession::h_rate(void* ctx, std::uint32_t hz) { self(ctx)->sink_.audio_rate(hz); } diff --git a/runner/route.cpp b/runner/route.cpp index 168e9f0..fe01260 100644 --- a/runner/route.cpp +++ b/runner/route.cpp @@ -14,6 +14,7 @@ extern char** environ; namespace retro::runner { namespace { +constexpr std::uint64_t kDiagnosticCheckpointFields = 120; constexpr std::size_t limit = 256 * 1024 * 1024; std::string hex(const void* data, std::size_t n) { if (!n) return "-"; @@ -132,11 +133,18 @@ bool Route::open(const std::string& rom, const std::string& package_sha, session_.set_presentation_size(boot_.width,boot_.height); } else { partial_ = args_.record; partial_ += ".partial"; - if (fs::exists(args_.record) || fs::exists(partial_)) return fail("route or partial file already exists"); - if (!args_.record.parent_path().empty()) fs::create_directories(args_.record.parent_path()); + std::error_code ec; + const bool target_exists = fs::exists(args_.record, ec); + if (ec) return fail("cannot inspect route destination: " + ec.message()); + const bool partial_exists = fs::exists(partial_, ec); + if (ec) return fail("cannot inspect partial route: " + ec.message()); + if (target_exists || partial_exists) return fail("route or partial file already exists"); + if (!args_.record.parent_path().empty()) fs::create_directories(args_.record.parent_path(), ec); + if (ec) return fail("cannot create route directory: " + ec.message()); file_.open(partial_, std::ios::binary | std::ios::out); if (!file_) return fail("cannot create route partial file"); file_ << "RCORE_ROUTE 1\n"; + if (args_.diagnostics) file_ << "D 1\n"; for (const auto& [k,v] : identity_) file_ << "I " << hex(k) << ' ' << hex(v) << '\n'; } return true; @@ -155,13 +163,17 @@ bool Route::capture_anchor() { if (api.serialize(anchor_.data(),size) != RCORE_OK) return fail("the core refused to save the replay anchor"); const auto before=state_digest(); - // Record and playback both follow the core's restore path. - if (api.unserialize(anchor_.data(),size) != RCORE_OK) - return fail("the core refused to restore the replay anchor"); - anchor_state_=state_digest(); - if (before!=anchor_state_) { - expected_state_=before; actual_state_=anchor_state_; - return fail("the core changed state while restoring the replay anchor",true); + anchor_state_ = before; + // A developer recording checks the restore path immediately. Automatic + // diagnostics must leave the live game alone and verify on playback. + if (!args_.diagnostics) { + if (api.unserialize(anchor_.data(),size) != RCORE_OK) + return fail("the core refused to restore the replay anchor"); + anchor_state_ = state_digest(); + if (before != anchor_state_) { + expected_state_ = before; actual_state_ = anchor_state_; + return fail("the core changed state while restoring the replay anchor",true); + } } file_ << "A " << hex(anchor_state_) << ' ' << hex(anchor_.data(),anchor_.size()) << '\n'; return bool(file_); @@ -267,9 +279,18 @@ std::string Route::state_digest() const { } bool Route::end() { if (!calls_complete()) return false; - current_.state=state_digest(); - current_.image = picture_.empty() ? "-" : std::to_string(picture_width_) + ":" + std::to_string(picture_height_) + ":" + sha256_hex(picture_.data(),picture_.size()); - current_.audio = sha256_hex(pcm_.data(),pcm_.size()); + const bool checkpoint = !args_.diagnostics || next_ == 0 || + (next_ + 1) % kDiagnosticCheckpointFields == 0; + current_.state = checkpoint ? state_digest() : "*"; + if (observes_av()) { + current_.image = picture_.empty() ? "-" : + std::to_string(picture_width_) + ":" + std::to_string(picture_height_) + ":" + + sha256_hex(picture_.data(), picture_.size()); + current_.audio = sha256_hex(pcm_.data(), pcm_.size()); + } else { + current_.image = "*"; + current_.audio = "*"; + } const auto mark = args_.marks.find(next_+1); current_.mark = playback() ? frames_[next_].mark : mark == args_.marks.end() ? "" : mark->second; if (playback()) { @@ -300,7 +321,9 @@ bool Route::write_field(const Field& f, bool boot) { file_ << '\n'; } for (auto t : f.clocks) file_ << "T " << t << '\n'; - file_.flush(); + // Strict routes retain every field on disk. Background recording batches + // unobserved fields with the adjacent checkpoint instead of flushing each. + if (!args_.diagnostics || boot || f.state != "*") file_.flush(); if(file_.tellp()>std::streamoff(limit-1024))return fail("route exceeds 256 MiB limit"); return file_ ? true : fail("cannot write route"); } @@ -324,7 +347,10 @@ bool Route::read() { bool boot_seen = false; while (std::getline(lines,line)) { std::istringstream row(line); const auto type = word(row); - if (type == "I" && !boot_seen && saves_.empty()) { + if (type == "D" && !args_.diagnostics && !boot_seen && recorded_identity_.empty()) { + if (word(row) != "1") throw std::runtime_error("unsupported diagnostics recording"); + args_.diagnostics = true; + } else if (type == "I" && !boot_seen && saves_.empty()) { const auto key=unhex(word(row)), value=unhex(word(row)); if (!recorded_identity_.emplace(key,value).second) throw std::runtime_error("duplicate identity"); } else if (type == "A" && !boot_seen && saves_.empty() && anchor_.empty()) { diff --git a/runner/route.hpp b/runner/route.hpp index 8123717..4fd4d52 100644 --- a/runner/route.hpp +++ b/runner/route.hpp @@ -13,6 +13,7 @@ struct RouteArgs { fs::path record, play, verdict, runner, runner_reference; bool allow_core_change = false; bool takeover = false; + bool diagnostics = false; std::map marks; bool active() const { return !record.empty() || !play.empty(); } }; @@ -30,6 +31,7 @@ class Route { bool finish(bool success, bool stopped = false, bool taken_over = false); static bool live_input(const rcore_pad pads[RCORE_MAX_SEATS]); bool playback() const { return !args_.play.empty(); } + bool observes_av() const { return !args_.diagnostics; } bool done() const { return playback() && next_ >= frames_.size(); } std::uint64_t length() const { return frames_.size(); } std::uint64_t field() const { return next_; } diff --git a/runner/runner_link.cpp b/runner/runner_link.cpp index 40b08f5..ce53451 100644 --- a/runner/runner_link.cpp +++ b/runner/runner_link.cpp @@ -706,6 +706,7 @@ int run_link_mode(const LoadedCore& core, const CoreManifest& manifest, const Li int code = 0; bool user_quit = false; bool taken_over = false, takeover_armed = false; + bool interactive_recording = false; std::string recording_path = a.route.record.string(); auto replay_status = [&](ReplayState state, const std::string& detail = {}) { if (!link_has_replays(session_minor)) return; @@ -716,6 +717,13 @@ int run_link_mode(const LoadedCore& core, const CoreManifest& manifest, const Li send_msg(sock,msg); }; if (route) replay_status(route->playback() ? ReplayState::Playing : ReplayState::Recording); + auto end_interactive_recording = [&](bool seal) { + session.set_route(nullptr); + const bool saved = route->finish(seal) && seal; + replay_status(saved ? ReplayState::Saved : ReplayState::Failed, route->error()); + route.reset(); + interactive_recording = false; + }; for (;;) { const RecvResult rr = recv_packet(sock, buf, nullptr, -1); if (rr != RecvResult::Packet) { user_quit = true; break; } @@ -733,7 +741,7 @@ int run_link_mode(const LoadedCore& core, const CoreManifest& manifest, const Li } if (t == Msg::ReplayControl && link_has_replays(session_minor)) { ReplayControlMsg request{}; - if (!as_msg(buf,request) || request.record>1) { + if (!as_msg(buf,request) || request.record>2) { replay_status(ReplayState::Failed,"malformed replay request"); continue; } request.path[sizeof request.path-1]=0; @@ -746,6 +754,7 @@ int run_link_mode(const LoadedCore& core, const CoreManifest& manifest, const Li } route.reset(); RouteArgs args=a.route; args.play.clear(); args.record=utf8_path(request.path); + args.diagnostics = request.record == 2; args.verdict=args.record; args.verdict += ".verdict.json"; if (args.record.empty()) { replay_status(ReplayState::Failed,"a replay destination is required"); continue; } route.emplace(core,session,args,a.out); recording_path=request.path; @@ -755,7 +764,10 @@ int run_link_mode(const LoadedCore& core, const CoreManifest& manifest, const Li replay_status(ReplayState::Failed,why); route.reset(); continue; } taken_over=false; takeover_armed=false; session.set_route(&*route); + interactive_recording = true; replay_status(ReplayState::Recording); + } else if (interactive_recording) { + end_interactive_recording(true); } else if (route && !route->playback()) { session.set_route(nullptr); const bool ok=route->finish(true); @@ -764,6 +776,10 @@ int run_link_mode(const LoadedCore& core, const CoreManifest& manifest, const Li } else replay_status(ReplayState::Failed,"no recording is active"); continue; } + // State changes start a fresh timeline. Seal the interactive segment + // first so a local recording never disables the player's save controls. + if ((t == Msg::SaveState || t == Msg::LoadState) && interactive_recording) + end_interactive_recording(true); if ((t == Msg::SaveState || t == Msg::LoadState) && (a.netplay || (route && !taken_over))) { // A match starts from a cold boot and is never rewound by a player. StateDoneMsg d{}; @@ -831,7 +847,8 @@ int run_link_mode(const LoadedCore& core, const CoreManifest& manifest, const Li // next (the runner reads nothing from the hub mid-frame). session.begin_frame_accessories(); if (route && !taken_over && !route->begin(g.presentation_width,g.presentation_height)) { - code = exiting(sock,route->exit_code(),route->error()); break; + if (interactive_recording) end_interactive_recording(false); + else { code = exiting(sock,route->exit_code(),route->error()); break; } } FrameDoneMsg done{}; done.h.type = Msg::FrameDone; @@ -889,9 +906,17 @@ int run_link_mode(const LoadedCore& core, const CoreManifest& manifest, const Li } done.game_frame = sink.last_game_frame; if (route && !taken_over && done.result == RCORE_OK && !route->end()) { - code = exiting(sock,route->exit_code(),route->error()); break; + if (interactive_recording) end_interactive_recording(false); + else { code = exiting(sock,route->exit_code(),route->error()); break; } } mirror_saves(); + // An invalid picture ends the session. A successful acknowledgement + // here would allow another grant while the runner is closing. + if (sink.bad_frames) { + code = exiting(sock, 1, "the core submitted a frame this link cannot carry " + "(invalid format, geometry, or CPU target)"); + break; + } send_msg_sized(sock, done, frame_done_size); const std::uint64_t period_ns = sink.rate_num && sink.rate_den @@ -902,11 +927,6 @@ int run_link_mode(const LoadedCore& core, const CoreManifest& manifest, const Li std::fprintf(stderr, "%s\n", hint.status().c_str()); hint_said = true; } - if (sink.bad_frames) { - code = exiting(sock, 1, "the core submitted a frame this link cannot carry " - "(invalid format, geometry, or CPU target)"); - break; - } if (done.result != RCORE_OK) { code = exiting(sock, 1, "run_frame " + std::to_string(g.frame_number) + " -> " + std::to_string(done.result)); @@ -915,6 +935,7 @@ int run_link_mode(const LoadedCore& core, const CoreManifest& manifest, const Li if (route && !taken_over && route->done()) break; } session.set_route(nullptr); + if (interactive_recording) end_interactive_recording(!code && !sink.faults); if (route && !route->finish(!code && !sink.faults,user_quit)) { if (!code) code = exiting(sock,route->exit_code(),route->error()); } diff --git a/runner/runner_main.cpp b/runner/runner_main.cpp index a028cf6..f52b88b 100644 --- a/runner/runner_main.cpp +++ b/runner/runner_main.cpp @@ -317,6 +317,7 @@ void print_version() { "netplay %d\n" "netplay_module_abi %u\n" "accessory_data 1\n" + "safe_interactive_recording 1\n" "boot_routes 1\n", RETRO_RUNTIME_VERSION, RETRO_RUNTIME_VERSION, RETRO_RUNTIME_COMMIT, retro::corelink::kProtocolMajor, retro::corelink::kProtocolMinor, diff --git a/scripts/route_recover.py b/scripts/route_recover.py index 96b6f9d..35c0245 100644 --- a/scripts/route_recover.py +++ b/scripts/route_recover.py @@ -20,6 +20,9 @@ def recover(source: Path, destination: Path) -> int: row = lines[index].split() if not row or not lines[index].endswith(b'\n'): break + if index == 1 and row == [b'D', b'1']: + index += 1 + continue if row[0] in (b'I', b'A', b'S') and not boot: index += 1 continue diff --git a/tests/route_recover_test.py b/tests/route_recover_test.py index 5b3f5f9..930f81a 100644 --- a/tests/route_recover_test.py +++ b/tests/route_recover_test.py @@ -27,7 +27,7 @@ def test_complete_prefix_and_preserved_source(self): def test_anchor_prefix_is_preserved(self): with tempfile.TemporaryDirectory() as folder: source, output = Path(folder) / 'movie.partial', Path(folder) / 'recovered.route' - prefix = (b'RCORE_ROUTE 1\nA 2d 46414b45\nB 0 0 0 0 0 - - - -\n' + prefix = (b'RCORE_ROUTE 1\nD 1\nA 2d 46414b45\nB 0 0 0 0 0 - - - -\n' b'F 1 0 0 0 0 2d 2d 2d -\n') source.write_bytes(prefix) self.assertEqual(module.recover(source, output), 1) diff --git a/tests/route_test.cmake b/tests/route_test.cmake index 77ab31d..4dec7f2 100644 --- a/tests/route_test.cmake +++ b/tests/route_test.cmake @@ -63,4 +63,31 @@ execute_process(COMMAND "${RUNNER}" ${base} --play-route "${OUT}/link.route" if(NOT rc EQUAL 0) message(FATAL_ERROR "link to headless replay: ${rc} ${err}") endif() +set(segment "${OUT}/interactive-state.route") +set(state "${OUT}/interactive-state.rstate") +file(REMOVE "${segment}" "${segment}.partial" "${state}") +execute_process(COMMAND "${LINK}" --runner "${RUNNER}" ${base} --frames 12 + --diagnostic-record-start-at "1:${segment}" --state-save-at "5:${state}" --state-load-at "9:${state}" + --out "${OUT}/interactive-state" RESULT_VARIABLE rc OUTPUT_VARIABLE trace ERROR_VARIABLE err) +if(NOT rc EQUAL 0 OR NOT EXISTS "${segment}" OR NOT EXISTS "${state}" + OR NOT trace MATCHES "state: load at frame 9 ok") + message(FATAL_ERROR "interactive recording blocked a player state operation: ${rc} ${err}") +endif() +execute_process(COMMAND "${RUNNER}" ${base} --play-route "${segment}" + --out "${OUT}/interactive-state-replay" RESULT_VARIABLE rc OUTPUT_QUIET ERROR_VARIABLE err) +if(NOT rc EQUAL 0) + message(FATAL_ERROR "interactive segment before state save did not replay: ${rc} ${err}") +endif() +# An unavailable recording destination must leave the same game session alive. +set(blocked "${OUT}/recording-parent-is-a-file") +file(WRITE "${blocked}" "keep") +execute_process(COMMAND "${LINK}" --runner "${RUNNER}" ${base} --frames 8 + --diagnostic-record-start-at "1:${blocked}/fail.route" + --out "${OUT}/interactive-failed-destination" + RESULT_VARIABLE rc OUTPUT_VARIABLE trace ERROR_VARIABLE err) +file(READ "${blocked}" contents) +if(NOT rc EQUAL 0 OR NOT trace MATCHES "replay: start at 1 state 5" + OR NOT trace MATCHES "8 frame\\(s\\) granted and done" OR NOT contents STREQUAL "keep") + message(FATAL_ERROR "failed recording destination interrupted play: ${rc} ${trace} ${err}") +endif() message(STATUS "routes: fresh process, link recording, identity/truncation/grammar refusals and first divergence pass")