Tests: C++: Make tests run from shadow builds.

For shadow builds some tests couldn't find their test data. Solved by
using the same pattern as in Qt tests: Inject $$PWD as SRCDIR via a
DEFINES statement.

Note: It was considered to use QFINDTESTDATA for Qt5, but this was
rejected due to:
 1) It's Qt5 only (would mean to introduce some wrapper...)
 2) As the doc states, it will not work with QTEST_APPLESS_MAIN tests.

Change-Id: Ie6cf59570fe61725b7f6f83b7da650331ddb38fc
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Nikolai Kosjar
2012-11-06 12:41:05 +01:00
parent 4e49c297bc
commit 492ca1cbcf
4 changed files with 12 additions and 4 deletions

View File

@@ -1,7 +1,10 @@
include(../../qttest.pri)
include(../shared/shared.pri)
SOURCES += tst_preprocessor.cpp
# Inject the source dir for referencing test data from shadow builds.
DEFINES += SRCDIR=\\\"$$PWD\\\"
SOURCES += tst_preprocessor.cpp
OTHER_FILES = \
data/noPP.1.cpp \
data/noPP.2.cpp \