diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2018-03-02 12:30:44 +0100 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2018-05-04 08:47:18 +0000 |
commit | 5a79a9ea41ab1223edc39b6c594a682cb079dd18 (patch) | |
tree | c94db5fbb07fc0550fe3eed998ed54f5542569c6 /tests | |
parent | 554e44b77de8df75cfa7b9a4dc81a795509e7de9 (diff) |
Make sure $$relative_path() uses an absolute path as its first arg
Thanks to QTBUG-61373, this qmake function was called with
/usr/local/5.10.1 as baseDir, which isn't absolute, leading to an
assertion failure. We could raise the error within qmake but it
proved easier to simply resolve any non-absolute baseDir using PWD,
before trying to use it as an absolute path.
Did the same for $$absolute_path(). Documented both. Adjusted the
assert that caught this to report any non-absolute path that upsets
it. Added simple tests, fixed an existing test.
Task-number: QTBUG-66156
Change-Id: Icfef2e2f5b236e071177c9beffa38d71bf404292
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
(cherry picked from commit 58b373c9e3c0a7307e3fbafeb5ad710088b8e685)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/tools/qmakelib/evaltest.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/auto/tools/qmakelib/evaltest.cpp b/tests/auto/tools/qmakelib/evaltest.cpp index cf69cc4026..a057c7e15a 100644 --- a/tests/auto/tools/qmakelib/evaltest.cpp +++ b/tests/auto/tools/qmakelib/evaltest.cpp @@ -1604,6 +1604,12 @@ void tst_qmakelib::addReplaceFunctions(const QString &qindir) << "" << true; + QTest::newRow("$$absolute_path(): relative file & relative path") + << "VAR = $$absolute_path(dir/file.ext, some/where)" + << "VAR = " + qindir + "/some/where/dir/file.ext" + << "" + << true; + QTest::newRow("$$absolute_path(): file & path") << "VAR = $$absolute_path(dir/file.ext, " EVAL_DRIVE "/root/sub)" << "VAR = " EVAL_DRIVE "/root/sub/dir/file.ext" @@ -1642,6 +1648,12 @@ void tst_qmakelib::addReplaceFunctions(const QString &qindir) << "" << true; + QTest::newRow("$$relative_path(): relative file & relative path") + << "VAR = $$relative_path(dir/file.ext, some/where)" + << "VAR = dir/file.ext" + << "" + << true; + QTest::newRow("$$relative_path(): relative file to empty") << "VAR = $$relative_path(dir/..)" << "VAR = ." @@ -2714,9 +2726,9 @@ void tst_qmakelib::proEval_data() // Raw data leak with empty file name. Verify with Valgrind or asan. QTest::newRow("QTBUG-54550") - << "FULL = /there/is\n" + << "FULL = " EVAL_DRIVE "/there/is\n" "VAR = $$absolute_path(, $$FULL/nothing/here/really)" - << "VAR = /there/is/nothing/here/really" + << "VAR = " EVAL_DRIVE "/there/is/nothing/here/really" << "" << true; } |