diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-06-27 12:32:13 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-08-17 23:48:00 +0200 |
commit | 371214dea7f92b3170d0239b3d9944275adf951a (patch) | |
tree | ddaf5695c0c2340004ff098f97705fcf232f7030 /tests/auto/corelib/io/qfileinfo | |
parent | 1ee75e47401d0ed4646d4fef7ce8e09eb90f4d5e (diff) |
Remove network dependency for tests with UNC paths
Windows VMs are provisioned with shared folders that are available as
\\${COMPUTERNAME}\testshare(writable)
so we don't need to access a remote SMB server over network anymore just
to test whether our string-parsing code handles UNC paths correctly.
Add a QTest::uncServerName() helper function to the shared filesystem.h
header and use that instead of QtNetworkSettings::winServerName. The
latter is now only used in tst_NetworkSelfTest::smbServer().
Pick-to: 6.4
Change-Id: Id0da66369ad0f4a980d612de2a31a391f1192253
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/auto/corelib/io/qfileinfo')
-rw-r--r-- | tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index 80f204156e..40f4c57202 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -31,9 +31,6 @@ #endif #include <qplatformdefs.h> #include <qdebug.h> -#if defined(Q_OS_WIN) -#include "../../../network-settings.h" -#endif #include <private/qfileinfo_p.h> #include "../../../../shared/filesystem.h" @@ -383,7 +380,7 @@ void tst_QFileInfo::isDir_data() //QTest::newRow("drive 2") << "t:s" << false; #endif #if defined(Q_OS_WIN) - const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName(); + const QString uncRoot = QStringLiteral("//") + QTest::uncServerName(); QTest::newRow("unc 1") << uncRoot << true; QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << true; QTest::newRow("unc 3") << uncRoot + "/testshare" << true; @@ -426,7 +423,7 @@ void tst_QFileInfo::isRoot_data() #endif #if defined(Q_OS_WIN) - const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName(); + const QString uncRoot = QStringLiteral("//") + QTest::uncServerName(); QTest::newRow("unc 1") << uncRoot << true; QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << true; QTest::newRow("unc 3") << uncRoot + "/testshare" << false; @@ -470,7 +467,7 @@ void tst_QFileInfo::exists_data() QTest::newRow("simple dir with slash") << (m_resourcesDir + QLatin1Char('/')) << true; #if defined(Q_OS_WIN) - const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName(); + const QString uncRoot = QStringLiteral("//") + QTest::uncServerName(); QTest::newRow("unc 1") << uncRoot << true; QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << true; QTest::newRow("unc 3") << uncRoot + "/testshare" << true; @@ -1732,7 +1729,7 @@ void tst_QFileInfo::ntfsJunctionPointsAndSymlinks_data() { // Symlink to UNC share pwd.mkdir("unc"); - QString uncTarget = QStringLiteral("//") + QtNetworkSettings::winServerName() + "/testshare"; + QString uncTarget = QStringLiteral("//") + QTest::uncServerName() + "/testshare"; QString uncSymlink = QDir::toNativeSeparators(pwd.absolutePath().append("\\unc\\link_to_unc")); QTest::newRow("UNC symlink") << NtfsTestResource(NtfsTestResource::SymLink, uncSymlink, uncTarget) |