diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2021-10-05 03:52:19 +0200 |
---|---|---|
committer | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2021-10-06 19:17:49 +0200 |
commit | 06ecefe0645cc60ab213e5b41c9689fa6e020745 (patch) | |
tree | 9c28f7ee1051e4ae4bf54d46c8b4cfd9ba555f71 /tests | |
parent | 88cbbe5eb2e024d71e0897617ab65860cee51607 (diff) | |
download | libquotient-06ecefe0645cc60ab213e5b41c9689fa6e020745.tar.gz libquotient-06ecefe0645cc60ab213e5b41c9689fa6e020745.zip |
Quotest: return non-zero when things go really wrong
...such as stuck login or failure to join the room. Closes #496.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/quotest.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/tests/quotest.cpp b/tests/quotest.cpp index e6cca1c6..8930816e 100644 --- a/tests/quotest.cpp +++ b/tests/quotest.cpp @@ -239,7 +239,7 @@ void TestManager::setupAndRun() clog << "Sync " << ++i << " complete" << endl; if (auto* r = testSuite->room()) { clog << "Test room timeline size = " << r->timelineSize(); - if (r->pendingEvents().empty()) + if (!r->pendingEvents().empty()) clog << ", pending size = " << r->pendingEvents().size(); clog << endl; } @@ -894,10 +894,22 @@ void TestManager::conclude() void TestManager::finalize() { + if (!c->isUsable() || !c->isLoggedIn()) { + clog << "No usable connection reached" << endl; + QCoreApplication::exit(-2); + return; // NB: QCoreApplication::exit() does return to the caller + } clog << "Logging out" << endl; c->logout(); - connect(c, &Connection::loggedOut, this, - [this] { QCoreApplication::exit(failed.size() + running.size()); }, + connect( + c, &Connection::loggedOut, this, + [this] { + QCoreApplication::exit(!testSuite ? -3 + : succeeded.empty() && failed.empty() + && running.empty() + ? -4 + : failed.size() + running.size()); + }, Qt::QueuedConnection); } |