From 07581a87f82ec127db8c1032dc340685063d0acc Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 12 Apr 2012 12:03:01 +0200 Subject: remove some qmake -project boilerplate from project files Change-Id: I5e6103db42b4fcca4ed4c2ffaec71e71e73d5b95 Reviewed-by: Joerg Bornemann --- tests/auto/other/macnativeevents/macnativeevents.pro | 3 --- tests/auto/widgets/kernel/qapplication/modal/modal.pro | 3 --- tests/auto/widgets/kernel/qapplication/wincmdline/wincmdline.pro | 3 --- tests/auto/xml/sax/qxmlsimplereader/qxmlsimplereader.pro | 3 +-- tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro | 3 --- tests/benchmarks/corelib/kernel/qvariant/qvariant.pro | 3 --- tests/benchmarks/gui/animation/qanimation/qanimation.pro | 3 --- tests/manual/qssloptions/qssloptions.pro | 3 --- 8 files changed, 1 insertion(+), 23 deletions(-) (limited to 'tests') diff --git a/tests/auto/other/macnativeevents/macnativeevents.pro b/tests/auto/other/macnativeevents/macnativeevents.pro index 6ec0942222..d72a87f205 100644 --- a/tests/auto/other/macnativeevents/macnativeevents.pro +++ b/tests/auto/other/macnativeevents/macnativeevents.pro @@ -1,8 +1,5 @@ CONFIG += testcase TARGET = tst_macnativeevents -TEMPLATE = app -DEPENDPATH += . -INCLUDEPATH += . LIBS += -framework Carbon QT += widgets testlib HEADERS += qnativeevents.h nativeeventlist.h expectedeventlist.h diff --git a/tests/auto/widgets/kernel/qapplication/modal/modal.pro b/tests/auto/widgets/kernel/qapplication/modal/modal.pro index d9489928ba..05e5a7ada7 100644 --- a/tests/auto/widgets/kernel/qapplication/modal/modal.pro +++ b/tests/auto/widgets/kernel/qapplication/modal/modal.pro @@ -1,7 +1,4 @@ -TEMPLATE = app QT += widgets -DEPENDPATH += . -INCLUDEPATH += . SOURCES += main.cpp \ base.cpp DESTDIR = ./ diff --git a/tests/auto/widgets/kernel/qapplication/wincmdline/wincmdline.pro b/tests/auto/widgets/kernel/qapplication/wincmdline/wincmdline.pro index 8498d8b31d..3c3b2d0767 100644 --- a/tests/auto/widgets/kernel/qapplication/wincmdline/wincmdline.pro +++ b/tests/auto/widgets/kernel/qapplication/wincmdline/wincmdline.pro @@ -1,6 +1,3 @@ -TEMPLATE = app -DEPENDPATH += . -INCLUDEPATH += . QT += widgets SOURCES += main.cpp DESTDIR = ./ diff --git a/tests/auto/xml/sax/qxmlsimplereader/qxmlsimplereader.pro b/tests/auto/xml/sax/qxmlsimplereader/qxmlsimplereader.pro index dc579ab742..20559cec64 100644 --- a/tests/auto/xml/sax/qxmlsimplereader/qxmlsimplereader.pro +++ b/tests/auto/xml/sax/qxmlsimplereader/qxmlsimplereader.pro @@ -1,8 +1,7 @@ CONFIG += testcase TARGET = tst_qxmlsimplereader -TEMPLATE = app DEPENDPATH += parser -INCLUDEPATH += . parser +INCLUDEPATH += parser HEADERS += parser/parser.h SOURCES += tst_qxmlsimplereader.cpp parser/parser.cpp diff --git a/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro b/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro index af3be799c6..3cfb0b44de 100644 --- a/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro +++ b/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro @@ -1,7 +1,4 @@ -TEMPLATE = app TARGET = tst_bench_qdiriterator -DEPENDPATH += . -INCLUDEPATH += . QT = core testlib diff --git a/tests/benchmarks/corelib/kernel/qvariant/qvariant.pro b/tests/benchmarks/corelib/kernel/qvariant/qvariant.pro index 12d131f262..8ea7200d53 100644 --- a/tests/benchmarks/corelib/kernel/qvariant/qvariant.pro +++ b/tests/benchmarks/corelib/kernel/qvariant/qvariant.pro @@ -1,7 +1,4 @@ -TEMPLATE = app TARGET = tst_bench_qvariant -DEPENDPATH += . -INCLUDEPATH += . QT += testlib CONFIG += release diff --git a/tests/benchmarks/gui/animation/qanimation/qanimation.pro b/tests/benchmarks/gui/animation/qanimation/qanimation.pro index d72e3c87d9..a5859468f7 100644 --- a/tests/benchmarks/gui/animation/qanimation/qanimation.pro +++ b/tests/benchmarks/gui/animation/qanimation/qanimation.pro @@ -1,9 +1,6 @@ QT += widgets testlib -TEMPLATE = app TARGET = tst_bench_qanimation -DEPENDPATH += . -INCLUDEPATH += . CONFIG += release #CONFIG += debug diff --git a/tests/manual/qssloptions/qssloptions.pro b/tests/manual/qssloptions/qssloptions.pro index 3fcb696cd0..55d6dd049b 100644 --- a/tests/manual/qssloptions/qssloptions.pro +++ b/tests/manual/qssloptions/qssloptions.pro @@ -1,8 +1,5 @@ CONFIG += testcase -TEMPLATE = app TARGET = tst_qssloptions -DEPENDPATH += . -INCLUDEPATH += . QT -= gui QT += network testlib -- cgit v1.2.3 From 84614cabfaaab5eb4be04688a84cef8d79493f75 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 27 Apr 2012 14:01:08 +0200 Subject: add write_file() function this dumps the contents of a variable into a file. each element of the variable is considered a line; line terminators are added. all missing directories are automatically created. Change-Id: Idafeb873cea64e6705c894b3ab0ef21df69e7170 Reviewed-by: Marius Storm-Olsen --- tests/auto/tools/qmake/testdata/functions/functions.pro | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/tools/qmake/testdata/functions/functions.pro b/tests/auto/tools/qmake/testdata/functions/functions.pro index ad66ee863d..1da7fd923b 100644 --- a/tests/auto/tools/qmake/testdata/functions/functions.pro +++ b/tests/auto/tools/qmake/testdata/functions/functions.pro @@ -84,4 +84,18 @@ myTestFunction("oink baa moo") message("FAILED: myTestFunction: $$RESULT") } - +moo = "this is a test" "for real" +fn = $$OUT_PWD/testdir/afile +write_file($$fn, moo)|message("FAILED: write_file() failed") +exists($$fn)|message("FAILED: write_file() didn't write anything") +mooout = $$cat($$fn, line) +equals(moo, $$mooout)|message("FAILED: write_file() wrote something wrong") +moo += "another line" +write_file($$fn, moo)|message("FAILED: write_file() failed (take 2)") +mooout = $$cat($$fn, line) +equals(moo, $$mooout)|message("FAILED: write_file() wrote something wrong (take 2)") +mooadd = "yet another line" +write_file($$fn, mooadd, append)|message("FAILED: write_file() failed (append)") +moo += $$mooadd +mooout = $$cat($$fn, line) +equals(moo, $$mooout)|message("FAILED: write_file() wrote something wrong when appending") -- cgit v1.2.3 From 7da934d7768f425370b2de7c380bad481ecc65a6 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 5 Apr 2012 12:45:23 +0200 Subject: add mkpath() function Change-Id: I8809b9ee4e85fbe8cec95641d659f237c5f51a26 Reviewed-by: Marius Storm-Olsen --- tests/auto/tools/qmake/testdata/functions/functions.pro | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests') diff --git a/tests/auto/tools/qmake/testdata/functions/functions.pro b/tests/auto/tools/qmake/testdata/functions/functions.pro index 1da7fd923b..219e683e1f 100644 --- a/tests/auto/tools/qmake/testdata/functions/functions.pro +++ b/tests/auto/tools/qmake/testdata/functions/functions.pro @@ -99,3 +99,7 @@ write_file($$fn, mooadd, append)|message("FAILED: write_file() failed (append)") moo += $$mooadd mooout = $$cat($$fn, line) equals(moo, $$mooout)|message("FAILED: write_file() wrote something wrong when appending") + +pn = $$OUT_PWD/testpath/subdir +mkpath($$pn)|message("FAILED: mkpath() failed") +exists($$pn)|message("FAILED: mkpath() didn't create anything") -- cgit v1.2.3 From 6a66fef520d0fb2b8d507c3e91e03338fc39a57e Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 13 Mar 2012 17:15:27 +0100 Subject: add $$val_escape() function this quotes the elements of a variable in a way suitable for re-parsing as qmake code. Change-Id: I0e6ea2478c43b5aeff45f485a48ac8c86705dd4a Reviewed-by: Marius Storm-Olsen --- tests/auto/tools/qmake/testdata/functions/functions.pro | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests') diff --git a/tests/auto/tools/qmake/testdata/functions/functions.pro b/tests/auto/tools/qmake/testdata/functions/functions.pro index 219e683e1f..7792859327 100644 --- a/tests/auto/tools/qmake/testdata/functions/functions.pro +++ b/tests/auto/tools/qmake/testdata/functions/functions.pro @@ -1,5 +1,9 @@ CONFIG = qt thread +defineTest(testReplace) { + !isEqual(1, $$2):message("FAILED: $$3: got $$1, expected $${2}.") +} + #count !count( CONFIG, 2 ) { message( "FAILED: count function: $$CONFIG" ) @@ -103,3 +107,8 @@ equals(moo, $$mooout)|message("FAILED: write_file() wrote something wrong when a pn = $$OUT_PWD/testpath/subdir mkpath($$pn)|message("FAILED: mkpath() failed") exists($$pn)|message("FAILED: mkpath() didn't create anything") + +in = easy "less easy" sca$${LITERAL_HASH}ry crazy$$escape_expand(\\t\\r\\n) $$escape_expand(\\t)shit \'no\"way\\here +out = "easy \"less easy\" sca\$\${LITERAL_HASH}ry crazy\$\$escape_expand(\\\\t\\\\r\\\\n) \$\$escape_expand(\\\\t)shit \\\'no\\\"way\\\\here" +testReplace($$val_escape(in), $$out, "val_escape") + -- cgit v1.2.3 From bf984d5f24741a52a70024f3f43432307281f0ae Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 9 May 2012 15:29:25 +0200 Subject: add $$shadowed() function return the build directory corresponding to a given source directory. this is the identity function if not shadow-building. if input lies outside the source directory, return empty value. Change-Id: I2d2a6b1112bd19989fe29cfe19a12d39a0d208c1 Reviewed-by: Marius Storm-Olsen --- tests/auto/tools/qmake/testdata/functions/functions.pro | 1 + tests/auto/tools/qmake/tst_qmake.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/tools/qmake/testdata/functions/functions.pro b/tests/auto/tools/qmake/testdata/functions/functions.pro index 7792859327..0b70b24158 100644 --- a/tests/auto/tools/qmake/testdata/functions/functions.pro +++ b/tests/auto/tools/qmake/testdata/functions/functions.pro @@ -112,3 +112,4 @@ in = easy "less easy" sca$${LITERAL_HASH}ry crazy$$escape_expand(\\t\\r\\n) $$es out = "easy \"less easy\" sca\$\${LITERAL_HASH}ry crazy\$\$escape_expand(\\\\t\\\\r\\\\n) \$\$escape_expand(\\\\t)shit \\\'no\\\"way\\\\here" testReplace($$val_escape(in), $$out, "val_escape") +testReplace($$shadowed($$PWD/something), $$OUT_PWD/something, "shadowed") diff --git a/tests/auto/tools/qmake/tst_qmake.cpp b/tests/auto/tools/qmake/tst_qmake.cpp index 88ff10a764..1cdf0d7c7e 100644 --- a/tests/auto/tools/qmake/tst_qmake.cpp +++ b/tests/auto/tools/qmake/tst_qmake.cpp @@ -250,7 +250,8 @@ void tst_qmake::subdir_via_pro_file_extra_target() void tst_qmake::functions() { QString workDir = base_path + "/testdata/functions"; - QVERIFY( test_compiler.qmake( workDir, "functions" )); + QString buildDir = base_path + "/testdata/functions_build"; + QVERIFY( test_compiler.qmake( workDir, "functions", buildDir )); } void tst_qmake::operators() -- cgit v1.2.3 From 1261c9b2f483a63894f629cc0400970bd036239d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 3 Apr 2012 13:35:53 +0200 Subject: add $$format_number() function Change-Id: I04266c1f5fb72af94073f3f508cee59085e365b6 Reviewed-by: Marius Storm-Olsen --- tests/auto/tools/qmake/testdata/functions/functions.pro | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests') diff --git a/tests/auto/tools/qmake/testdata/functions/functions.pro b/tests/auto/tools/qmake/testdata/functions/functions.pro index 0b70b24158..2972128948 100644 --- a/tests/auto/tools/qmake/testdata/functions/functions.pro +++ b/tests/auto/tools/qmake/testdata/functions/functions.pro @@ -113,3 +113,17 @@ out = "easy \"less easy\" sca\$\${LITERAL_HASH}ry crazy\$\$escape_expand(\\\\t\\ testReplace($$val_escape(in), $$out, "val_escape") testReplace($$shadowed($$PWD/something), $$OUT_PWD/something, "shadowed") + +#format_number +spc = " " +testReplace($$format_number(13), 13, "simple number format") +testReplace($$format_number(-13), -13, "negative number format") +testReplace($$format_number(13, ibase=16), 19, "hex input number format") +testReplace($$format_number(13, obase=16), d, "hex output number format") +testReplace($$format_number(13, width=5), " $$spc 13", "right aligned number format") +testReplace($$format_number(13, width=5 leftalign), "13 $$spc ", "left aligned number format") +testReplace($$format_number(13, width=5 zeropad), "00013", "zero-padded number format") +testReplace($$format_number(13, width=5 alwayssign), "$$spc +13", "always signed number format") +testReplace($$format_number(13, width=5 alwayssign zeropad), "+0013", "zero-padded always signed number format") +testReplace($$format_number(13, width=5 padsign), " $$spc 13", "sign-padded number format") +testReplace($$format_number(13, width=5 padsign zeropad), " 0013", "zero-padded sign-padded number format") -- cgit v1.2.3 From f97913f2da5b4c46056b7d16ca30a3ae7874bbf7 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 20 Apr 2012 15:37:25 +0200 Subject: add $$clean_path() function just QDir::cleanPath() Change-Id: I2d51e2385939d8926c00f296537ab7f6757d9a79 Reviewed-by: Marius Storm-Olsen --- tests/auto/tools/qmake/testdata/functions/functions.pro | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/auto/tools/qmake/testdata/functions/functions.pro b/tests/auto/tools/qmake/testdata/functions/functions.pro index 2972128948..e5dde93a91 100644 --- a/tests/auto/tools/qmake/testdata/functions/functions.pro +++ b/tests/auto/tools/qmake/testdata/functions/functions.pro @@ -127,3 +127,5 @@ testReplace($$format_number(13, width=5 alwayssign), "$$spc +13", "always signed testReplace($$format_number(13, width=5 alwayssign zeropad), "+0013", "zero-padded always signed number format") testReplace($$format_number(13, width=5 padsign), " $$spc 13", "sign-padded number format") testReplace($$format_number(13, width=5 padsign zeropad), " 0013", "zero-padded sign-padded number format") + +testReplace($$clean_path("c:$${DIR_SEPARATOR}crazy//path/../trolls"), "c:/crazy/trolls", "clean_path") -- cgit v1.2.3 From d8e6c49bfafaa69a0bd4a36c8a8c9684a832a646 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 20 Apr 2012 15:38:43 +0200 Subject: add $$native_path() function more or less QDir::toNativeSeparators(QDir::cleanPath()) Change-Id: I52deee1e8086559eda5833b387a0cf64d21cbcd9 Reviewed-by: Marius Storm-Olsen --- tests/auto/tools/qmake/testdata/functions/functions.pro | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/auto/tools/qmake/testdata/functions/functions.pro b/tests/auto/tools/qmake/testdata/functions/functions.pro index e5dde93a91..39ba2ac9bb 100644 --- a/tests/auto/tools/qmake/testdata/functions/functions.pro +++ b/tests/auto/tools/qmake/testdata/functions/functions.pro @@ -129,3 +129,5 @@ testReplace($$format_number(13, width=5 padsign), " $$spc 13", "sign-padded numb testReplace($$format_number(13, width=5 padsign zeropad), " 0013", "zero-padded sign-padded number format") 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") -- cgit v1.2.3 From 09e01856b08c1b5ffd537b51b9a012eeeea70c3c Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 26 Apr 2012 13:19:53 +0200 Subject: add $$absolute_path() and $$relative_path() just exposes QDir::fooFilePath() wrapped into QDir::cleanPath() Change-Id: I7a7644084825fd8092a9910ac20f695c4d9351f6 Reviewed-by: Marius Storm-Olsen --- tests/auto/tools/qmake/testdata/functions/functions.pro | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests') diff --git a/tests/auto/tools/qmake/testdata/functions/functions.pro b/tests/auto/tools/qmake/testdata/functions/functions.pro index 39ba2ac9bb..426814466d 100644 --- a/tests/auto/tools/qmake/testdata/functions/functions.pro +++ b/tests/auto/tools/qmake/testdata/functions/functions.pro @@ -131,3 +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($$absolute_path("crazy/trolls"), "$$PWD/crazy/trolls", "absolute_path") +testReplace($$absolute_path("crazy/trolls", "/fake/path"), "/fake/path/crazy/trolls", "absolute_path with base") +testReplace($$relative_path($$_PRO_FILE_PWD_), $$basename($$_PRO_FILE_), "relative_path") +testReplace($$relative_path("/fake/trolls", "/fake/path"), "../trolls", "relative_path with base") -- cgit v1.2.3 From 083f7c501fa3d71160f139a0f37fa659424b4d97 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 20 Apr 2012 15:40:11 +0200 Subject: add $$shell_quote() function to be used in system() calls and when assembling EXTRA_COMPILER and INSTALLS .commands by hand. Change-Id: Id706cd56aa267a9fb4b14e3416692b4716fafa5b Reviewed-by: Marius Storm-Olsen --- tests/auto/tools/qmake/testdata/functions/functions.pro | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests') diff --git a/tests/auto/tools/qmake/testdata/functions/functions.pro b/tests/auto/tools/qmake/testdata/functions/functions.pro index 426814466d..5fcfd8c1ce 100644 --- a/tests/auto/tools/qmake/testdata/functions/functions.pro +++ b/tests/auto/tools/qmake/testdata/functions/functions.pro @@ -136,3 +136,11 @@ testReplace($$absolute_path("crazy/trolls"), "$$PWD/crazy/trolls", "absolute_pat testReplace($$absolute_path("crazy/trolls", "/fake/path"), "/fake/path/crazy/trolls", "absolute_path with base") testReplace($$relative_path($$_PRO_FILE_PWD_), $$basename($$_PRO_FILE_), "relative_path") testReplace($$relative_path("/fake/trolls", "/fake/path"), "../trolls", "relative_path with base") + +#this test is very rudimentary. the backend function is thoroughly tested in qt creator +in = "some nasty\" path\\" +win32: \ + out = "\"some nasty\"\\^\"\" path\"\\" +else: \ + out = "'some nasty\" path\\'" +testReplace($$shell_quote($$in), $$out, "shell_quote") -- cgit v1.2.3 From c85dc033dc58b06f1fc3cef6c2667f6516ac12b4 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 27 Apr 2012 11:51:55 +0200 Subject: add $$reverse() function returns the list with the order of the elements reversed. one can easily implement this with existing functions, but this is way faster and more readable. Change-Id: I12d306eb9fe58fc332622274ea6b658192529491 Reviewed-by: Joerg Bornemann --- tests/auto/tools/qmake/testdata/functions/functions.pro | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/auto/tools/qmake/testdata/functions/functions.pro b/tests/auto/tools/qmake/testdata/functions/functions.pro index 5fcfd8c1ce..9ec2ffe93f 100644 --- a/tests/auto/tools/qmake/testdata/functions/functions.pro +++ b/tests/auto/tools/qmake/testdata/functions/functions.pro @@ -144,3 +144,5 @@ win32: \ else: \ out = "'some nasty\" path\\'" testReplace($$shell_quote($$in), $$out, "shell_quote") + +testReplace($$reverse($$list(one two three)), three two one, "reverse") -- cgit v1.2.3 From 8b822825c5066957622194acf0fc267a6bf473fd Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 22 Mar 2012 12:40:00 +0100 Subject: make use of $$[FOO/get] properties this cleans up a lot of hacks supporting the build of qt, including the last bits of $QTDIR. Change-Id: Id119886ed8097967dad6cf86ebd4e71d90c42841 Reviewed-by: Joerg Bornemann --- tests/auto/corelib/plugin/qplugin/qplugin.pro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/corelib/plugin/qplugin/qplugin.pro b/tests/auto/corelib/plugin/qplugin/qplugin.pro index 37a12da732..e8840a0fb2 100644 --- a/tests/auto/corelib/plugin/qplugin/qplugin.pro +++ b/tests/auto/corelib/plugin/qplugin/qplugin.pro @@ -1,10 +1,10 @@ QT = core TEMPLATE = subdirs win32 { - exists($$[QT_INSTALL_LIBS]/QtCore4.dll) { + exists($$[QT_INSTALL_LIBS/get]/QtCore4.dll) { SUBDIRS = releaseplugin } - exists($$[QT_INSTALL_LIBS]/QtCored4.dll) { + exists($$[QT_INSTALL_LIBS/get]/QtCored4.dll) { SUBDIRS += debugplugin } } -- cgit v1.2.3