summaryrefslogtreecommitdiffstats
path: root/tests/auto/tools
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2016-07-19 19:51:41 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2016-07-19 20:14:40 +0200
commit782ebeada125e3d8a293c7806e34cc737c30ddda (patch)
tree5516ad24a7532d650289758abd5e92a35bc2240e /tests/auto/tools
parent091df96fb8da356dc9de81dc390f55e66d4d7c01 (diff)
parent62cbb434579a56871f0917bc306d592055381c00 (diff)
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts: qmake/library/qmakebuiltins.cpp qmake/library/qmakeevaluator.cpp qmake/library/qmakeevaluator.h qmake/project.h QMakeEvaluator: * evaluateConditional(): one side changed return type, the other changed a parameter type. * split_value_list(): one side changed a parameter adjacent to where ... * expandVariableReferences(): ... the other killed one overload and changed the survivor src/corelib/io/qlockfile_unix.cpp One side changed a #if condition, the other moved NETBSD's part of what it controlled. src/corelib/tools/qdatetime.cpp One side fixed a reachable Q_UNREACHABLE in toMSecsSinceEpoch(), the other moved it from the private class to the public one, in the midst of the "short date-time" optimization, which confused diff entirely. One side changed a QStringLiteral to QLatin1String, the other rewrote adjoining code. src/network/kernel/qauthenticator.cpp Both rewrote a line, equivalently; kept the dev version. src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h One side changed #if-ery that the other removed. tools/configure/configureapp.cpp One side added a check to -target parsing; the other killed -target. tests/auto/testlib/selftests/expected_cmptest.lightxml tests/auto/testlib/selftests/expected_cmptest.teamcity tests/auto/testlib/selftests/expected_cmptest.txt tests/auto/testlib/selftests/expected_cmptest.xml tests/auto/testlib/selftests/expected_cmptest.xunitxml Regenerated using generate_expected_output.py I note that quite a few other expected_* come out changed, now. There was no git-conflict in src/widgets/kernel/qformlayout.cpp but it didn't compile; one side removed some unused methods; the other found uses for one of them. Put FixedColumnMatrix<>::removeRow(int) back for its new user. Change-Id: I8cc2a71add48c0a848e13cfc47b5a7754e8ca584
Diffstat (limited to 'tests/auto/tools')
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp9
-rw-r--r--tests/auto/tools/qmakelib/evaltest.cpp111
-rw-r--r--tests/auto/tools/qmakelib/parsertest.cpp7
3 files changed, 126 insertions, 1 deletions
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index 9fdd37ea9b..d5d8a2ecaa 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -1930,6 +1930,13 @@ void tst_Moc::warnings_data()
<< 1
<< QString("IGNORE_ALL_STDOUT")
<< QString(":2: Error: Macro invoked with too few parameters for a use of '#'");
+
+ QTest::newRow("QTBUG-54609: crash on invalid input")
+ << QByteArray::fromBase64("EAkJCQkJbGFzcyBjbGFzcyBiYWkcV2kgTUEKcGYjZGVmaW5lIE1BKFEs/4D/FoQ=")
+ << QStringList()
+ << 1
+ << QString("IGNORE_ALL_STDOUT")
+ << QString(":-1: Error: Unexpected character in macro argument list.");
}
void tst_Moc::warnings()
@@ -1945,7 +1952,7 @@ void tst_Moc::warnings()
#ifdef Q_CC_MSVC
// for some reasons, moc compiled with MSVC uses a different output format
- QRegExp lineNumberRe(":(\\d+):");
+ QRegExp lineNumberRe(":(-?\\d+):");
lineNumberRe.setMinimal(true);
expectedStdErr.replace(lineNumberRe, "(\\1):");
#endif
diff --git a/tests/auto/tools/qmakelib/evaltest.cpp b/tests/auto/tools/qmakelib/evaltest.cpp
index d4959a4f63..21c1759b08 100644
--- a/tests/auto/tools/qmakelib/evaltest.cpp
+++ b/tests/auto/tools/qmakelib/evaltest.cpp
@@ -594,6 +594,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"
@@ -636,6 +653,86 @@ 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;
+
+ 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)
@@ -2255,6 +2352,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
@@ -2531,6 +2634,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)
diff --git a/tests/auto/tools/qmakelib/parsertest.cpp b/tests/auto/tools/qmakelib/parsertest.cpp
index 6857334746..dc92f98f45 100644
--- a/tests/auto/tools/qmakelib/parsertest.cpp
+++ b/tests/auto/tools/qmakelib/parsertest.cpp
@@ -1867,6 +1867,13 @@ void tst_qmakelib::addParseAbuse()
/* 24 */ /* else branch */ << I(0))
<< "in:1: OR operator without prior condition."
<< false;
+
+ // Token buffer overflow. Verify with Valgrind or asan.
+ QTest::newRow("QTCREATORBUG-16508")
+ << "a{b{c{d{"
+ << TS()
+ << "in:2: Missing closing brace(s)."
+ << false;
}
void tst_qmakelib::proParser_data()