From 86b8daf2a0348be875cbd0b330ab7773f55a35dc Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 15 Jun 2009 13:54:44 +0200 Subject: make qscript unit tests not crash when test files are not found --- tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'tests/auto/qscriptjstestsuite') diff --git a/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp b/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp index fbb0ba5960..4807b3fe42 100644 --- a/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp +++ b/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp @@ -390,9 +390,9 @@ int tst_Suite::qt_metacall(QMetaObject::Call _c, int _id, void **_a) tst_Suite::tst_Suite() { testsDir = QDir("."); - if (!testsDir.cd("tests")) { + bool testsFound = testsDir.cd("tests"); + if (!testsFound) { qWarning("*** no tests/ dir!"); - return; } QString willFixInNextReleaseMessage = QString::fromLatin1("Will fix in next release"); @@ -802,7 +802,9 @@ tst_Suite::tst_Suite() // don't execute any tests on slow machines #if !defined(Q_OS_IRIX) // do all the test suites - QFileInfoList testSuiteDirInfos = testsDir.entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot); + QFileInfoList testSuiteDirInfos; + if (testsFound) + testSuiteDirInfos = testsDir.entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot); foreach (QFileInfo tsdi, testSuiteDirInfos) { QDir testSuiteDir(tsdi.absoluteFilePath()); // do all the dirs in the test suite -- cgit v1.2.1