From b27d4835c2ae0d8767ca914acb72a4bdcea6fc85 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 29 Jun 2016 15:40:17 +0200 Subject: fix error() not propagating through if() if() would simply "downgrade" a fatal error to a false condition, which is certainly not expected. Change-Id: Ie9c54f2bddf588856498bf795007b341b7c9363a Reviewed-by: Joerg Bornemann --- tests/auto/tools/qmakelib/evaltest.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/auto/tools/qmakelib/evaltest.cpp') diff --git a/tests/auto/tools/qmakelib/evaltest.cpp b/tests/auto/tools/qmakelib/evaltest.cpp index beafef5ad2..f172cda865 100644 --- a/tests/auto/tools/qmakelib/evaltest.cpp +++ b/tests/auto/tools/qmakelib/evaltest.cpp @@ -2103,6 +2103,12 @@ void tst_qmakelib::addTestFunctions(const QString &qindir) << "Project ERROR: World, you FAIL!" << false; + QTest::newRow("if(error())") + << "if(error(\\'World, you FAIL!\\')): OK = 1\nOKE = 1" + << "OK = UNDEF\nOKE = UNDEF" + << "Project ERROR: World, you FAIL!" + << false; + QTest::newRow("system()") << "system('" #ifdef Q_OS_WIN -- cgit v1.2.3 From 339b9706ccbed4063a92337c9994731793558b0a Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 29 Jun 2016 16:56:57 +0200 Subject: make error() propagate from custom replace functions it didn't, which is rather unexpected. Change-Id: I8cdb7b1490a8c2207809812b93cc65fbe23a1b98 Reviewed-by: Joerg Bornemann --- tests/auto/tools/qmakelib/evaltest.cpp | 66 ++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) (limited to 'tests/auto/tools/qmakelib/evaltest.cpp') diff --git a/tests/auto/tools/qmakelib/evaltest.cpp b/tests/auto/tools/qmakelib/evaltest.cpp index f172cda865..b7acf70e88 100644 --- a/tests/auto/tools/qmakelib/evaltest.cpp +++ b/tests/auto/tools/qmakelib/evaltest.cpp @@ -641,6 +641,72 @@ void tst_qmakelib::addControlStructs() << "VAR = final" << "" << true; + + QTest::newRow("error() from replace function (assignment)") + << "defineReplace(func) {\nerror(error)\n}\n" + "VAR = $$func()\n" + "OKE = 1" + << "VAR = UNDEF\nOKE = UNDEF" + << "Project ERROR: error" + << false; + + QTest::newRow("error() from replace function (replacement)") + << "defineReplace(func) {\nerror(error)\n}\n" + "VAR = $$func()\n" + "OKE = 1" + << "VAR = UNDEF\nOKE = UNDEF" + << "Project ERROR: error" + << false; + + QTest::newRow("error() from replace function (LHS)") + << "defineReplace(func) {\nerror(error)\nreturn(VAR)\n}\n" + "$$func() = 1\n" + "OKE = 1" + << "VAR = UNDEF\nOKE = UNDEF" + << "Project ERROR: error" + << false; + + QTest::newRow("error() from replace function (loop variable)") + << "defineReplace(func) {\nerror(error)\nreturn(BLAH)\n}\n" + "for($$func()) {\nVAR = $$BLAH\nbreak()\n}\n" + "OKE = 1" + << "VAR = UNDEF\nOKE = UNDEF" + << "Project ERROR: error" + << false; + + QTest::newRow("error() from replace function (built-in test arguments)") + << "defineReplace(func) {\nerror(error)\n}\n" + "message($$func()): VAR = 1\n" + "OKE = 1" + << "VAR = UNDEF\nOKE = UNDEF" + << "Project ERROR: error" + << false; + + QTest::newRow("error() from replace function (built-in replace arguments)") + << "defineReplace(func) {\nerror(error)\n}\n" + "VAR = $$upper($$func())\n" + "OKE = 1" + << "VAR = UNDEF\nOKE = UNDEF" + << "Project ERROR: error" + << false; + + QTest::newRow("error() from replace function (custom test arguments)") + << "defineReplace(func) {\nerror(error)\n}\n" + "defineTest(custom) {\n}\n" + "custom($$func()): VAR = 1\n" + "OKE = 1" + << "VAR = UNDEF\nOKE = UNDEF" + << "Project ERROR: error" + << false; + + QTest::newRow("error() from replace function (custom replace arguments)") + << "defineReplace(func) {\nerror(error)\nreturn(1)\n}\n" + "defineReplace(custom) {\nreturn($$1)\n}\n" + "VAR = $$custom($$func(1))\n" + "OKE = 1" + << "VAR = UNDEF\nOKE = UNDEF" + << "Project ERROR: error" + << false; } void tst_qmakelib::addReplaceFunctions(const QString &qindir) -- cgit v1.2.3 From 1b4ea11332f74984a62a4cc4597ad49f5b5269dc Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 30 Jun 2016 16:02:29 +0200 Subject: make error() propagate from requires() and REQUIRES= that can make sense if a function which determines the availability of a dependency fails to do so for unexpected reasons. Change-Id: If6cd113df25aee66830c120a2fab067c822a4543 Reviewed-by: Joerg Bornemann --- tests/auto/tools/qmakelib/evaltest.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests/auto/tools/qmakelib/evaltest.cpp') diff --git a/tests/auto/tools/qmakelib/evaltest.cpp b/tests/auto/tools/qmakelib/evaltest.cpp index b7acf70e88..934ee580ed 100644 --- a/tests/auto/tools/qmakelib/evaltest.cpp +++ b/tests/auto/tools/qmakelib/evaltest.cpp @@ -707,6 +707,20 @@ void tst_qmakelib::addControlStructs() << "VAR = UNDEF\nOKE = UNDEF" << "Project ERROR: error" << false; + + QTest::newRow("REQUIRES = error()") + << "REQUIRES = error(error)\n" + "OKE = 1" + << "OKE = UNDEF" + << "Project ERROR: error" + << false; + + QTest::newRow("requires(error())") + << "requires(error(error))\n" + "OKE = 1" + << "OKE = UNDEF" + << "Project ERROR: error" + << false; } void tst_qmakelib::addReplaceFunctions(const QString &qindir) -- cgit v1.2.3 From dacf3994ba29106132c3a377dba303acdb74daca Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 30 Jun 2016 17:26:01 +0200 Subject: fix custom functions inheriting other functions' arguments Task-number: QTBUG-41830 Change-Id: Iba3eee4975a1ee671b7190e52c0efc9a18147c62 Reviewed-by: Joerg Bornemann Reviewed-by: Lars Knoll Reviewed-by: Oswald Buddenhagen --- tests/auto/tools/qmakelib/evaltest.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests/auto/tools/qmakelib/evaltest.cpp') diff --git a/tests/auto/tools/qmakelib/evaltest.cpp b/tests/auto/tools/qmakelib/evaltest.cpp index 934ee580ed..f70ee683e2 100644 --- a/tests/auto/tools/qmakelib/evaltest.cpp +++ b/tests/auto/tools/qmakelib/evaltest.cpp @@ -599,6 +599,23 @@ void tst_qmakelib::addControlStructs() << "" << true; + QTest::newRow("function arguments") + << "defineTest(func) {\n" + "defined(1, var) {\nd1 = 1\nexport(d1)\n}\n" + "defined(3, var) {\nd3 = 1\nexport(d3)\n}\n" + "x1 = $$1\nexport(x1)\n" + "2 += foo\nx2 = $$2\nexport(x2)\n" + "x3 = $$3\nexport(x3)\n" + "4 += foo\nx4 = $$4\nexport(x4)\n" + "x5 = $$5\nexport(x5)\n" + "6 += foo\nx6 = $$6\nexport(x6)\n" + "}\n" + "1 = first\n2 = second\n3 = third\n4 = fourth\nfunc(one, two)" + << "1 = first\n2 = second\n3 = third\n4 = fourth\n5 = UNDEF\n6 = UNDEF\n" + "d1 = 1\nd3 = UNDEF\nx1 = one\nx2 = two foo\nx3 =\nx4 = foo\nx5 =\nx6 = foo" + << "" + << true; + QTest::newRow("ARGC and ARGS") << "defineTest(func) {\n" "export(ARGC)\n" -- cgit v1.2.3 From 3c8134958c66f40bb86588aa91b83bf58b5de0c9 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 5 Jul 2016 18:07:14 +0200 Subject: fix raw data leak in $$absolute_path() when the file name is empty, the path will be returned verbatim. this must be considered when constructing the return value. Task-number: QTBUG-54550 Change-Id: Ie108ed52275e66a154ef63bd6f7193f55b3e0454 Reviewed-by: Joerg Bornemann --- tests/auto/tools/qmakelib/evaltest.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/auto/tools/qmakelib/evaltest.cpp') diff --git a/tests/auto/tools/qmakelib/evaltest.cpp b/tests/auto/tools/qmakelib/evaltest.cpp index f70ee683e2..09482d86d9 100644 --- a/tests/auto/tools/qmakelib/evaltest.cpp +++ b/tests/auto/tools/qmakelib/evaltest.cpp @@ -2482,6 +2482,14 @@ void tst_qmakelib::proEval_data() "Project MESSAGE: assign split joined: word: this is a test:done\n" "Project MESSAGE: assign split quoted: word this is a test done" << true; + + // Raw data leak with empty file name. Verify with Valgrind or asan. + QTest::newRow("QTBUG-54550") + << "FULL = /there/is\n" + "VAR = $$absolute_path(, $$FULL/nothing/here/really)" + << "VAR = /there/is/nothing/here/really" + << "" + << true; } static QString formatValue(const ProStringList &vals) -- cgit v1.2.3