path: root/tests/auto
diff options
authorOswald Buddenhagen <>2012-07-25 10:51:44 +0200
committerQt by Nokia <>2012-07-28 00:09:45 +0200
commite07372ff5077e60136451733dab59e46f3e9132d (patch)
tree344620f92442717438206d9f535f100bf9d873f7 /tests/auto
parentd9048bef20103ac0c1af3365c8a47f1569a8e529 (diff)
fix host vs. makefile directory separator mess
the system path separator and shell are bound to the host system (system() will use cmd even on mingw with sh.exe in path). the makefiles otoh may depend on what the qmakespec defines. consequently, add $$system_path() and $$system_quote() (for use with system() & $$system()). $$native_path() is renamed to $$shell_path() and should be used with $$shell_quote() to produce command lines in makefiles. $$QMAKE_DIR_SEP needs to be applied to Option::dir_sep right after parsing the spec, so it is available to $$shell_{path,quote}(). Change-Id: If3db4849e7f96068cf03a32348a24f3a72d6292c Reviewed-by: Rafael Roquetto <> Reviewed-by: Sean Harmer <>
Diffstat (limited to 'tests/auto')
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/auto/tools/qmake/testdata/functions/ b/tests/auto/tools/qmake/testdata/functions/
index 884113b95a..98e12b7650 100644
--- a/tests/auto/tools/qmake/testdata/functions/
+++ b/tests/auto/tools/qmake/testdata/functions/
@@ -131,7 +131,8 @@ testReplace($$format_number(13, width=5 padsign zeropad), " 0013", "zero-padded
testReplace($$clean_path("c:$${DIR_SEPARATOR}crazy//path/../trolls"), "c:/crazy/trolls", "clean_path")
-testReplace($$native_path("/crazy/trolls"), "$${DIR_SEPARATOR}crazy$${DIR_SEPARATOR}trolls", "native_path")
+testReplace($$shell_path("/crazy/trolls"), "$${QMAKE_DIR_SEP}crazy$${QMAKE_DIR_SEP}trolls", "shell_path")
+testReplace($$system_path("/crazy/trolls"), "$${DIR_SEPARATOR}crazy$${DIR_SEPARATOR}trolls", "system_path")
testReplace($$absolute_path("crazy/trolls"), "$$PWD/crazy/trolls", "absolute_path")
testReplace($$absolute_path("crazy/trolls", "/fake/path"), "/fake/path/crazy/trolls", "absolute_path with base")
@@ -142,10 +143,17 @@ testReplace($$relative_path(""), "", "relative_path of empty")
#this test is very rudimentary. the backend function is thoroughly tested in qt creator
in = "some nasty\" path\\"
-win32: \
- out = "\"some nasty\"\\^\"\" path\"\\"
+out_cmd = "\"some nasty\"\\^\"\" path\"\\"
+out_sh = "'some nasty\" path\\'"
+equals(QMAKE_HOST.os, Windows): \
+ out = $$out_cmd
else: \
- out = "'some nasty\" path\\'"
+ out = $$out_sh
+testReplace($$system_quote($$in), $$out, "system_quote")
+!equals(QMAKE_DIR_SEP, /): \
+ out = $$out_cmd
+else: \
+ out = $$out_sh
testReplace($$shell_quote($$in), $$out, "shell_quote")
testReplace($$reverse($$list(one two three)), three two one, "reverse")