summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorHonglei Zhang <honglei.zhang@nokia.com>2011-12-02 15:48:29 +0200
committerQt by Nokia <qt-info@nokia.com>2011-12-02 17:35:11 +0100
commit4d696d53b074dafc1ecfc1d9cb6fd041464e1a75 (patch)
tree9f3493a18af0d21e480918bafee54f23a856cf91 /tests/auto
parentad8edac53c65368f7ff269332bd66bd85e2633b4 (diff)
Fix tst_qsql crashes on Mac OS X
In tst_qsql, there are function calls to QApplication(argc, 0, false), where argc is zero. According to the documentation, argc must be greater than zero and argv must contain at least one valid character string. The misuse of this API has no problem on any platform other than Mac OS. This commit has fixed the crash by passing valid dummy parameters. Task-number: QTBUG-22811 Change-Id: I42b26d66f0becb7a942896e6ddcaea52ff720a48 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/sql/kernel/kernel.pro2
-rw-r--r--tests/auto/sql/kernel/qsql/tst_qsql.cpp26
2 files changed, 15 insertions, 13 deletions
diff --git a/tests/auto/sql/kernel/kernel.pro b/tests/auto/sql/kernel/kernel.pro
index 0b79a14033..74e98c0dde 100644
--- a/tests/auto/sql/kernel/kernel.pro
+++ b/tests/auto/sql/kernel/kernel.pro
@@ -8,5 +8,3 @@ SUBDIRS=\
qsqlrecord \
qsqlthread \
qsql \
-
-mac: qsql.CONFIG = no_check_target # QTBUG-22811
diff --git a/tests/auto/sql/kernel/qsql/tst_qsql.cpp b/tests/auto/sql/kernel/qsql/tst_qsql.cpp
index 2cbf30ba74..e9c11e5966 100644
--- a/tests/auto/sql/kernel/qsql/tst_qsql.cpp
+++ b/tests/auto/sql/kernel/qsql/tst_qsql.cpp
@@ -116,8 +116,9 @@ void tst_QSql::cleanup()
// of a field "id"(integer) and "name"(char/varchar).
void tst_QSql::basicDriverTest()
{
- int argc = 0;
- QGuiApplication app( argc, 0, false );
+ int argc = 1;
+ const char *argv[] = {"test"};
+ QGuiApplication app(argc, const_cast<char **>(argv), false);
tst_Databases dbs;
dbs.open();
@@ -157,11 +158,11 @@ void tst_QSql::basicDriverTest()
void tst_QSql::open()
{
int i;
- int argc = 0;
+ int argc = 1;
+ const char *argv[] = {"test"};
int count = -1;
for ( i = 0; i < 10; ++i ) {
-
- QApplication app( argc, 0, false );
+ QApplication app(argc, const_cast<char **>(argv), false);
tst_Databases dbs;
dbs.open();
@@ -186,8 +187,9 @@ void tst_QSql::openInvalid()
void tst_QSql::concurrentAccess()
{
- int argc = 0;
- QGuiApplication app( argc, 0, false );
+ int argc = 1;
+ const char *argv[] = {"test"};
+ QGuiApplication app(argc, const_cast<char **>(argv), false);
tst_Databases dbs;
dbs.open();
@@ -214,8 +216,9 @@ void tst_QSql::concurrentAccess()
void tst_QSql::openErrorRecovery()
{
- int argc = 0;
- QGuiApplication app( argc, 0, false );
+ int argc = 1;
+ const char *argv[] = {"test"};
+ QGuiApplication app(argc, const_cast<char **>(argv), false);
tst_Databases dbs;
dbs.addDbs();
@@ -261,8 +264,9 @@ void tst_QSql::openErrorRecovery()
void tst_QSql::registerSqlDriver()
{
- int argc = 0;
- QGuiApplication app( argc, 0, false );
+ int argc = 1;
+ const char *argv[] = {"test"};
+ QGuiApplication app(argc, const_cast<char **>(argv), false);
QSqlDatabase::registerSqlDriver( "QSQLTESTDRIVER", new QSqlDriverCreator<QSqlNullDriver> );
QVERIFY( QSqlDatabase::drivers().contains( "QSQLTESTDRIVER" ) );