Remove Q_ASSERT's from qsharedpointer autotest
authorJason McDonald <jason.mcdonald@nokia.com>
Tue, 3 May 2011 02:56:16 +0000 (12:56 +1000)
committerRohan McGovern <rohan.mcgovern@nokia.com>
Wed, 18 May 2011 00:46:43 +0000 (10:46 +1000)
Report a meaningful warning message into the test output rather than
aborting in debug mode and doing nothing in release mode.

Change-Id: I6883fccbce0139c763f36f6839bb3452d8f69c1c
Task-number: QTBUG-17582
Reviewed-by: Rohan McGovern
(cherry picked from commit 5b86c4abc676b36d60e6625e89535e7f4907d2b3)

tests/auto/qsharedpointer/externaltests.cpp

index 1ba03dc..b0490c9 100644 (file)
@@ -50,6 +50,7 @@
 #include <QtCore/QDir>
 #include <QtCore/QDirIterator>
 #include <QtCore/QDateTime>
+#include <QtCore/QDebug>
 
 #ifdef Q_OS_SYMBIAN
 #define DEFAULT_MAKESPEC "X:/STLsupport/mkspecs/symbian-abld/"
@@ -342,7 +343,8 @@ namespace QTest {
 
     void QExternalTestPrivate::removeTemporaryDirectory()
     {
-        Q_ASSERT(!temporaryDir.isEmpty());
+        if (temporaryDir.isEmpty())
+            qWarning() << "Temporary directory is expected to be non-empty";
         removeRecursive(temporaryDir);
         temporaryDir.clear();
     }
@@ -487,7 +489,8 @@ namespace QTest {
 
     bool QExternalTestPrivate::createProjectFile()
     {
-        Q_ASSERT(!temporaryDir.isEmpty());
+        if (temporaryDir.isEmpty())
+            qWarning() << "Temporary directory is expected to be non-empty";
 
         QFile projectFile(temporaryDir + QLatin1String("/project.pro"));
         if (!projectFile.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) {
@@ -599,7 +602,9 @@ namespace QTest {
 
     bool QExternalTestPrivate::runQmake()
     {
-        Q_ASSERT(!temporaryDir.isEmpty());
+        if (temporaryDir.isEmpty())
+            qWarning() << "Temporary directory is expected to be non-empty";
+
         if (!createProjectFile())
             return false;
 
@@ -633,7 +638,8 @@ namespace QTest {
 
     bool QExternalTestPrivate::runMake(Target target)
     {
-        Q_ASSERT(!temporaryDir.isEmpty());
+        if (temporaryDir.isEmpty())
+            qWarning() << "Temporary directory is expected to be non-empty";
 
         QExternalProcess make;
         make.setWorkingDirectory(temporaryDir);