diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-04-14 04:30:36 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-04-14 04:33:51 (GMT) |
commit | b0960cace004220eb79edc61eefa83e8f1ec12da (patch) | |
tree | 8eac10fe1e02449b0d6ecf84d480e1c360172481 /tests/auto/declarative/examples | |
parent | c6ce84640b7bebab4d6dc571ab549a085703ed16 (diff) | |
download | Qt-b0960cace004220eb79edc61eefa83e8f1ec12da.zip Qt-b0960cace004220eb79edc61eefa83e8f1ec12da.tar.gz Qt-b0960cace004220eb79edc61eefa83e8f1ec12da.tar.bz2 |
Further improve failure output
Now prints all the failures, not just the first.
Diffstat (limited to 'tests/auto/declarative/examples')
-rw-r--r-- | tests/auto/declarative/examples/tst_examples.cpp | 64 |
1 files changed, 7 insertions, 57 deletions
diff --git a/tests/auto/declarative/examples/tst_examples.cpp b/tests/auto/declarative/examples/tst_examples.cpp index ee8111e..91d2459 100644 --- a/tests/auto/declarative/examples/tst_examples.cpp +++ b/tests/auto/declarative/examples/tst_examples.cpp @@ -43,13 +43,8 @@ #include <QDir> #include <QProcess> #include <QDebug> - -#define CONCURRENT - -#ifdef CONCURRENT #include <QFutureSynchronizer> #include <QtConcurrentRun> -#endif class tst_examples : public QObject { @@ -58,9 +53,6 @@ public: tst_examples(); private slots: -#ifndef CONCURRENT - void examples_data(); -#endif void examples(); void namingConvention(); @@ -187,30 +179,6 @@ that they start and exit cleanly. Examples are any .qml files under the examples/ or demos/ directory that start with a lower case letter. */ -#ifndef CONCURRENT -void tst_examples::examples_data() -{ - QTest::addColumn<QString>("file"); - - QString examples = QLatin1String(SRCDIR) + "/../../../../demos/declarative/"; - QString demos = QLatin1String(SRCDIR) + "/../../../../examples/declarative/"; - QString snippets = QLatin1String(SRCDIR) + "/../../../../doc/src/snippets/"; - - qWarning() << examples << demos << snippets; - - QStringList files; - files << findQmlFiles(QDir(examples)); - files << findQmlFiles(QDir(demos)); - files << findQmlFiles(QDir(snippets)); - - qWarning() << files; - - foreach (const QString &file, files) - QTest::newRow(file.toLatin1().constData()) << file; -} -#endif - -#ifdef CONCURRENT #define THREADS 5 struct Example { @@ -259,10 +227,8 @@ void Example::run() } } -#endif void tst_examples::examples() { -#ifdef CONCURRENT QThreadPool::globalInstance()->setMaxThreadCount(5); QString examples = QLatin1String(SRCDIR) + "/../../../../demos/declarative/"; @@ -293,35 +259,19 @@ void tst_examples::examples() sync.waitForFinished(); + QStringList failures; for (int ii = 0; ii < tests.count(); ++ii) { if (tests.at(ii).result != Example::Pass) - QFAIL(qPrintable(tests.at(ii).file)); + failures << QDir::cleanPath(tests.at(ii).file); } -#else - - QFETCH(QString, file); + if (failures.count()) { + QString error("Failed examples: "); + error += failures.join(", "); - QFileInfo fi(file); - QFileInfo dir(fi.path()); - QString script = SRCDIR "/data/"+dir.baseName()+"/"+fi.baseName(); - QFileInfo testdata(script+".qml"); - QStringList arguments; - arguments << "-script" << (testdata.exists() ? script : QLatin1String(SRCDIR "/data/dummytest")) - << "-scriptopts" << "play,testerror,exitoncomplete,exitonfailure" - << file; -#ifdef Q_WS_QWS - arguments << "-qws"; -#endif + QFAIL(qPrintable(error)); + } - QProcess p; - p.start(qmlruntime, arguments); - QVERIFY(p.waitForFinished()); - if (p.exitStatus() != QProcess::NormalExit || p.exitCode() != 0) - qWarning() << p.readAllStandardOutput() << p.readAllStandardError(); - QCOMPARE(p.exitStatus(), QProcess::NormalExit); - QCOMPARE(p.exitCode(), 0); -#endif } QTEST_MAIN(tst_examples) |