m_exit = code;
}
void CanDie() { m_allowDie = true; }
+ void ShouldFinishInSec(int sec) { m_finishTimeoutSec = sec; }
// I can't do much about SWIG...
void CanLeak() { m_allowLeak = true; }
bool m_allowDie = false;
bool m_allowLeak = false;
QProcess m_proc;
+ int m_finishTimeoutSec = 30;
};
// Can't use QEventLoop without existing QCoreApplication
}
Socket ZNCTest::ConnectIRCd() {
- [this] {
- ASSERT_TRUE(m_server.waitForNewConnection(30000 /* msec */));
- }();
+ [this] { ASSERT_TRUE(m_server.waitForNewConnection(30000 /* msec */)); }();
return WrapIO(m_server.nextPendingConnection());
}
std::unique_ptr<Process> ZNCTest::Run() {
return std::unique_ptr<Process>(new Process(
- ZNC_BIN_DIR "/znc", QStringList() << "--debug"
- << "--datadir" << m_dir.path(),
+ ZNC_BIN_DIR "/znc",
+ QStringList() << "--debug"
+ << "--datadir" << m_dir.path(),
[](QProcess* proc) {
proc->setProcessChannelMode(QProcess::ForwardedChannels);
}));
QTextStream out(&file);
out << content;
file.close();
- Process p(
- ZNC_BIN_DIR "/znc-buildmod", QStringList() << file.fileName(),
- [&](QProcess* proc) {
- proc->setWorkingDirectory(dir.absolutePath());
- proc->setProcessChannelMode(QProcess::ForwardedChannels);
- });
+ Process p(ZNC_BIN_DIR "/znc-buildmod", QStringList() << file.fileName(),
+ [&](QProcess* proc) {
+ proc->setWorkingDirectory(dir.absolutePath());
+ proc->setProcessChannelMode(QProcess::ForwardedChannels);
+ });
p.ShouldFinishItself();
+ p.ShouldFinishInSec(300);
} else if (name.endsWith(".py")) {
// Dedent
QStringList lines = content.split("\n");
for (const QString& line : lines) {
int nonspace = line.indexOf(QRegExp("\\S"));
if (nonspace == -1) continue;
- if (nonspace < maxoffset || maxoffset == -1)
- maxoffset = nonspace;
+ if (nonspace < maxoffset || maxoffset == -1) maxoffset = nonspace;
}
if (maxoffset == -1) maxoffset = 0;
QFile file(dir.filePath(name));
}
}
-
} // namespace znc_inttest
proc->setProcessChannelMode(QProcess::ForwardedChannels);
});
p.ShouldFinishItself(1);
+ p.ShouldFinishInSec(300);
}
{
Process p(ZNC_BIN_DIR "/znc-buildmod",
proc->setProcessChannelMode(QProcess::ForwardedChannels);
});
p.ShouldFinishItself();
+ p.ShouldFinishInSec(300);
}
client.Write("znc loadmod testmod");
client.Write("PRIVMSG *testmod :hi");