From 3385fb91e1e55e1bfa1f78dfb8ce2e9f3fdaedef Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 24 Nov 2011 10:36:10 +1000 Subject: Fixed installation of corelib tests In .pro files, removed wince/symbian-specific DEPLOYMENT cases and replaced them with TESTDATA where appropriate. In .cpp files, removed SRCDIR and relative paths to testdata and replaced them with the QFINDTESTDATA macro where appropriate. Modified test helper apps/libs to install themselves under the test they relate to. This change allows corelib tests to be correctly installed, along with their testdata, via `make install'. Change-Id: I5e202e2f3b577af7e39072d5c9fe13e0ca125304 Reviewed-by: Jason McDonald --- tests/auto/corelib/tools/qbytearray/qbytearray.pro | 9 +-------- .../auto/corelib/tools/qbytearray/tst_qbytearray.cpp | 2 +- tests/auto/corelib/tools/qchar/qchar.pro | 7 +------ tests/auto/corelib/tools/qchar/tst_qchar.cpp | 2 +- .../corelib/tools/qelapsedtimer/qelapsedtimer.pro | 5 ----- .../tools/qlocale/syslocaleapp/syslocaleapp.pro | 8 +++++--- tests/auto/corelib/tools/qlocale/test/test.pro | 20 +++++++------------- tests/auto/corelib/tools/qlocale/tst_qlocale.cpp | 6 ++++-- .../corelib/tools/qsharedpointer/qsharedpointer.pro | 2 +- .../tools/qsharedpointer/tst_qsharedpointer.cpp | 2 +- .../qtextboundaryfinder/qtextboundaryfinder.pro | 7 +------ .../qtextboundaryfinder/tst_qtextboundaryfinder.cpp | 4 +++- 12 files changed, 26 insertions(+), 48 deletions(-) (limited to 'tests/auto/corelib/tools') diff --git a/tests/auto/corelib/tools/qbytearray/qbytearray.pro b/tests/auto/corelib/tools/qbytearray/qbytearray.pro index 20aaf86d9e..25a9f9c185 100644 --- a/tests/auto/corelib/tools/qbytearray/qbytearray.pro +++ b/tests/auto/corelib/tools/qbytearray/qbytearray.pro @@ -3,11 +3,4 @@ TARGET = tst_qbytearray QT = core-private testlib SOURCES = tst_qbytearray.cpp -wince* { - addFile.files = rfc3252.txt - addFile.path = . - DEPLOYMENT += addFile - DEFINES += SRCDIR=\\\"./\\\" -} else { - DEFINES += SRCDIR=\\\"$$PWD/\\\" -} +TESTDATA += rfc3252.txt diff --git a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp index 5f9751c606..f3c33f184f 100644 --- a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp +++ b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp @@ -172,7 +172,7 @@ void tst_QByteArray::qCompress_data() char** tmpArgv = 0; QCoreApplication app(tmpArgc, tmpArgv); #endif - QFile file( SRCDIR "rfc3252.txt" ); + QFile file( QFINDTESTDATA("rfc3252.txt") ); QVERIFY( file.open(QIODevice::ReadOnly) ); QTest::newRow( "04" ) << file.readAll(); } diff --git a/tests/auto/corelib/tools/qchar/qchar.pro b/tests/auto/corelib/tools/qchar/qchar.pro index c0a9f1b1e5..4a7072cbc9 100644 --- a/tests/auto/corelib/tools/qchar/qchar.pro +++ b/tests/auto/corelib/tools/qchar/qchar.pro @@ -3,9 +3,4 @@ TARGET = tst_qchar QT = core-private testlib SOURCES = tst_qchar.cpp -wince* { - deploy.files += NormalizationTest.txt - DEPLOYMENT += deploy -} - -DEFINES += SRCDIR=\\\"$$PWD/\\\" +TESTDATA += NormalizationTest.txt diff --git a/tests/auto/corelib/tools/qchar/tst_qchar.cpp b/tests/auto/corelib/tools/qchar/tst_qchar.cpp index 839103415f..652ad5e7c2 100644 --- a/tests/auto/corelib/tools/qchar/tst_qchar.cpp +++ b/tests/auto/corelib/tools/qchar/tst_qchar.cpp @@ -583,7 +583,7 @@ void tst_QChar::normalization_data() int linenum = 0; int part = 0; - QFile f(SRCDIR "NormalizationTest.txt"); + QFile f(QFINDTESTDATA("NormalizationTest.txt")); QVERIFY(f.exists()); f.open(QIODevice::ReadOnly); diff --git a/tests/auto/corelib/tools/qelapsedtimer/qelapsedtimer.pro b/tests/auto/corelib/tools/qelapsedtimer/qelapsedtimer.pro index f03343f176..9bb1bdcfe3 100644 --- a/tests/auto/corelib/tools/qelapsedtimer/qelapsedtimer.pro +++ b/tests/auto/corelib/tools/qelapsedtimer/qelapsedtimer.pro @@ -3,8 +3,3 @@ TARGET = tst_qelapsedtimer QT = core testlib SOURCES = tst_qelapsedtimer.cpp -wince* { - DEFINES += SRCDIR=\\\"\\\" -} else { - DEFINES += SRCDIR=\\\"$$PWD/\\\" -} diff --git a/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.pro b/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.pro index d3188c020d..d510d82207 100644 --- a/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.pro +++ b/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.pro @@ -1,8 +1,10 @@ SOURCES += syslocaleapp.cpp DESTDIR = ./ +CONFIG -= app_bundle + QT = core -# no install rule for application used by test -INSTALLS = -CONFIG -= app_bundle +# This app is testdata for tst_qlocale +target.path = $$[QT_INSTALL_TESTS]/tst_qlocale/$$TARGET +INSTALLS += target diff --git a/tests/auto/corelib/tools/qlocale/test/test.pro b/tests/auto/corelib/tools/qlocale/test/test.pro index 4649d78c03..5a4fb674c5 100644 --- a/tests/auto/corelib/tools/qlocale/test/test.pro +++ b/tests/auto/corelib/tools/qlocale/test/test.pro @@ -3,20 +3,14 @@ QT = core testlib network embedded: QT += gui SOURCES = ../tst_qlocale.cpp -!wince* { - TARGET = ../tst_qlocale - win32: { - CONFIG(debug, debug|release) { - TARGET = ../../debug/tst_qlocale - } else { - TARGET = ../../release/tst_qlocale - } +TARGET = ../tst_qlocale +win32 { + CONFIG(debug, debug|release) { + TARGET = ../../debug/tst_qlocale + } else { + TARGET = ../../release/tst_qlocale } -} else { - TARGET = tst_qlocale - addFiles.files = ../syslocaleapp - addFiles.path = "\\Program Files\\tst_qlocale" - DEPLOYMENT += addFiles } +TESTDATA += syslocaleapp mac: CONFIG += insignificant_test # QTBUG-22769 diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index a5a247f15a..1cd695ae46 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -372,7 +372,7 @@ void tst_QLocale::emptyCtor() /* because of caching of the system locale. */ \ QProcess process; \ process.setEnvironment(QStringList(env) << QString("LANG=%1").arg(req_lc)); \ - process.start("syslocaleapp/syslocaleapp"); \ + process.start(syslocaleapp_dir + "syslocaleapp"); \ process.waitForReadyRead(); \ QString ret = QString(process.readAll()); \ process.waitForFinished(); \ @@ -389,10 +389,12 @@ void tst_QLocale::emptyCtor() env << entry; } + QString syslocaleapp_dir = QFINDTESTDATA("syslocaleapp/"); + // Get default locale. QProcess p; p.setEnvironment(env); - p.start("syslocaleapp/syslocaleapp"); + p.start(syslocaleapp_dir + "syslocaleapp"); p.waitForReadyRead(); QString defaultLoc = QString(p.readAll()); p.waitForFinished(); diff --git a/tests/auto/corelib/tools/qsharedpointer/qsharedpointer.pro b/tests/auto/corelib/tools/qsharedpointer/qsharedpointer.pro index 8ee58a03f0..b1cd309293 100644 --- a/tests/auto/corelib/tools/qsharedpointer/qsharedpointer.pro +++ b/tests/auto/corelib/tools/qsharedpointer/qsharedpointer.pro @@ -10,6 +10,6 @@ SOURCES = tst_qsharedpointer.cpp \ HEADERS = forwarddeclared.h \ wrapper.h -DEFINES += SRCDIR=\\\"$$PWD/\\\" +TESTDATA += forwarddeclared.cpp forwarddeclared.h include(externaltests.pri) diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp index c4acf5be76..416ce147be 100644 --- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp @@ -1786,7 +1786,7 @@ void tst_QSharedPointer::invalidConstructs() QTest::QExternalTest test; test.setQtModules(QTest::QExternalTest::QtCore); - test.setExtraProgramSources(QStringList() << SRCDIR "forwarddeclared.cpp"); + test.setExtraProgramSources(QStringList() << QFINDTESTDATA("forwarddeclared.cpp")); test.setProgramHeader( "#define QT_SHAREDPOINTER_TRACK_POINTERS\n" "#define QT_DEBUG\n" diff --git a/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro b/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro index 68f189b130..448b2ef80c 100644 --- a/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro +++ b/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro @@ -2,10 +2,5 @@ CONFIG += testcase parallel_test TARGET = tst_qtextboundaryfinder QT = core testlib SOURCES = tst_qtextboundaryfinder.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" -wince* { - addFiles.files = data - addFiles.path = . - DEPLOYMENT += addFiles -} +TESTDATA += data diff --git a/tests/auto/corelib/tools/qtextboundaryfinder/tst_qtextboundaryfinder.cpp b/tests/auto/corelib/tools/qtextboundaryfinder/tst_qtextboundaryfinder.cpp index f2a356b177..4cc1dc0156 100644 --- a/tests/auto/corelib/tools/qtextboundaryfinder/tst_qtextboundaryfinder.cpp +++ b/tests/auto/corelib/tools/qtextboundaryfinder/tst_qtextboundaryfinder.cpp @@ -69,7 +69,9 @@ private slots: void tst_QTextBoundaryFinder::init() { #ifndef Q_OS_IRIX - QDir::setCurrent(SRCDIR); + // chdir into the top-level data dir, then refer to our testdata using relative paths + QString testdata_dir = QFileInfo(QFINDTESTDATA("data")).absolutePath(); + QVERIFY2(QDir::setCurrent(testdata_dir), qPrintable("Could not chdir to " + testdata_dir)); #endif } -- cgit v1.2.3