From 1cabfd168048b6b76b406015cc5a5c28e8f38cf0 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 5 Jul 2021 14:24:47 +0200 Subject: [PATCH] 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 Reviewed-by: Andreas Buhr --- tests/benchmarks/corelib/io/qfile/main.cpp | 37 +++++++--------------- 1 file changed, 12 insertions(+), 25 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("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("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("dummy"); - QTest::newRow("Test will be skipped") << -1; + QSKIP("This test requires -developer-build."); #endif } @@ -536,9 +524,13 @@ void tst_qfile::readSmallFiles_posix_data() void tst_qfile::readSmallFiles_Win32_data() { - readSmallFiles_data(Win32Benchmark, QIODevice::NotOpen, QIODevice::NotOpen); -} +#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) { @@ -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);