void ParserTests::testParserStop() { ThreadedParser parser; Valgrind::Memcheck::MemcheckRunner runner; runner.setValgrindExecutable(fakeValgrindExecutable()); runner.setParser(&parser); runner.setValgrindArguments(QStringList() << QLatin1String("-i") << dataFile(QLatin1String("memcheck-output-sample1.xml")) << "--wait" << "5"); runner.setProcessChannelMode(QProcess::ForwardedChannels); runner.start(); QTest::qWait(500); runner.stop(); }
void ParserTests::testValgrindStartError() { QFETCH(QString, valgrindExe); QFETCH(QStringList, valgrindArgs); QFETCH(QString, debuggee); QFETCH(QString, debuggeeArgs); ThreadedParser parser; Valgrind::Memcheck::MemcheckRunner runner; runner.setParser(&parser); runner.setValgrindExecutable(valgrindExe); runner.setValgrindArguments(valgrindArgs); runner.setDebuggeeExecutable(debuggee); runner.setDebuggeeArguments(debuggeeArgs); RunnerDumper dumper(&runner, &parser); runner.start(); runner.waitForFinished(); QVERIFY(dumper.m_errorReceived); // just finish without deadlock and we are fine }
void ParserTests::testRealValgrind() { QString executable = QProcessEnvironment::systemEnvironment().value("VALGRIND_TEST_BIN", fakeValgrindExecutable()); qDebug() << "running exe:" << executable << " HINT: set VALGRIND_TEST_BIN to change this"; ThreadedParser parser; Valgrind::Memcheck::MemcheckRunner runner; runner.setValgrindExecutable(QLatin1String("valgrind")); runner.setDebuggeeExecutable(executable); runner.setParser(&parser); RunnerDumper dumper(&runner, &parser); runner.start(); runner.waitForFinished(); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); qRegisterMetaType<Valgrind::XmlProtocol::Error>(); ThreadedParser parser; Valgrind::Memcheck::MemcheckRunner runner; runner.setValgrindExecutable(fakeValgrindExecutable()); runner.setValgrindArguments(QStringList() << QLatin1String("-i") << dataFile(QLatin1String("memcheck-output-sample1.xml")) ); runner.setParser(&parser); ModelDemo demo(&runner); runner.connect(&runner, SIGNAL(finished()), &demo, SLOT(finished())); ErrorListModel model; parser.connect(&parser, SIGNAL(error(Valgrind::XmlProtocol::Error)), &model, SLOT(addError(Valgrind::XmlProtocol::Error)), Qt::QueuedConnection); QTreeView errorview; errorview.setSelectionMode(QAbstractItemView::SingleSelection); errorview.setSelectionBehavior(QAbstractItemView::SelectRows); errorview.setModel(&model); errorview.show(); StackModel stackModel; demo.stackModel = &stackModel; QTreeView stackView; stackView.setModel(&stackModel); stackView.show(); errorview.connect(errorview.selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), &demo, SLOT(selectionChanged(QItemSelection,QItemSelection))); runner.start(); return app.exec(); }