Verify canonical replay under opposing worker completion orders
This commit is contained in:
1 parent
66af7c5bb9
commit
ef980af125
7 files changed
+621
-20
No files matched your search
@@ -0,0 +1,48 @@
|
||||
# Prove deterministic arbitration under opposing worker completion orders
|
||||
|
||||
Task ID: S21-01
|
||||
Role: astra_implementer
|
||||
Status: READY
|
||||
|
||||
## 1. Context and baseline
|
||||
Isolated system/s21-verification at 66af7c5. World assign_idle_agents calculates independent candidates for idle residents then assigns competing jobs in stable order. Meal claim is serial before parallel movement. Existing replay compares Current14 state for 1/2/6/12, last meal and mid-delivery plus capacity1; scheduler hooks currently before_submit/before_execute only. M01-P6/F9 request an observer of actual returns and readable divergence reports.
|
||||
|
||||
## 2. Objective and deliverables
|
||||
Implement a minimal optional success observer in the real WorkerPool adapter, prove opposite actual calculation completions and deterministic arbitration, and report first divergence through domain facts tied to canonical bytes. Verify runtime install waits for outstanding work and fresh session fences stale results.
|
||||
|
||||
## 3. Scope and non-goals
|
||||
WorkerPool instrumentation, tests and S21 verification docs only. No World scheduling/codec/receipt semantic changes, no synthetic exploit inputs or unrelated rendering/milestone changes. Native Windows hardware separate.
|
||||
|
||||
## 4. Files to inspect
|
||||
Read engine/include/settlement/core/worker_pool.hpp, engine/src/worker_pool.cpp/world.cpp (actual partitions and meal selection), runtime source, tests/{executor,replay,runtime}_tests.cpp, M01-P6/F9 and S21. Void FuturePool/Testing at pinned clone and issue #15.
|
||||
|
||||
## 5. Write ownership and coordination
|
||||
Write scope: engine/include/settlement/core/worker_pool.hpp; tests/executor_tests.cpp; tests/replay_tests.cpp; tests/runtime_tests.cpp; NEW tests/replay_diagnostics.hpp only if useful; docs/plan/systems/S21.md
|
||||
Isolated s21 only. Other agents own sibling source. No CMake mutations, shared project switch, children/Git/remote changes. Root integrates.
|
||||
|
||||
## 6. Implementation or investigation approach
|
||||
NEW optional WorkerPoolOptions::after_execute(index), success-only after callable returns before result future ready. Account for optional observer alone in submission indexing. Preserve original no-hook path and hook/call behavior for void, values, lvalue refs, move-only closures/results and exceptions on worker + inline fallback. Observer exceptions reach corresponding future; no throwing destructor. Test using separate driver and bounded CV gate for two known submissions; release on all exit paths. Only block task B until A has actually returned (post hook), then reverse. Never wait for all tasks/lanes or rely on sleeps/scheduling chance.
|
||||
|
||||
## 7. Interfaces and data contracts
|
||||
Fresh two-resident/one real reachable WorkJob scenario, opposite completion traces must be observed even with max_admitted1 on a separate driver, 2/6/12. Verify deterministic winner and each future state equal serial canonical Current14. Last berry serial claim test/cargo/movement preserve independent one-winner evidence, do not claim parallel meal arbitration. Add old worker held, queue same-world earlier load, verify old view remains readable/install pending until drained, replacement identity fresh, old request rejected, current state intact after further fence.
|
||||
|
||||
## 8. Dependencies and integration
|
||||
Test-local semantic reporting only when canonical byte comparison differs (existing Current14 encoder remains oracle). Include seed/scenario, attempt/tick, concurrency/schedule, load, stable first differing entity/property and expected/actual, command/receipt player/number/status/revision or byte-offset fallback. Actor/job/storage stack as owner plus type for current14; support absent/extra records. Test at least stock/job/command divergences individually and equal-case. Later body15 will extend this; don't introduce alternate persistence schema. Reuse existing helpers/tests.
|
||||
|
||||
## 9. Edge cases security and performance
|
||||
Bound waits even on CI; each branch releases gates before destroying/joining pool; no assertion library calls from worker threads. Keep hook captures alive; no mutex while running user callbacks. When no selector installed, no new allocations/counters per job. Tested genuine Submit paths including inline. No simulated full native performance claim.
|
||||
|
||||
## 10. Acceptance criteria
|
||||
1. Tests fail when completion acknowledgement incorrectly moves to start, schedules traces must be opposite and canonical states match. 2. Observer sees returned value/reference/void, exceptions incl hook and overload, callable ownership preserved. 3. Reload barrier stale work/commands and snapshot fencing checked. 4. Domain diagnostics exercised with expected entity ID/field/receipt context. 5. All CTest, corpus, focused tags and docs checks pass.
|
||||
|
||||
## 11. Verification commands and evidence
|
||||
Source /tmp/stoneheart-verify.KoZwE4o8/env.sh. From YOUR worktree configure cmake -S . -B /tmp/stoneheart-milestones.xprJ2SVp/s21-replay-build -G Ninja --toolchain "$SETTLEMENT_VERIFY/cross.cmake" -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release -DFETCHCONTENT_SOURCE_DIR_VOID_LIBRARY:PATH="$SETTLEMENT_VERIFY/candidate/_deps/void_library-src". Build with cmake --build <that dir> --parallel 6, run ctest --test-dir <that dir> --output-on-failure and your targeted tests. Evidence required. Run CTest -V and --tag executor, --tag replay and --tag runtime under Wine; record s21-replay-* logs and commands. Old normal corpus should remain unchanged, use available trajectory probes as appropriate. Actual checks rather than latency claims.
|
||||
|
||||
## 12. Constraints and stop conditions
|
||||
Stop if index pair cannot be tied to real first job-choice partition: identify actual code and adjust fixture, no pretend success. No global installation or unrelated changes. Two failed same-cause fixes escalate. No children/Git/remote writes.
|
||||
|
||||
## 13. Authorization and decisions
|
||||
User authorizes complete M01 and separate S21 system branch; root approved test-only success observer and strict canonical oracle. [Void/Library completion test facility](https://git.faumaray.com/Void/Library/issues/15) documents the replacement test. Root publishes.
|
||||
|
||||
## 14. Return format
|
||||
Return S21-01 READY/PARTIAL, bounded integration/worker semantics, branch files, tests with actual opposing traces/diagnostic cases/corpus, native limits.
|
||||
@@ -73,3 +73,80 @@ powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\build.ps1
|
||||
Текущие тесты используют `Void::Testing`. Перед собственным runner, профилировщиком, таймером, журналом и форматом отчёта проверить существующие возможности VoidLibrary. Использовать подходящую реализацию. Для отсутствующей возможности найти или создать issue в `Void/Library`, приложить воспроизводимый пример нужного поведения и связать локальную реализацию с issue. [Матрица VoidLibrary](../void-library.md)
|
||||
|
||||
Система принята, когда каждый обязательный сценарий имеет команду запуска либо точную ручную процедуру, исходный мир, фактический результат и границы среды. Финальный отчёт различает кросс-сборку, Wine, нативную Windows, физические ПК и измерения GPU. Готовность пакета подтверждается запуском из поставки с её библиотеками и материалами. [Сохранения](S15.md) · [Сеть](S16.md) · [Происхождение материалов](S20.md)
|
||||
|
||||
## M01: наблюдаемый порядок завершения (S21-01)
|
||||
|
||||
Проверка подготовлена поверх `66af7c5` в `system/s21-verification`. Закреплённый
|
||||
Void `7b0fea6095f603f9e1904f66dfdc7752f4be4792` предоставляет `FuturePool::try_submit`
|
||||
с сохранением отклонённого callable и доставкой исключений через future. Его
|
||||
`Testing::DeterministicRun` управляет тестовыми действиями; он не наблюдает возврат
|
||||
реального `World` callable. Поэтому локальный `WorkerPoolOptions::after_execute(index)`
|
||||
вызывается после успешного возврата callable, перед готовностью future. Исключение
|
||||
наблюдателя попадает в тот же future; ошибка до исполнения или внутри callable
|
||||
не вызывает наблюдателя. Без хуков остаётся прежняя ветка без счётчика отправок.
|
||||
[Реализация](../../../engine/include/settlement/core/worker_pool.hpp) ·
|
||||
[Контракт замены Void/Library#15](https://git.faumaray.com/Void/Library/issues/15).
|
||||
|
||||
Условие замены локального наблюдателя библиотечным — сохранить проверяемые возврат
|
||||
`void`, значения, lvalue-ссылки, move-only результата и callable, ровно одно
|
||||
успешное уведомление, исключения и исполнение при переполнении на координаторе.
|
||||
[ExecutorTests](../../../tests/executor_tests.cpp) дополнительно удерживает сам
|
||||
наблюдатель и проверяет, что future ещё не готов. Перенос уведомления к началу
|
||||
вызова нарушает проверку завершённого действия.
|
||||
|
||||
[ReplayTests](../../../tests/replay_tests.cpp) использует два отдельных сценария:
|
||||
|
||||
- Seed 101, два жителя в `(5,1)`, одно достижимое общее задание в `(1,1)`.
|
||||
При 2/6/12 потоках первые отправки 0 и 1 — реальные независимые вычисления
|
||||
`choose_jobs` для жителей 0 и 1. Контроллер разрешает первый расчёт, ждёт его
|
||||
`after_execute`, затем разрешает второй. Получены обе последовательности
|
||||
`A->B` и `B->A`; владельцем задания остаётся житель с меньшим стабильным ID.
|
||||
- Seed 97, два голодных жителя и одна ягода. Здесь общих заданий нет, поэтому
|
||||
отправки 0 и 1 — стадии продвижения жителей. Захват еды выполняется
|
||||
последовательно в `assign_meals` до этих стадий. Проверяются противоположные
|
||||
завершения продвижения, один владелец, сохранность ягоды и ровно одно потребление;
|
||||
параллельный арбитраж еды этим сценарием не заявляется.
|
||||
|
||||
Оба сценария проверены с `max_admitted=4096` и `1`. Контроллер находится вне
|
||||
координатора, который при переполнении сам может ждать в inline callable.
|
||||
Ожидания ограничены пятью секундами; scope guard всегда открывает ворота до
|
||||
ожидания координатора или разрушения пула. Каждая из 24 конфигураций сравнивает
|
||||
все 40 тактов с последовательным эталоном через настоящий `Current14` writer.
|
||||
Лог содержит фактическую последовательность завершений каждой конфигурации.
|
||||
|
||||
[RuntimeTests](../../../tests/runtime_tests.cpp) удерживает старую задачу во время
|
||||
постановки загрузки того же сохранения в очередь. Пока задача удержана, доступны
|
||||
старый неизменяемый снимок и захват сохранения, а установка и старая команда ещё
|
||||
не завершены. Перед захватом кандидата проверяется равенство числа начатых и
|
||||
вернувшихся задач. После установки меняется session, старая команда получает
|
||||
`StaleSession`; дополнительный барьер и следующий такт подтверждают неизменность
|
||||
старого снимка и соответствие нового мира эталону.
|
||||
|
||||
[Test-local диагностика](../../../tests/replay_diagnostics.hpp) сначала сравнивает
|
||||
канонические байты. Только при несовпадении она показывает первый различающийся
|
||||
публичный факт: ID жителя/задания/производства, поле, expected/actual; для запасов —
|
||||
владельца и тип предмета; для команд — игрока и следующую последовательность.
|
||||
Сравнение квитанций содержит игрока, номер команды, статус, tick и revision.
|
||||
Контекст включает первый обнаруженный tick/attempt, seed мира, число потоков,
|
||||
расписание, состояние загрузки и предел допуска. Непокрытое публичной проекцией
|
||||
поле получает смещение и значения байта. Это диагностическая проекция, а не
|
||||
второй кодек или альтернативный критерий равенства. Отдельно проверены равенство,
|
||||
ошибки запаса/задания/команды/квитанции, лишний ID и байтовый fallback.
|
||||
|
||||
Проверка 2 декабря 2026 года: Windows x64 Release кросс-сборка GCC 16.2.0,
|
||||
выполнение Wine 11.0. CTest `-V`: 3/3 цели, 141 core + 9 LAN + 10 viewer тестов.
|
||||
Отдельные теги: executor 10/10, replay 8/8, runtime 11/11. Логи:
|
||||
`/tmp/stoneheart-milestones.xprJ2SVp/s21-replay-{configure,build,ctest,executor,replay,runtime}.log`.
|
||||
Повторная окончательная сборка/CTest: `s21-replay-final-build.log`, `s21-replay-final-ctest.log` (3/3, 18,35 с).
|
||||
Два внешних probe собраны заново против этой библиотеки; при 1/2/6/12 потоках
|
||||
`cmp` подтвердил совпадение обоих исторических корпусов:
|
||||
|
||||
- `trajectory.cpp`: 361 такт, 5 приёмов пищи; SHA-256
|
||||
`d50ce3f5cd339e2c87c83cb599075813caf86c6384e5caaab776d57e4b727cc7`.
|
||||
- `identity-compat.cpp`: доставка и строительство после удаления других объектов;
|
||||
SHA-256 `05972620f0ce29b1f6a3ebdd0315eb2e9faebc6629dfe38d0e804b19d86b7b0f`.
|
||||
|
||||
Логи probe: `s21-replay-probe-build.log`, `s21-replay-golden.log` в том же каталоге.
|
||||
Физическая Windows, длительная нагрузка и производительность GPU здесь не проверялись.
|
||||
Serena/граф были связаны с основным checkout; для изолированного worktree использована
|
||||
прямая проверка исходников без переключения общего проекта и без заявления о покрытии графом.
|
||||
@@ -21,6 +21,9 @@ struct WorkerPoolOptions {
|
||||
std::function<void(std::size_t)> before_worker_start;
|
||||
std::function<void(std::size_t)> before_submit;
|
||||
std::function<void(std::size_t)> before_execute;
|
||||
// Success-only observation after invocation returns, before future readiness.
|
||||
// A throwing observer fails that future. Replacement contract: Void/Library#15.
|
||||
std::function<void(std::size_t)> after_execute;
|
||||
};
|
||||
|
||||
class WorkerPool {
|
||||
@@ -38,12 +41,22 @@ public:
|
||||
if (executor_->is_executor_thread()) {
|
||||
throw std::logic_error("cannot submit nested work to the same worker pool");
|
||||
}
|
||||
if (options_.before_submit || options_.before_execute) {
|
||||
if (options_.before_submit || options_.before_execute || options_.after_execute) {
|
||||
const auto index = submission_index_.fetch_add(1, std::memory_order_relaxed);
|
||||
if (options_.before_submit) options_.before_submit(index);
|
||||
return admit([this, index, function = std::forward<Function>(function)]() mutable -> decltype(auto) {
|
||||
return admit([this, index, function = std::forward<Function>(function)]() mutable
|
||||
-> std::invoke_result_t<Function> {
|
||||
if (options_.before_execute) options_.before_execute(index);
|
||||
return std::invoke(function);
|
||||
if (!options_.after_execute) return std::invoke(function);
|
||||
using Result = std::invoke_result_t<Function>;
|
||||
if constexpr (std::is_void_v<Result>) {
|
||||
std::invoke(function);
|
||||
options_.after_execute(index);
|
||||
} else {
|
||||
Result result = std::invoke(function);
|
||||
options_.after_execute(index);
|
||||
return result;
|
||||
}
|
||||
});
|
||||
}
|
||||
return admit(std::forward<Function>(function));
|
||||
|
||||
+102
-1
@@ -6,6 +6,9 @@
|
||||
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <array>
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
#include <future>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
@@ -82,6 +85,8 @@ void check_world_unwind(std::size_t phase, bool submit_failure) {
|
||||
}
|
||||
|
||||
struct [[= Void::Testing::name("ExecutorTests")]] ExecutorTests : Void::Testing::Suite<ExecutorTests> {
|
||||
[[= Void::Testing::tag("executor")]] Test test_completion_observer_results_and_failures();
|
||||
[[= Void::Testing::tag("executor")]] Test test_completion_observer_precedes_future_readiness();
|
||||
[[= Void::Testing::tag("executor")]] Test test_limits_and_nested_submission();
|
||||
[[= Void::Testing::tag("executor")]] Test test_capacity_retains_move_only_work_and_exceptions();
|
||||
[[= Void::Testing::tag("executor")]] Test test_failed_callable_transfer_releases_capacity();
|
||||
@@ -92,6 +97,102 @@ struct [[= Void::Testing::name("ExecutorTests")]] ExecutorTests : Void::Testing:
|
||||
[[= Void::Testing::tag("executor")]] Test test_world_capacity_one_matches_reference();
|
||||
};
|
||||
|
||||
// Exercise the same wrapper on a worker and on the submitting thread. Keeping
|
||||
// index zero admitted forces every other submission through inline overload.
|
||||
Test ExecutorTests::test_completion_observer_results_and_failures() {
|
||||
for (bool inline_work : {false, true}) {
|
||||
std::promise<void> release;
|
||||
auto permit = release.get_future().share();
|
||||
std::promise<void> entered;
|
||||
auto running = entered.get_future();
|
||||
std::array<std::atomic<int>, 8> observed{};
|
||||
std::array<std::atomic<bool>, 8> returned{};
|
||||
std::atomic<bool> observed_too_early{false};
|
||||
WorkerPoolOptions options{.max_admitted = inline_work ? 1U : 4096U};
|
||||
options.before_submit = [](std::size_t index) {
|
||||
if (index == 8) throw std::bad_alloc();
|
||||
};
|
||||
options.before_execute = [](std::size_t index) {
|
||||
if (index == 6) throw std::runtime_error("before invocation");
|
||||
};
|
||||
options.after_execute = [&](std::size_t index) {
|
||||
if (index >= observed.size()) throw std::logic_error("observer on failed submission");
|
||||
if (!returned[index].load()) observed_too_early.store(true);
|
||||
++observed[index];
|
||||
if (index == 7) throw std::runtime_error("after invocation");
|
||||
};
|
||||
WorkerPool pool(2, std::move(options));
|
||||
auto release_task = Void::Scope::on_exit([&] { release.set_value(); });
|
||||
auto held = pool.submit([&] {
|
||||
entered.set_value();
|
||||
if (permit.wait_for(5s) != std::future_status::ready) throw std::runtime_error("release timeout");
|
||||
returned[0] = true;
|
||||
});
|
||||
require(running.wait_for(5s) == std::future_status::ready);
|
||||
const auto caller = std::this_thread::get_id();
|
||||
auto value = pool.submit([&] {
|
||||
returned[1] = true;
|
||||
return std::pair{17, std::this_thread::get_id() == caller};
|
||||
});
|
||||
require(value.get() == std::pair{17, inline_work});
|
||||
int referent = 23;
|
||||
auto reference = pool.submit([&]() -> int& { returned[2] = true; return referent; });
|
||||
require(&reference.get() == &referent);
|
||||
auto nothing = pool.submit([&] { returned[3] = true; });
|
||||
nothing.get();
|
||||
auto owned = pool.submit([&, value = std::make_unique<int>(31)]() mutable {
|
||||
returned[4] = true;
|
||||
return std::move(value);
|
||||
});
|
||||
require(*owned.get() == 31);
|
||||
auto failure = pool.submit([]() -> int { throw std::runtime_error("invocation failed"); });
|
||||
expect_throw<std::runtime_error>([&] { static_cast<void>(failure.get()); });
|
||||
auto before = pool.submit([&] { returned[6] = true; });
|
||||
expect_throw<std::runtime_error>([&] { before.get(); });
|
||||
auto after = pool.submit([&] { returned[7] = true; });
|
||||
expect_throw<std::runtime_error>([&] { after.get(); });
|
||||
bool submitted_failure_ran = false;
|
||||
expect_throw<std::bad_alloc>([&] {
|
||||
static_cast<void>(pool.submit([&] { submitted_failure_ran = true; }));
|
||||
});
|
||||
require(!submitted_failure_ran);
|
||||
release_task.release();
|
||||
release.set_value();
|
||||
held.get();
|
||||
for (std::size_t i = 0; i < observed.size(); ++i) {
|
||||
require(observed[i] == ((i == 5 || i == 6) ? 0 : 1));
|
||||
}
|
||||
require(!returned[6] && !observed_too_early);
|
||||
}
|
||||
}
|
||||
|
||||
Test ExecutorTests::test_completion_observer_precedes_future_readiness() {
|
||||
std::promise<void> observed;
|
||||
auto entered = observed.get_future();
|
||||
std::promise<void> release;
|
||||
auto permit = release.get_future().share();
|
||||
std::atomic<int> calls{0};
|
||||
WorkerPoolOptions options;
|
||||
// Observer alone must enable monotonically increasing submission indices.
|
||||
options.after_execute = [&](std::size_t index) {
|
||||
if (index != static_cast<std::size_t>(calls.fetch_add(1))) throw std::runtime_error("bad index");
|
||||
if (index == 0) {
|
||||
observed.set_value();
|
||||
if (permit.wait_for(5s) != std::future_status::ready) throw std::runtime_error("release timeout");
|
||||
}
|
||||
};
|
||||
WorkerPool pool(2, std::move(options));
|
||||
auto release_task = Void::Scope::on_exit([&] { release.set_value(); });
|
||||
auto result = pool.submit([] { return 11; });
|
||||
require(entered.wait_for(5s) == std::future_status::ready);
|
||||
require(result.wait_for(0s) == std::future_status::timeout);
|
||||
release_task.release();
|
||||
release.set_value();
|
||||
require(result.get() == 11);
|
||||
pool.submit([] {}).get();
|
||||
require(calls == 2);
|
||||
}
|
||||
|
||||
Test ExecutorTests::test_limits_and_nested_submission() {
|
||||
expect_throw<std::invalid_argument>([] { WorkerPool pool(1); });
|
||||
expect_throw<std::invalid_argument>([] { WorkerPool pool(2, {.max_admitted = 0}); });
|
||||
@@ -118,7 +219,7 @@ Test ExecutorTests::test_capacity_retains_move_only_work_and_exceptions() {
|
||||
const auto coordinator = std::this_thread::get_id();
|
||||
std::atomic<int> executions{0};
|
||||
auto answer = pool.submit([value = std::make_unique<int>(17), coordinator, &executions] {
|
||||
require(std::this_thread::get_id() == coordinator);
|
||||
if (std::this_thread::get_id() != coordinator) throw std::runtime_error("expected inline work");
|
||||
++executions;
|
||||
return *value;
|
||||
});
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
#pragma once
|
||||
|
||||
#include "settlement/core/world.hpp"
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
|
||||
namespace replay_diagnostics {
|
||||
using namespace settlement;
|
||||
|
||||
struct Context {
|
||||
std::uint64_t attempt = 0;
|
||||
std::size_t workers = 1;
|
||||
std::string schedule = "uncontrolled";
|
||||
std::string load = "uninterrupted";
|
||||
std::size_t capacity = 4096;
|
||||
};
|
||||
|
||||
inline std::string canonical(const World& world) {
|
||||
std::ostringstream stream(std::ios::binary);
|
||||
world.write_save(stream, WorldSaveFormat::Current14);
|
||||
return stream.str();
|
||||
}
|
||||
|
||||
template<class T> std::string value(T item) {
|
||||
if constexpr (std::is_enum_v<T>) return std::to_string(static_cast<unsigned>(item));
|
||||
else return std::to_string(item);
|
||||
}
|
||||
inline std::string value(GridPosition p) { return "(" + value(p.x) + "," + value(p.y) + ")"; }
|
||||
inline std::string value(const std::vector<GridPosition>& route) {
|
||||
std::string text = "[";
|
||||
for (auto p : route) text += value(p) + ",";
|
||||
return text + "]";
|
||||
}
|
||||
|
||||
// Diagnostic projection of public domain objects, never a save parser or an
|
||||
// alternate equality oracle. Unknown/private fields retain the byte fallback.
|
||||
using Facts = std::map<std::string, std::string>;
|
||||
inline Facts facts(const World& world) {
|
||||
Facts out;
|
||||
const auto put = [&](const std::string& owner, const char* field, const auto& item) {
|
||||
out[owner + " field=" + field] = value(item);
|
||||
};
|
||||
for (const auto& a : world.agents()) {
|
||||
const auto key = "agent id=" + value(a.id);
|
||||
#define AGENT_FIELD(field) put(key, #field, a.field)
|
||||
AGENT_FIELD(position); AGENT_FIELD(state); AGENT_FIELD(current_job);
|
||||
AGENT_FIELD(route); AGENT_FIELD(route_cursor); AGENT_FIELD(work_remaining);
|
||||
AGENT_FIELD(resource_node_id); AGENT_FIELD(storage_id); AGENT_FIELD(haul_route);
|
||||
AGENT_FIELD(production_id); AGENT_FIELD(hunger); AGENT_FIELD(fatigue);
|
||||
AGENT_FIELD(resting_on_ground); AGENT_FIELD(profession);
|
||||
#undef AGENT_FIELD
|
||||
for (std::size_t item = 1; item <= item_type_count; ++item) {
|
||||
put("stock owner=agent:" + value(a.id) + " item=" + value(item), "count",
|
||||
a.inventory.item_count(static_cast<ItemType>(item)));
|
||||
}
|
||||
}
|
||||
for (const auto& j : world.jobs()) {
|
||||
const auto key = "job id=" + value(j.id);
|
||||
put(key, "position", j.position); put(key, "state", j.state);
|
||||
put(key, "work_required", j.work_required); put(key, "work_remaining", j.work_remaining);
|
||||
}
|
||||
for (const auto& p : world.production_orders()) {
|
||||
const auto key = "production id=" + value(p.id);
|
||||
put(key, "position", p.position); put(key, "recipe", p.recipe); put(key, "state", p.state);
|
||||
put(key, "collected_stops", p.collected_stops); put(key, "bed_owner", p.bed_owner);
|
||||
put(key, "bed_base", p.bed_base); put(key, "bed_stage", p.bed_stage);
|
||||
for (const auto& m : p.materials) {
|
||||
put(key + " material owner=storage:" + value(m.storage_id) + " item=" + value(m.type),
|
||||
"count", m.count);
|
||||
}
|
||||
for (std::size_t i = 0; i < p.delivery_stops.size(); ++i) {
|
||||
const auto stop = key + " stop=" + value(i);
|
||||
put(stop, "storage_id", p.delivery_stops[i].storage_id);
|
||||
put(stop, "route_to_next", p.delivery_stops[i].route_to_next);
|
||||
}
|
||||
}
|
||||
for (const auto& s : world.storages()) {
|
||||
const auto key = "storage id=" + value(s.id);
|
||||
put(key, "position", s.position); put(key, "capacity", s.capacity);
|
||||
put(key, "reserved_slots", s.reserved_slots); put(key, "kind", s.kind);
|
||||
for (const auto& stack : s.items) {
|
||||
const auto stock = "stock owner=storage:" + value(s.id) + " item=" + value(stack.type);
|
||||
put(stock, "count", stack.count); put(stock, "reserved", stack.reserved);
|
||||
}
|
||||
}
|
||||
for (std::uint8_t player = 1; player <= colony_player_slots; ++player) {
|
||||
put("command player=" + value(player), "next_sequence", world.next_command_sequence(player));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
inline std::string context(const World& world, const Context& c) {
|
||||
return "replay divergence tick=" + value(world.tick()) + " attempt=" + value(c.attempt) +
|
||||
" seed=" + value(world.seed()) + " workers=" + value(c.workers) + " schedule=" + c.schedule +
|
||||
" load=" + c.load + " capacity=" + value(c.capacity) + " ";
|
||||
}
|
||||
|
||||
inline std::string difference(const World& expected, const World& actual, const Context& c = {}) {
|
||||
const auto left = canonical(expected), right = canonical(actual);
|
||||
if (left == right) return {};
|
||||
const auto a = facts(expected), b = facts(actual);
|
||||
auto ai = a.begin(), bi = b.begin();
|
||||
while (ai != a.end() || bi != b.end()) {
|
||||
if (bi == b.end() || (ai != a.end() && ai->first < bi->first)) {
|
||||
return context(expected, c) + ai->first + " expected=" + ai->second + " actual=<absent>";
|
||||
}
|
||||
if (ai == a.end() || bi->first < ai->first) {
|
||||
return context(expected, c) + bi->first + " expected=<absent> actual=" + bi->second;
|
||||
}
|
||||
if (ai->second != bi->second) {
|
||||
return context(expected, c) + ai->first + " expected=" + ai->second + " actual=" + bi->second;
|
||||
}
|
||||
++ai; ++bi;
|
||||
}
|
||||
const auto mismatch = std::mismatch(left.begin(), left.end(), right.begin(), right.end());
|
||||
const auto offset = static_cast<std::size_t>(mismatch.first - left.begin());
|
||||
const auto byte = [offset](const std::string& bytes) {
|
||||
return offset < bytes.size() ? value(static_cast<unsigned char>(bytes[offset])) : "<end>";
|
||||
};
|
||||
return context(expected, c) + "byte=" + value(offset) + " expected=" + byte(left) + " actual=" + byte(right);
|
||||
}
|
||||
|
||||
inline std::string receipt_difference(const World& world, const PlayerCommand& command,
|
||||
CommandReceipt expected, CommandReceipt actual, const Context& c) {
|
||||
if (expected.status == actual.status && expected.tick == actual.tick && expected.revision == actual.revision) return {};
|
||||
const auto receipt = [](CommandReceipt r) {
|
||||
return "{status=" + value(r.status) + ",tick=" + value(r.tick) + ",revision=" + value(r.revision) + "}";
|
||||
};
|
||||
return context(world, c) + "command player=" + value(command.player) + " sequence=" + value(command.sequence) +
|
||||
" field=receipt expected=" + receipt(expected) + " actual=" + receipt(actual);
|
||||
}
|
||||
} // namespace replay_diagnostics
|
||||
+178
-16
@@ -1,10 +1,17 @@
|
||||
#include "settlement/core/world.hpp"
|
||||
#include "replay_diagnostics.hpp"
|
||||
#include <Void/Core/Scope.hpp>
|
||||
|
||||
#include <Void/Testing/Assert.hpp>
|
||||
#include <Void/Testing/Suite.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <chrono>
|
||||
#include <condition_variable>
|
||||
#include <future>
|
||||
#include <iostream>
|
||||
#include <mutex>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
@@ -66,6 +73,7 @@ public:
|
||||
}
|
||||
|
||||
void step() {
|
||||
++attempt_;
|
||||
reference->step();
|
||||
for (auto& run : runs_) run.world->step();
|
||||
compare();
|
||||
@@ -75,9 +83,10 @@ public:
|
||||
std::uint64_t expected_tick, std::uint64_t expected_revision) {
|
||||
const auto check = [&](World& world) {
|
||||
const auto result = world.apply_command(command);
|
||||
require(result.status == expected_status && result.tick == expected_tick &&
|
||||
result.revision == expected_revision,
|
||||
"command receipt differs from the recorded status, tick or revision");
|
||||
const auto diagnostic = replay_diagnostics::receipt_difference(world, command,
|
||||
{expected_status, expected_tick, expected_revision}, result,
|
||||
{attempt_, world.worker_count(), "journal", "command", options_.max_admitted});
|
||||
require(diagnostic.empty(), diagnostic);
|
||||
};
|
||||
check(*reference);
|
||||
for (auto& run : runs_) check(*run.world);
|
||||
@@ -102,28 +111,23 @@ private:
|
||||
};
|
||||
|
||||
void compare() const {
|
||||
const auto expected = saved_state(*reference);
|
||||
for (const auto& run : runs_) {
|
||||
const auto actual = saved_state(*run.world);
|
||||
if (actual == expected) continue;
|
||||
const auto mismatch = std::mismatch(expected.begin(), expected.end(), actual.begin(), actual.end());
|
||||
const auto offset = static_cast<std::size_t>(mismatch.first - expected.begin());
|
||||
throw std::runtime_error("replay diverged at tick " + std::to_string(reference->tick()) +
|
||||
", workers " + std::to_string(run.config.workers) +
|
||||
(run.reloaded ? ", reloaded" : ", uninterrupted") +
|
||||
", byte " + std::to_string(offset) +
|
||||
", path searches " + std::to_string(reference->path_searches()) + "/" +
|
||||
std::to_string(run.world->path_searches()) + ", path nodes " +
|
||||
std::to_string(reference->path_nodes_visited()) + "/" +
|
||||
std::to_string(run.world->path_nodes_visited()));
|
||||
const auto diagnostic = replay_diagnostics::difference(*reference, *run.world,
|
||||
{attempt_, run.config.workers, "uncontrolled", run.reloaded ? "reloaded" : "uninterrupted",
|
||||
options_.max_admitted});
|
||||
require(diagnostic.empty(), diagnostic);
|
||||
}
|
||||
}
|
||||
|
||||
std::uint64_t attempt_ = 0;
|
||||
|
||||
WorkerPoolOptions options_;
|
||||
std::vector<Run> runs_;
|
||||
};
|
||||
|
||||
struct [[= Void::Testing::name("ReplayTests")]] ReplayTests : Void::Testing::Suite<ReplayTests> {
|
||||
[[= Void::Testing::tag("replay")]] Test test_opposite_real_completion_orders();
|
||||
[[= Void::Testing::tag("replay")]] Test test_semantic_divergence_diagnostics();
|
||||
[[= Void::Testing::tag("replay")]] Test test_execution_configuration_and_empty_world();
|
||||
[[= Void::Testing::tag("replay")]] Test test_one_resident_completes_work();
|
||||
[[= Void::Testing::tag("replay")]] Test test_competing_jobs_retry_unreachable_routes();
|
||||
@@ -132,6 +136,164 @@ struct [[= Void::Testing::name("ReplayTests")]] ReplayTests : Void::Testing::Sui
|
||||
[[= Void::Testing::tag("replay")]] Test test_last_meal_has_one_winner_and_one_consumer();
|
||||
};
|
||||
|
||||
// The driver is the test thread, separate from World::step's coordinator:
|
||||
// capacity one can run submission 1 inline while submission 0 is held.
|
||||
struct CompletionGate {
|
||||
std::mutex mutex;
|
||||
std::condition_variable changed;
|
||||
std::array<bool, 2> entered{}, permitted{};
|
||||
std::vector<std::size_t> completed;
|
||||
bool released = false;
|
||||
|
||||
void before(std::size_t index) {
|
||||
if (index > 1) return;
|
||||
std::unique_lock lock(mutex);
|
||||
entered[index] = true;
|
||||
changed.notify_all();
|
||||
if (!changed.wait_for(lock, std::chrono::seconds(5), [&] { return released || permitted[index]; })) {
|
||||
throw std::runtime_error("completion gate release timeout");
|
||||
}
|
||||
}
|
||||
void after(std::size_t index) {
|
||||
if (index > 1) return;
|
||||
std::lock_guard lock(mutex);
|
||||
completed.push_back(index);
|
||||
changed.notify_all();
|
||||
}
|
||||
void drive(std::size_t first) {
|
||||
std::unique_lock lock(mutex);
|
||||
require(changed.wait_for(lock, std::chrono::seconds(5), [&] { return entered[0] && entered[1]; }),
|
||||
"both real calculations did not enter");
|
||||
require(completed.empty(), "a calculation completed before its gate was released");
|
||||
permitted[first] = true;
|
||||
changed.notify_all();
|
||||
require(changed.wait_for(lock, std::chrono::seconds(5), [&] { return !completed.empty(); }),
|
||||
"first real calculation did not return");
|
||||
require(completed == std::vector<std::size_t>{first}, "completion order was not forced");
|
||||
permitted[1 - first] = true;
|
||||
changed.notify_all();
|
||||
}
|
||||
void release() {
|
||||
std::lock_guard lock(mutex);
|
||||
released = true;
|
||||
changed.notify_all();
|
||||
}
|
||||
};
|
||||
|
||||
Test ReplayTests::test_opposite_real_completion_orders() {
|
||||
for (bool meal : {false, true}) {
|
||||
World initial(meal ? 97 : 101, 8, 8, 1, ExecutionMode::SerialReference);
|
||||
const auto winner = initial.spawn_agent({5, 1});
|
||||
static_cast<void>(initial.spawn_agent({5, 1}));
|
||||
JobId job = 0;
|
||||
if (meal) {
|
||||
const auto pantry = initial.add_storage({1, 1}, 1, StorageKind::Pantry);
|
||||
initial.enable_hunger();
|
||||
for (std::uint16_t tick = 0; tick < hunger_threshold; ++tick) initial.step();
|
||||
initial.stock_storage(pantry, ItemType::Berries, 1);
|
||||
} else {
|
||||
job = initial.add_job({1, 1}, 3);
|
||||
}
|
||||
const auto fixture = saved_state(initial);
|
||||
for (auto workers : {2U, 6U, 12U}) for (auto capacity : {4096U, 1U}) for (auto first : {0U, 1U}) {
|
||||
CompletionGate gate;
|
||||
WorkerPoolOptions options{.max_admitted = capacity};
|
||||
options.before_execute = [&](std::size_t index) { gate.before(index); };
|
||||
options.after_execute = [&](std::size_t index) { gate.after(index); };
|
||||
auto reference = load_state(fixture, execution_configs.front());
|
||||
auto candidate = load_state(fixture, {workers, ExecutionMode::Parallel}, std::move(options));
|
||||
auto step = std::async(std::launch::async, [&] { candidate->step(); });
|
||||
// Always release before joining the coordinator, including assertion failure.
|
||||
auto release = Void::Scope::on_exit([&] { gate.release(); });
|
||||
gate.drive(first);
|
||||
gate.release();
|
||||
require(step.wait_for(std::chrono::seconds(5)) == std::future_status::ready, "world step did not drain");
|
||||
step.get();
|
||||
require(gate.completed == std::vector<std::size_t>{first, 1 - first}, "wrong actual return trace");
|
||||
const std::string schedule = first == 0 ? "A->B" : "B->A";
|
||||
std::cout << "actual " << (meal ? "meal movement" : "job choices") << " workers=" << workers
|
||||
<< " capacity=" << capacity << " completions=" << schedule << '\n';
|
||||
for (std::uint64_t attempt = 1; attempt <= 40; ++attempt) {
|
||||
reference->step();
|
||||
const auto diagnostic = replay_diagnostics::difference(*reference, *candidate,
|
||||
{attempt, workers, schedule, "fixture", capacity});
|
||||
require(diagnostic.empty(), diagnostic);
|
||||
if (attempt == 1) {
|
||||
require(candidate->agents()[0].id == winner, "fixture IDs changed");
|
||||
if (meal) {
|
||||
require(candidate->agents()[0].state == AgentState::GoingToEat &&
|
||||
candidate->agents()[1].state == AgentState::Idle,
|
||||
"serial meal claim lost its stable winner");
|
||||
} else {
|
||||
require(candidate->agents()[0].current_job == job && candidate->agents()[1].current_job == 0,
|
||||
"competing real calculations changed the lower-ID winner");
|
||||
}
|
||||
}
|
||||
if (meal) {
|
||||
const auto& agents = candidate->agents();
|
||||
require(candidate->storages()[0].item_count(ItemType::Berries) +
|
||||
agents[0].inventory.item_count(ItemType::Berries) + agents[1].inventory.item_count(ItemType::Berries) +
|
||||
candidate->meals_eaten() == 1, "meal duplicated or lost");
|
||||
require(agents[1].inventory.empty() && agents[1].state != AgentState::GoingToEat &&
|
||||
agents[1].state != AgentState::Eating, "second resident consumed reserved meal");
|
||||
}
|
||||
if (attempt != 40) candidate->step();
|
||||
}
|
||||
require(meal ? candidate->meals_eaten() == 1 : candidate->jobs_completed() == 1,
|
||||
"the sole job or meal did not finish exactly once");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Test ReplayTests::test_semantic_divergence_diagnostics() {
|
||||
const replay_diagnostics::Context context{7, 6, "B->A", "checkpoint", 1};
|
||||
World expected(103, 8, 8, 1, ExecutionMode::SerialReference);
|
||||
const auto storage = expected.add_storage({1, 1}, 20);
|
||||
expected.stock_storage(storage, ItemType::Wood, 2);
|
||||
const auto job = expected.add_job({4, 4}, 2);
|
||||
const auto fixture = saved_state(expected);
|
||||
auto actual = load_state(fixture, execution_configs.front());
|
||||
require(replay_diagnostics::difference(expected, *actual, context).empty(), "equal worlds reported divergence");
|
||||
actual->stock_storage(storage, ItemType::Wood, 1);
|
||||
auto report = replay_diagnostics::difference(expected, *actual, context);
|
||||
require(report.find("stock owner=storage:" + std::to_string(storage)) != std::string::npos &&
|
||||
report.find("item=1 field=count expected=2 actual=3") != std::string::npos &&
|
||||
report.find("attempt=7 seed=103 workers=6 schedule=B->A load=checkpoint capacity=1") != std::string::npos,
|
||||
"stock diagnostic omitted context or identity: " + report);
|
||||
actual = load_state(fixture, execution_configs.front());
|
||||
// These are deliberate diagnostic inputs built by public domain operations.
|
||||
World changed_job(103, 8, 8, 1, ExecutionMode::SerialReference);
|
||||
const auto matching = changed_job.add_storage({1, 1}, 20);
|
||||
changed_job.stock_storage(matching, ItemType::Wood, 2);
|
||||
static_cast<void>(changed_job.add_job({4, 4}, 3));
|
||||
report = replay_diagnostics::difference(expected, changed_job, context);
|
||||
require(report.find("job id=" + std::to_string(job)) != std::string::npos &&
|
||||
report.find("field=work_remaining expected=2 actual=3") != std::string::npos,
|
||||
"job diagnostic omitted identity: " + report);
|
||||
auto command_world = make_first_colony(2);
|
||||
auto command_copy = load_state(saved_state(*command_world), execution_configs.front());
|
||||
const PlayerCommand command{1, 1, CommandKind::SetPaused, {}, 1};
|
||||
const auto receipt = command_copy->apply_command(command);
|
||||
report = replay_diagnostics::difference(*command_world, *command_copy, context);
|
||||
require(report.find("command player=1 field=next_sequence expected=1 actual=2") != std::string::npos,
|
||||
"command diagnostic omitted player and sequence: " + report);
|
||||
report = replay_diagnostics::receipt_difference(*command_copy, command,
|
||||
{CommandStatus::Accepted, 0, 0}, receipt, context);
|
||||
require(report.find("command player=1 sequence=1 field=receipt") != std::string::npos &&
|
||||
report.find("revision=0") != std::string::npos && report.find("revision=1") != std::string::npos,
|
||||
"receipt diagnostic omitted revision: " + report);
|
||||
require(replay_diagnostics::receipt_difference(*command_copy, command, receipt, receipt, context).empty(),
|
||||
"equal receipts reported divergence");
|
||||
// An absent entity and a private field exercise identity and byte fallbacks.
|
||||
static_cast<void>(actual->add_job({6, 6}, 1));
|
||||
require(replay_diagnostics::difference(expected, *actual).find("job id=2") != std::string::npos,
|
||||
"extra entity lost stable identity");
|
||||
actual = load_state(fixture, execution_configs.front());
|
||||
actual->set_blocked({7, 7});
|
||||
require(replay_diagnostics::difference(expected, *actual).find("byte=") != std::string::npos,
|
||||
"unprojected canonical field lost byte fallback");
|
||||
}
|
||||
|
||||
Test ReplayTests::test_execution_configuration_and_empty_world() {
|
||||
World initial(20261202, 5, 5);
|
||||
const auto bytes = saved_state(initial);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "settlement/core/simulation_runtime.hpp"
|
||||
#include "replay_diagnostics.hpp"
|
||||
#include <Void/Core/Scope.hpp>
|
||||
#include <Void/Testing/Assert.hpp>
|
||||
#include <Void/Testing/Suite.hpp>
|
||||
@@ -98,6 +99,7 @@ void command_observer(CommandMutationPhase phase) {
|
||||
}
|
||||
|
||||
struct [[= Void::Testing::name("RuntimeTests")]] RuntimeTests : Void::Testing::Suite<RuntimeTests> {
|
||||
[[= Void::Testing::tag("runtime")]] Test test_queued_same_save_install_drains_old_world();
|
||||
[[= Void::Testing::tag("runtime")]] Test test_fixed_clock_matches_reference_and_suspend_discards_idle_time();
|
||||
[[= Void::Testing::tag("runtime")]] Test test_paused_commands_publish_and_two_clients_replay_exact_results();
|
||||
[[= Void::Testing::tag("runtime")]] Test test_readers_and_save_capture_progress_during_real_worker_tick();
|
||||
@@ -110,6 +112,69 @@ struct [[= Void::Testing::name("RuntimeTests")]] RuntimeTests : Void::Testing::S
|
||||
[[= Void::Testing::tag("runtime")]] Test test_exhausted_clock_faults_without_spinning();
|
||||
};
|
||||
|
||||
Test RuntimeTests::test_queued_same_save_install_drains_old_world() {
|
||||
auto gate = std::make_shared<Gate>();
|
||||
auto clock = std::make_shared<Void::Time::ManualClock>();
|
||||
std::atomic<std::size_t> started{0}, completed{0};
|
||||
std::atomic<bool> install_saw_drained{false};
|
||||
WorkerPoolOptions workers;
|
||||
workers.before_execute = [&](std::size_t index) {
|
||||
++started;
|
||||
if (index == 0) gate->block();
|
||||
};
|
||||
workers.after_execute = [&](std::size_t) { ++completed; };
|
||||
RuntimeOptions options{.clock = clock};
|
||||
options.observer = [&](RuntimePhase phase) {
|
||||
if (phase == RuntimePhase::BeforeInstallCapture) {
|
||||
install_saw_drained = started.load() >= 2 && started.load() == completed.load();
|
||||
}
|
||||
};
|
||||
auto replacement = colony();
|
||||
const auto replacement_bytes = replay_diagnostics::canonical(*replacement.world);
|
||||
SimulationRuntime runtime(colony(2, std::move(workers)), std::move(options));
|
||||
auto release = Void::Scope::on_exit([&] { gate->release(); });
|
||||
const auto old_view = runtime.latest();
|
||||
const auto old_bytes = replay_diagnostics::canonical(*old_view->world);
|
||||
const auto stale_command = envelope(*old_view, 1, CommandKind::SetPaused, 1);
|
||||
require(clock->advance(50ms).has_value());
|
||||
runtime.notify_clock();
|
||||
gate->wait();
|
||||
const auto ticket = runtime.begin_load();
|
||||
require(ticket.has_value());
|
||||
auto installing = admitted([&] { return runtime.try_install(*ticket, replacement); });
|
||||
require(installing.admission == RuntimeAdmission::Accepted && !replacement.world);
|
||||
auto stale = admitted([&] { return runtime.try_submit(host, stale_command); });
|
||||
require(stale.admission == RuntimeAdmission::Accepted);
|
||||
require(installing.completion.wait_for(0s) == std::future_status::timeout);
|
||||
require(stale.completion.wait_for(0s) == std::future_status::timeout);
|
||||
require(!install_saw_drained && started.load() > completed.load());
|
||||
require(runtime.latest() == old_view);
|
||||
require(runtime.snapshot_for_save().value() == old_view);
|
||||
require(replay_diagnostics::canonical(*old_view->world) == old_bytes);
|
||||
gate->release();
|
||||
const auto installed = finished(std::move(installing));
|
||||
require(installed.outcome == RuntimeOutcome::Completed && install_saw_drained);
|
||||
require(installed.snapshot->identity.world == old_view->identity.world);
|
||||
require(installed.snapshot->identity.session != old_view->identity.session);
|
||||
require(installed.snapshot->world->tick() == 0);
|
||||
const auto rejected = finished(std::move(stale));
|
||||
require(rejected.receipt && rejected.receipt->status == DispatchStatus::StaleSession);
|
||||
const auto drained_count = completed.load();
|
||||
require(fence(runtime).outcome == RuntimeOutcome::Completed);
|
||||
require(runtime.latest() == installed.snapshot);
|
||||
require(replay_diagnostics::canonical(*runtime.latest()->world) == replacement_bytes);
|
||||
require(replay_diagnostics::canonical(*old_view->world) == old_bytes);
|
||||
require(completed.load() == drained_count && started.load() == completed.load());
|
||||
auto serial = colony(1);
|
||||
serial.world->step();
|
||||
require(clock->advance(50ms).has_value());
|
||||
require(fence(runtime).outcome == RuntimeOutcome::Completed);
|
||||
const auto diagnostic = replay_diagnostics::difference(*serial.world, *runtime.latest()->world,
|
||||
{1, 2, "old-worker-held", "same-save-replacement", 4096});
|
||||
if (!diagnostic.empty()) throw std::runtime_error(diagnostic);
|
||||
require(completed.load() == drained_count);
|
||||
}
|
||||
|
||||
Test RuntimeTests::test_fixed_clock_matches_reference_and_suspend_discards_idle_time() {
|
||||
for (const auto workers : {1U, 2U, 6U, 12U}) {
|
||||
auto clock = std::make_shared<Void::Time::ManualClock>();
|
||||
|
||||
Reference in new issue
Block a user