summaryrefslogtreecommitdiffstats
path: root/mkspecs/features
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2011-11-24 10:31:24 +1000
committerQt by Nokia <qt-info@nokia.com>2011-11-24 23:42:35 +0100
commite759f9580ef0a76131c7540015a87968742fce9f (patch)
tree452f4c7cc43c511fea8004a8a5dfd0eceac41ff8 /mkspecs/features
parentcc37a8cf414c558c8508de32b3f19bfbdac1a13a (diff)
Improved usage of TESTDATA with relative paths beginning with ".."
Support the common construct of a top-level test directory having a test/test.pro with: TARGET = ../tst_sometest TESTDATA = ../data1.txt ../data2.txt Prior to this change, the ".." in TESTDATA would cause the data to break out of the test's installation directory. Change-Id: I22860bf3a148f278b3f4e18b476fd151f7f0f775 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Diffstat (limited to 'mkspecs/features')
-rw-r--r--mkspecs/features/testcase.prf15
1 files changed, 14 insertions, 1 deletions
diff --git a/mkspecs/features/testcase.prf b/mkspecs/features/testcase.prf
index a6b8d82f1e..15135e1f89 100644
--- a/mkspecs/features/testcase.prf
+++ b/mkspecs/features/testcase.prf
@@ -104,7 +104,20 @@ contains(INSTALLS, target) {
# TESTDATA consists of the files to install (source)...
$$tdif = $$file
- # ... and the destination preserves the relative path
+ # ... and the destination preserves the relative path.
+ # Strip any leading ../ from the testdata, so that installation does not escape
+ # the test's directory in the case of e.g.
+ #
+ # TARGET = ../tst_qprocess
+ # TESTDATA = ../thing1 ../thing2
+ #
+ # The testdata should end up at $$[QT_INSTALL_TESTS]/tst_qprocess/thing1,
+ # rather than $$[QT_INSTALL_TESTS]/tst_qprocess/../thing1.
+ #
+ # Note that this does not guarantee the same relative path between test binary
+ # and testdata in the build and install tree, but should cover most cases.
+ #
+ file = $$replace(file, ^(\\.\\./)+, )
$$tdip = $${target.path}/$$dirname(file)
INSTALLS += $$tdi