Fixed benchmarks to work from install directory

- Changed benchmarks to use TESTDATA and QFINDTESTDATA
- Fixed up targets all use tst_bench_ syntax

Change-Id: I5c2936702e248478f5df225ce38893158ee22d7f
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
This commit is contained in:
Kurt Korbatits 2012-03-12 14:24:02 +10:00 committed by Qt by Nokia
parent 36513264da
commit 0f929bfa9a
18 changed files with 104 additions and 32 deletions

View File

@ -129,7 +129,9 @@ void tst_QTextCodec::fromUnicode_data() const
void tst_QTextCodec::fromUnicode() const
{
QFETCH(QTextCodec*, codec);
QFile file(SRCDIR "utf-8.txt");
QString testFile = QFINDTESTDATA("utf-8.txt");
QVERIFY2(!testFile.isEmpty(), "cannot find test file utf-8.txt!");
QFile file(testFile);
if (!file.open(QFile::ReadOnly)) {
qFatal("Cannot open input file");
return;
@ -156,7 +158,9 @@ void tst_QTextCodec::toUnicode_data() const
void tst_QTextCodec::toUnicode() const
{
QFETCH(QTextCodec*, codec);
QFile file(SRCDIR "utf-8.txt");
QString testFile = QFINDTESTDATA("utf-8.txt");
QVERIFY2(!testFile.isEmpty(), "cannot find test file utf-8.txt!");
QFile file(testFile);
QVERIFY(file.open(QFile::ReadOnly));
QByteArray data = file.readAll();
const char *d = data.constData();

View File

@ -2,9 +2,5 @@ TARGET = tst_bench_qtextcodec
QT = core testlib
SOURCES += main.cpp
wince*:{
DEFINES += SRCDIR=\\\"\\\"
} else {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
TESTDATA = utf-8.txt

View File

@ -1,5 +1,5 @@
TEMPLATE = app
TARGET = bench_qdir_10000
TARGET = tst_bench_qdir_10000
SOURCES += bench_qdir_10000.cpp

View File

@ -3,3 +3,5 @@ QT = core testlib
CONFIG -= app_bundle
SOURCES += tst_bench_qtbinaryjson.cpp
TESTDATA = numbers.json test.json

File diff suppressed because one or more lines are too long

View File

@ -87,7 +87,9 @@ void BenchmarkQtBinaryJson::cleanup()
void BenchmarkQtBinaryJson::parseNumbers()
{
QFile file(QLatin1String("numbers.json"));
QString testFile = QFINDTESTDATA("numbers.json");
QVERIFY2(!testFile.isEmpty(), "cannot find test file numbers.json!");
QFile file(testFile);
file.open(QFile::ReadOnly);
QByteArray testJson = file.readAll();
@ -99,7 +101,9 @@ void BenchmarkQtBinaryJson::parseNumbers()
void BenchmarkQtBinaryJson::parseJson()
{
QFile file(QLatin1String("../../../auto/corelib/json/test.json"));
QString testFile = QFINDTESTDATA("test.json");
QVERIFY2(!testFile.isEmpty(), "cannot find test file test.json!");
QFile file(testFile);
file.open(QFile::ReadOnly);
QByteArray testJson = file.readAll();
@ -111,7 +115,9 @@ void BenchmarkQtBinaryJson::parseJson()
void BenchmarkQtBinaryJson::parseJsonToVariant()
{
QFile file(QLatin1String("../../../auto/corelib/json/test.json"));
QString testFile = QFINDTESTDATA("test.json");
QVERIFY2(!testFile.isEmpty(), "cannot find test file test.json!");
QFile file(testFile);
file.open(QFile::ReadOnly);
QByteArray testJson = file.readAll();

View File

@ -1,6 +1,6 @@
QT = core testlib
TEMPLATE = app
TARGET = tst_qmetatype
TARGET = tst_bench_qmetatype
SOURCES += tst_qmetatype.cpp

View File

@ -1,3 +1,3 @@
TARGET = tst_qalgorithms
TARGET = tst_bench_qalgorithms
QT = core testlib
SOURCES = tst_qalgorithms.cpp

View File

@ -1,4 +1,4 @@
TARGET = tst_qlist
TARGET = tst_bench_qlist
QT = core testlib
SOURCES += main.cpp

View File

@ -1408,7 +1408,9 @@ void tst_QString::ucstrncmp() const
void tst_QString::fromUtf8() const
{
QFile file(SRCDIR "utf-8.txt");
QString testFile = QFINDTESTDATA("utf-8.txt");
QVERIFY2(!testFile.isEmpty(), "cannot find test file utf-8.txt!");
QFile file(testFile);
if (!file.open(QFile::ReadOnly)) {
qFatal("Cannot open input file");
return;

View File

@ -3,11 +3,7 @@ QT -= gui
QT += core-private testlib
SOURCES += main.cpp data.cpp fromlatin1.cpp fromutf8.cpp
wince*:{
DEFINES += SRCDIR=\\\"\\\"
} else {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
TESTDATA = utf-8.txt
sse4:QMAKE_CXXFLAGS += -msse4
else:ssse3:QMAKE_FLAGS += -mssse3

View File

@ -1,4 +1,4 @@
TARGET = tst_vector
TARGET = tst_bench_vector
QT = core testlib
INCLUDEPATH += .
SOURCES += main.cpp outofline.cpp

View File

@ -1,7 +1,7 @@
QT += widgets testlib
TEMPLATE = app
TARGET = bench_qheaderview
TARGET = tst_bench_qheaderview
SOURCES += qheaderviewbench.cpp

View File

@ -1,7 +1,7 @@
QT += widgets testlib
TEMPLATE = app
TARGET = tst_qtbench
TARGET = tst_bench_qtbench
SOURCES += tst_qtbench.cpp

View File

@ -129,7 +129,9 @@ void tst_QText::shaping_data()
QTest::newRow("lorem") << m_lorem;
QTest::newRow("short") << QString::fromLatin1("Lorem ipsum dolor sit amet");
QFile file(QString::fromLatin1(SRCDIR) + QLatin1String("/bidi.txt"));
QString testFile = QFINDTESTDATA("bidi.txt");
QVERIFY2(!testFile.isEmpty(), "cannot find test file bidi.txt!");
QFile file(testFile);
QVERIFY(file.open(QFile::ReadOnly));
QByteArray data = file.readAll();
QVERIFY(data.count() > 1000);

View File

@ -6,4 +6,4 @@ TARGET = tst_bench_QText
SOURCES += main.cpp
DEFINES += SRCDIR=\\\"$$PWD/\\\"
TESTDATA = bidi.txt

View File

@ -59,7 +59,9 @@ void tst_jpeg::jpegDecodingQtWebkitStyle()
{
// QtWebkit currently calls size() to get the image size for layouting purposes.
// Then when it is in the viewport (we assume that here) it actually gets decoded.
QFile inputJpeg(SRCDIR "n900.jpeg");
QString testFile = QFINDTESTDATA("n900.jpeg");
QVERIFY2(!testFile.isEmpty(), "cannot find test file n900.jpeg!");
QFile inputJpeg(testFile);
QVERIFY(inputJpeg.exists());
inputJpeg.open(QIODevice::ReadOnly);
QByteArray imageData = inputJpeg.readAll();

View File

@ -3,10 +3,6 @@ TARGET = jpeg
QT += testlib
CONFIG += release
wince*: {
DEFINES += SRCDIR=\\\"\\\"
} else {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
SOURCES += jpeg.cpp
TESTDATA = n900.jpeg