diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2021-07-05 14:24:47 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2021-07-07 19:36:49 +0200 |
commit | 1cabfd168048b6b76b406015cc5a5c28e8f38cf0 (patch) | |
tree | 61c5218f145b91449a4dbe3cfb8ffaad221b35bb | |
parent | 230014608571c2ad88b740455f4ffe1b963cad22 (diff) |
Move QSKIP()s to _data() functions in QFile benchmark
Skipping once in the data function is the clean way to do this. Saves
setting up dummy data just so as to skip it, or setting up real data
and then skippin on each row.
Change-Id: I1666d134b6f206e8055fbbc5efd2e2116431a9c1
Reviewed-by: Jason McDonald <macadder1@gmail.com>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
-rw-r--r-- | tests/benchmarks/corelib/io/qfile/main.cpp | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/tests/benchmarks/corelib/io/qfile/main.cpp b/tests/benchmarks/corelib/io/qfile/main.cpp index 6b37c7d27a..1a4000772a 100644 --- a/tests/benchmarks/corelib/io/qfile/main.cpp +++ b/tests/benchmarks/corelib/io/qfile/main.cpp @@ -169,11 +169,7 @@ void tst_qfile::cleanupTestCase() void tst_qfile::readBigFile_QFile() { readBigFile(); } void tst_qfile::readBigFile_QFSFileEngine() { -#ifdef QT_BUILD_INTERNAL readBigFile(); -#else - QSKIP("This test requires -developer-build."); -#endif } void tst_qfile::readBigFile_posix() { @@ -197,8 +193,7 @@ void tst_qfile::readBigFile_QFSFileEngine_data() readBigFile_data(QFSFileEngineBenchmark, QIODevice::NotOpen, QIODevice::Unbuffered); readBigFile_data(QFSFileEngineBenchmark, QIODevice::Text, QIODevice::Unbuffered); #else - QTest::addColumn<int>("dummy"); - QTest::newRow("Test will be skipped") << -1; + QSKIP("This test requires -developer-build."); #endif } @@ -209,10 +204,13 @@ void tst_qfile::readBigFile_posix_data() void tst_qfile::readBigFile_Win32_data() { +#ifdef Q_OS_WIN readBigFile_data(Win32Benchmark, QIODevice::NotOpen, QIODevice::NotOpen); +#else + QSKIP("This is Windows only benchmark."); +#endif } - void tst_qfile::readBigFile_data(BenchmarkType type, QIODevice::OpenModeFlag t, QIODevice::OpenModeFlag b) { QTest::addColumn<tst_qfile::BenchmarkType>("testType"); @@ -239,11 +237,6 @@ void tst_qfile::readBigFile() QFETCH(QFile::OpenModeFlag, textMode); QFETCH(QFile::OpenModeFlag, bufferedMode); -#ifndef Q_OS_WIN - if (testType == Win32Benchmark) - QSKIP("This is Windows only benchmark."); -#endif - char *buffer = new char[BUFSIZE]; createFile(); fillFile(); @@ -493,11 +486,7 @@ void tst_qfile::open() void tst_qfile::readSmallFiles_QFile() { readSmallFiles(); } void tst_qfile::readSmallFiles_QFSFileEngine() { -#ifdef QT_BUILD_INTERNAL readSmallFiles(); -#else - QSKIP("This test requires -developer-build."); -#endif } void tst_qfile::readSmallFiles_posix() { @@ -524,8 +513,7 @@ void tst_qfile::readSmallFiles_QFSFileEngine_data() readSmallFiles_data(QFSFileEngineBenchmark, QIODevice::NotOpen, QIODevice::Unbuffered); readSmallFiles_data(QFSFileEngineBenchmark, QIODevice::Text, QIODevice::Unbuffered); #else - QTest::addColumn<int>("dummy"); - QTest::newRow("Test will be skipped") << -1; + QSKIP("This test requires -developer-build."); #endif } @@ -536,10 +524,14 @@ void tst_qfile::readSmallFiles_posix_data() void tst_qfile::readSmallFiles_Win32_data() { + +#ifdef Q_OS_WIN readSmallFiles_data(Win32Benchmark, QIODevice::NotOpen, QIODevice::NotOpen); +#else + QSKIP("This is Windows only benchmark."); +#endif } - void tst_qfile::readSmallFiles_data(BenchmarkType type, QIODevice::OpenModeFlag t, QIODevice::OpenModeFlag b) { QTest::addColumn<tst_qfile::BenchmarkType>("testType"); @@ -592,11 +584,6 @@ void tst_qfile::readSmallFiles() QFETCH(QFile::OpenModeFlag, textMode); QFETCH(QFile::OpenModeFlag, bufferedMode); -#ifndef Q_OS_WIN - if (testType == Win32Benchmark) - QSKIP("This is Windows only benchmark."); -#endif - createSmallFiles(); QDir dir(tmpDirName); |