Sonde v1.1.0
Embeddable Model Context Protocol server for Qt applications
Loading...
Searching...
No Matches
anonymous_namespace{main.cpp}::Run Class Reference

One run: a world, a server, clients, and the steps. More...

Public Member Functions

 Run (quint64 seed, int steps)
 Prepares a run of steps steps from seed.
bool exec ()
 Runs it; returns whether every invariant held.

Private Member Functions

void connectClient ()
 Connects a new client: on the local socket or over HTTP (the first, local).
void retire (Client *client)
 Takes client's counts, and remembers its HTTP session unless the server confirmed its end: dropped without DELETE, or with a DELETE not yet answered.
HttpClient * someHttpClient ()
 An HTTP client that is connected, or nullptr.
void endAbandonedSessions ()
 Ends the HTTP sessions clients abandoned without DELETE, as their expiry would.
Client * someClient ()
 A connected client (connecting one if none is).
void drive ()
 One client action (the driver).
void harvest ()
 Collects object ids and window titles from results, for later arguments.
void finish ()
 The end of the run: everything answered, nothing left behind (invariants 4, 5).
bool report ()
 Prints the outcome; on a failure, the seed and the log. Returns success.

Static Private Member Functions

static void remember (QStringList *list, const QString &value)
 Adds value to list, keeping the last 200.
static void spin (int ms)
 Runs the event loop for ms milliseconds.
static bool settle (const std::function< bool()> &done, int timeoutMs)
 Runs the event loop until done holds, or timeoutMs passes.

Private Attributes

quint64 m_seed
 This run's seed.
int m_steps
 How many steps.
int m_step = 0
 The current step.
Random m_random
 Every choice.
QStringList m_ids
 Object ids seen.
QStringList m_windows
 Window ids and titles seen.
Arguments m_args
 Tool arguments.
QElapsedTimer m_clock
 Since the start.
Verdict m_verdict
 The first violation.
Log m_log
 The last operations.
std::unique_ptr< Sonde::Server > m_server
 The server under test.
std::unique_ptr< World > m_world
 The application.
std::vector< std::unique_ptr< Client > > m_clients
 Connected clients.
QJsonArray m_tools
 The server's tools.
QString m_name
 The local socket name.
int m_calls = 0
 Tool calls sent.
int m_cancels = 0
 Cancellations sent.
int m_disconnects = 0
 Clients dropped with calls possibly in flight.
int m_mutations = 0
 Changes made to the application.
int m_streams = 0
 SSE streams opened or closed.
int m_httpCalls = 0
 Of the calls, the ones over HTTP.
QList< QByteArray > m_abandoned
 HTTP sessions dropped without DELETE.
int m_results = 0
 Results from clients already gone.
int m_toolErrors = 0
 Tool errors from clients already gone.

Detailed Description

One run: a world, a server, clients, and the steps.


The documentation for this class was generated from the following file:
  • tests/chaos/main.cpp