summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMÃ¥rten Nordheim <marten.nordheim@qt.io>2022-09-12 16:45:39 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-10-21 12:39:32 +0000
commitc22bf97cb12743a655c6573ef400acb567d2f586 (patch)
tree9e1c8515152970ebfdcdd003978aa6d34617d2bf /tests
parent0c6f3d69a947ec61397f0ca3793c1baf941a5c64 (diff)
tst_QSql*/sqlite: Don't use random output in the datatags
It makes it impossible to rerun it, bad for both CI and local test runs. As a drive-by name the database file sqlite.db instead of foo.db Fixes: QTBUG-100245 Change-Id: I2e4ee01189ccbad2a6add5db7771d35fd7248da8 Reviewed-by: Dimitrios Apostolou <jimis@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andy Shaw <andy.shaw@qt.io> (cherry picked from commit 30077d462dca28ba1acecc9413e97d115b46cb6d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/sql/kernel/qsqldatabase/tst_databases.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/auto/sql/kernel/qsqldatabase/tst_databases.h b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h
index 5b0283d285..b77b4fd47a 100644
--- a/tests/auto/sql/kernel/qsqldatabase/tst_databases.h
+++ b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h
@@ -182,6 +182,14 @@ public:
if ( port > 0 )
cName += QLatin1Char(':') + QString::number( port );
+ if (driver == "QSQLITE") {
+ // Since the database for sqlite is generated at runtime it's always
+ // available, but we use QTempDir so it's always in a different
+ // location. Thus, let's ignore the path completely.
+ cName = "SQLite";
+ qInfo("SQLite will use the database located at %ls", qUtf16Printable(dbName));
+ }
+
db = QSqlDatabase::addDatabase( driver, cName );
if ( !db.isValid() ) {
@@ -250,7 +258,7 @@ public:
}
QTemporaryDir *sqLiteDir = dbDir();
if (sqLiteDir) {
- addDb(QStringLiteral("QSQLITE"), QDir::toNativeSeparators(sqLiteDir->path() + QStringLiteral("/foo.db")));
+ addDb(QStringLiteral("QSQLITE"), QDir::toNativeSeparators(sqLiteDir->path() + QStringLiteral("/sqlite.db")));
added = true;
}
return added;