aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-10-05 03:52:19 +0200
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-10-05 04:15:09 +0200
commit7b516cdf0b987e542b1e4cd4556ecb2bfbde3ff9 (patch)
tree7f70af298c338d21847aa8eead26804d3a4606fd
parent107471447a62663eaf97b4b982d8c3f3e1b3364e (diff)
downloadlibquotient-7b516cdf0b987e542b1e4cd4556ecb2bfbde3ff9.tar.gz
libquotient-7b516cdf0b987e542b1e4cd4556ecb2bfbde3ff9.zip
Quotest: return non-zero when things go really wrong
...such as stuck login or failure to join the room. Closes #496.
-rw-r--r--quotest/quotest.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/quotest/quotest.cpp b/quotest/quotest.cpp
index 44d82adf..d006c7fb 100644
--- a/quotest/quotest.cpp
+++ b/quotest/quotest.cpp
@@ -245,7 +245,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;
}
@@ -939,10 +939,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);
}