diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2014-04-02 14:08:29 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-04 16:55:01 +0200 |
commit | 9a4beb4d36dc0c613e59aa5d88060d521462f56c (patch) | |
tree | a84768fe1e7a041b6c19ce8e9960bb825bce953b /tests/auto/sql/kernel/qsql | |
parent | 19ff7d038fbc7117d2bfddb6f2ad27b1fdd84acb (diff) |
Improve handling of temporary directories in SQL tests.
Initialize directory delayed in shared code and add checks to verify
that it is valid. Close attached / cloned databases to prevent locks
on files and leaking temporary directories caused by SQLite:
QTemporaryDir: Unable to remove "...\Temp\tst_qsqldatabase-P1XkOA" most likely due to the presence of read-only files.
QTemporaryDir: Unable to remove "...\Temp\tst_qsqltablemodel-P1XkOA" most likely due to the presence of read-only files.
QWARN : tst_QSql::concurrentAccess() QTemporaryDir: Unable to remove "...\Temp\tst_qsql-l0VAKJ" most likely due to the presence of read-only files.
Change-Id: If85bbaed04bb1a32e427d642be332996d967f796
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'tests/auto/sql/kernel/qsql')
-rw-r--r-- | tests/auto/sql/kernel/qsql/tst_qsql.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/auto/sql/kernel/qsql/tst_qsql.cpp b/tests/auto/sql/kernel/qsql/tst_qsql.cpp index 24f418af26..2dcd75427b 100644 --- a/tests/auto/sql/kernel/qsql/tst_qsql.cpp +++ b/tests/auto/sql/kernel/qsql/tst_qsql.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the test suite of the Qt Toolkit. @@ -117,7 +117,7 @@ void tst_QSql::basicDriverTest() char *argv[] = { const_cast<char*>(QTest::currentAppName()) }; QCoreApplication app(argc, argv, false); tst_Databases dbs; - dbs.open(); + QVERIFY(dbs.open()); foreach (const QString& dbName, dbs.dbNames) { QSqlDatabase db = QSqlDatabase::database(dbName); @@ -161,7 +161,7 @@ void tst_QSql::open() QCoreApplication app(argc, argv, false); tst_Databases dbs; - dbs.open(); + QVERIFY(dbs.open()); if (count == -1) // first iteration: see how many dbs are open count = (int) dbs.dbNames.count(); @@ -188,7 +188,7 @@ void tst_QSql::concurrentAccess() QCoreApplication app(argc, argv, false); tst_Databases dbs; - dbs.open(); + QVERIFY(dbs.open()); foreach (const QString& dbName, dbs.dbNames) { QSqlDatabase db = QSqlDatabase::database(dbName); QVERIFY(db.isValid()); @@ -204,6 +204,7 @@ void tst_QSql::concurrentAccess() QVERIFY_SQL(ndb, open()); QCOMPARE(db.tables(), ndb.tables()); + ndb.close(); } // no database servers installed - don't fail QVERIFY(1); @@ -217,7 +218,7 @@ void tst_QSql::openErrorRecovery() QCoreApplication app(argc, argv, false); tst_Databases dbs; - dbs.addDbs(); + QVERIFY(dbs.addDbs()); if (dbs.dbNames.isEmpty()) QSKIP("No database drivers installed"); foreach (const QString& dbName, dbs.dbNames) { |