diff options
author | Mårten Nordheim <marten.nordheim@qt.io> | 2022-09-12 16:45:39 +0200 |
---|---|---|
committer | Mårten Nordheim <marten.nordheim@qt.io> | 2022-10-18 16:15:50 +0200 |
commit | 30077d462dca28ba1acecc9413e97d115b46cb6d (patch) | |
tree | 7cc9dca66a91e57e77a271b22923cba7c97292ed /tests/auto/sql | |
parent | 1bf3faa54b15b3eb0a89f251bff1d2d67eeda42e (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
Pick-to: 6.2 6.4
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>
Diffstat (limited to 'tests/auto/sql')
-rw-r--r-- | tests/auto/sql/kernel/qsqldatabase/tst_databases.h | 10 |
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 55b11bf7c6..959c76dded 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; |