diff options
author | Andrew Knight <andrew.knight@digia.com> | 2013-09-01 19:05:46 +0300 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-02 12:36:05 +0200 |
commit | c6af0a504f2acced8147a1dd78bc249da49d3d99 (patch) | |
tree | 77355f11d9c7d03277b40b000db29a651a5df1d4 /tests/benchmarks | |
parent | c097670bf8f9c3871ca12bf9a257702f8dc4e947 (diff) |
WinRT: Fix various test compilations
- Remove irrelevant test subdirs via .pro files
- Follow WinCE codepaths where applicable
- Replace unsupported Win32 APIs with WinRT equivalents
This does not aim to fix any failures in the tests themselves; it only
makes them compile.
Change-Id: Ia82bc0cc402891f8f6238d4c261ee9152b51be80
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'tests/benchmarks')
6 files changed, 47 insertions, 2 deletions
diff --git a/tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp b/tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp index 49672a90bf..b2380b0e58 100644 --- a/tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp +++ b/tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp @@ -176,7 +176,12 @@ private slots: wcscat(appendedPath, L"\\*"); WIN32_FIND_DATA fd; +#ifndef Q_OS_WINRT HANDLE hSearch = FindFirstFileW(appendedPath, &fd); +#else + HANDLE hSearch = FindFirstFileEx(appendedPath, FindExInfoStandard, &fd, + FindExSearchNameMatch, NULL, FIND_FIRST_EX_LARGE_FETCH); +#endif QVERIFY(hSearch != INVALID_HANDLE_VALUE); QBENCHMARK { diff --git a/tests/benchmarks/corelib/io/qdiriterator/main.cpp b/tests/benchmarks/corelib/io/qdiriterator/main.cpp index 5188658bdb..691e822379 100644 --- a/tests/benchmarks/corelib/io/qdiriterator/main.cpp +++ b/tests/benchmarks/corelib/io/qdiriterator/main.cpp @@ -106,7 +106,12 @@ static int posix_helper(const wchar_t *dirpath) wchar_t appendedPath[MAX_PATH]; wcscpy(appendedPath, dirpath); wcscat(appendedPath, L"\\*"); +#ifndef Q_OS_WINRT hSearch = FindFirstFile(appendedPath, &fd); +#else + hSearch = FindFirstFileEx(appendedPath, FindExInfoStandard, &fd, + FindExSearchNameMatch, NULL, FIND_FIRST_EX_LARGE_FETCH); +#endif appendedPath[origDirPathLength] = 0; if (hSearch == INVALID_HANDLE_VALUE) { diff --git a/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp b/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp index bb4a921fc7..82bca1541d 100644 --- a/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp +++ b/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp @@ -230,7 +230,12 @@ void QFileSystemIteratorPrivate::pushSubDirectory(const QByteArray &path) wchar_t szSearchPath[MAX_PATH]; QString::fromLatin1(path).toWCharArray(szSearchPath); wcscat(szSearchPath, L"\\*"); +#ifndef Q_OS_WINRT HANDLE dir = FindFirstFile(szSearchPath, &m_fileSearchResult); +#else + HANDLE dir = FindFirstFileEx(szSearchPath, FindExInfoStandard, &m_fileSearchResult, + FindExSearchLimitToDirectories, NULL, FIND_FIRST_EX_LARGE_FETCH); +#endif m_bFirstSearchResult = true; #else DIR *dir = ::opendir(path.constData()); diff --git a/tests/benchmarks/corelib/io/qfile/main.cpp b/tests/benchmarks/corelib/io/qfile/main.cpp index 0beffebfb7..e0ae29fbee 100644 --- a/tests/benchmarks/corelib/io/qfile/main.cpp +++ b/tests/benchmarks/corelib/io/qfile/main.cpp @@ -310,7 +310,11 @@ void tst_qfile::readBigFile() // ensure we don't account string conversion wchar_t* cfilename = (wchar_t*)filename.utf16(); +#ifndef Q_OS_WINRT hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); +#else + hndl = CreateFile2(cfilename, GENERIC_READ, 0, OPEN_EXISTING, 0); +#endif Q_ASSERT(hndl); wchar_t* nativeBuffer = new wchar_t[BUFSIZE]; DWORD numberOfBytesRead; @@ -319,7 +323,12 @@ void tst_qfile::readBigFile() do { ReadFile(hndl, nativeBuffer, blockSize, &numberOfBytesRead, NULL); } while(numberOfBytesRead != 0); +#ifndef Q_OS_WINRT SetFilePointer(hndl, 0, NULL, FILE_BEGIN); +#else + LARGE_INTEGER offset = { 0 }; + SetFilePointerEx(hndl, offset, NULL, FILE_BEGIN); +#endif } delete[] nativeBuffer; CloseHandle(hndl); @@ -400,11 +409,20 @@ void tst_qfile::seek() // ensure we don't account string conversion wchar_t* cfilename = (wchar_t*)filename.utf16(); +#ifndef Q_OS_WINRT hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); +#else + hndl = CreateFile2(cfilename, GENERIC_READ, 0, OPEN_EXISTING, 0); +#endif Q_ASSERT(hndl); QBENCHMARK { i=(i+1)%sp_size; +#ifndef Q_OS_WINRT SetFilePointer(hndl, seekpos[i], NULL, 0); +#else + LARGE_INTEGER offset = { seekpos[i] }; + SetFilePointerEx(hndl, offset, NULL, FILE_BEGIN); +#endif } CloseHandle(hndl); #else @@ -489,7 +507,11 @@ void tst_qfile::open() wchar_t* cfilename = (wchar_t*)filename.utf16(); QBENCHMARK { +#ifndef Q_OS_WINRT hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); +#else + hndl = CreateFile2(cfilename, GENERIC_READ, 0, OPEN_EXISTING, 0); +#endif Q_ASSERT(hndl); CloseHandle(hndl); } @@ -698,7 +720,11 @@ void tst_qfile::readSmallFiles() // ensure we don't account string conversion wchar_t* cfilename = (wchar_t*)filename.utf16(); +#ifndef Q_OS_WINRT hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); +#else + hndl = CreateFile2(cfilename, GENERIC_READ, 0, OPEN_EXISTING, 0); +#endif Q_ASSERT(hndl); wchar_t* nativeBuffer = new wchar_t[BUFSIZE]; DWORD numberOfBytesRead; diff --git a/tests/benchmarks/corelib/io/qfileinfo/main.cpp b/tests/benchmarks/corelib/io/qfileinfo/main.cpp index 594e5b7478..de1aaea177 100644 --- a/tests/benchmarks/corelib/io/qfileinfo/main.cpp +++ b/tests/benchmarks/corelib/io/qfileinfo/main.cpp @@ -54,7 +54,7 @@ class qfileinfo : public QObject private slots: void existsTemporary(); void existsStatic(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) void symLinkTargetPerformanceLNK(); void symLinkTargetPerformanceMounpoint(); #endif @@ -84,7 +84,7 @@ void qfileinfo::existsStatic() QBENCHMARK { QFileInfo::exists(appPath); } } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) void qfileinfo::symLinkTargetPerformanceLNK() { QVERIFY(QFile::link("file","link.lnk")); diff --git a/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp b/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp index a7480e6afe..37fa571f8c 100644 --- a/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp +++ b/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp @@ -93,7 +93,11 @@ void NativeMutexUnlock(NativeMutexType *mutex) typedef CRITICAL_SECTION NativeMutexType; void NativeMutexInitialize(NativeMutexType *mutex) { +#ifndef Q_OS_WINRT InitializeCriticalSection(mutex); +#else + InitializeCriticalSectionEx(mutex, 0, 0); +#endif } void NativeMutexDestroy(NativeMutexType *mutex) { |