From 8e776d39ff9fbdf74422ab431a94c0aea6b98cfd Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Tue, 23 May 2017 09:46:36 +0200 Subject: Fix tst_qresourceengine for platforms with embedded test data load(resources) makes embedding the test data into the executable fail for platforms that use builtin test data. As the load call is only used to obtain QMAKE_RCC we can avoid that call by assuming that rcc was not renamed and assembling the path ourself. Change-Id: I25b982d10f5617d9a213803e7e4bcc85fc66b2e7 Reviewed-by: Maurice Kalinowski --- tests/auto/corelib/io/qresourceengine/qresourceengine.pro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/auto/corelib/io') diff --git a/tests/auto/corelib/io/qresourceengine/qresourceengine.pro b/tests/auto/corelib/io/qresourceengine/qresourceengine.pro index a39de3c4d5..7676b04a03 100644 --- a/tests/auto/corelib/io/qresourceengine/qresourceengine.pro +++ b/tests/auto/corelib/io/qresourceengine/qresourceengine.pro @@ -1,13 +1,13 @@ CONFIG += testcase TARGET = tst_qresourceengine -load(resources) + QT = core testlib SOURCES = tst_qresourceengine.cpp RESOURCES += testqrc/test.qrc runtime_resource.target = runtime_resource.rcc runtime_resource.depends = $$PWD/testqrc/test.qrc -runtime_resource.commands = $$QMAKE_RCC -root /runtime_resource/ -binary $${runtime_resource.depends} -o $${runtime_resource.target} +runtime_resource.commands = $$[QT_INSTALL_BINS]/rcc -root /runtime_resource/ -binary $${runtime_resource.depends} -o $${runtime_resource.target} QMAKE_EXTRA_TARGETS = runtime_resource PRE_TARGETDEPS += $${runtime_resource.target} QMAKE_DISTCLEAN += $${runtime_resource.target} -- cgit v1.2.3 From 5441f399af7880f3957751d1601354aaec802666 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Thu, 11 May 2017 11:50:11 +0200 Subject: Fix tst_QDir::emptyDir It is possible that tmpdir already exists as a leftover from previous tests. That is no reason for the test to fail. Change-Id: I010633fb92defb064093af9872ae6fd2178f07dd Reviewed-by: Friedemann Kleint Reviewed-by: Maurice Kalinowski --- tests/auto/corelib/io/qdir/tst_qdir.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'tests/auto/corelib/io') diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index 946620d61f..da948849f6 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -2322,8 +2322,11 @@ void tst_QDir::cdBelowRoot() void tst_QDir::emptyDir() { const QString tempDir = QDir::currentPath() + "/tmpdir/"; - QVERIFY(QDir().mkdir(tempDir)); - QVERIFY(QDir(tempDir).mkdir("emptyDirectory")); + QDir temp(tempDir); + if (!temp.exists()) { + QVERIFY(QDir().mkdir(tempDir)); + } + QVERIFY(temp.mkdir("emptyDirectory")); QDir testDir(tempDir + "emptyDirectory"); QVERIFY(testDir.isEmpty()); -- cgit v1.2.3 From 65a317e6745ee267bef7295f4dfe31d5ec62f7aa Mon Sep 17 00:00:00 2001 From: Thomas Sondergaard Date: Sun, 11 Jun 2017 18:41:57 +0200 Subject: Use QMap in QProcessEnvironment so variables are sorted The motivation for this change is to make it simple to pass a correctly sorted environment block to Win32 CreateProcess(). It is also nice in other contexts that the environment variables are sorted. The change is made for all platforms. This keeps it simple and the only ill effect is slightly slower lookups. Concerning the environment block passed to Win32 CreateProcess: The environment block that is passed to CreateProcess() must be sorted case-insensitively and without regard to locale. See https://msdn.microsoft.com/en-us/library/windows/desktop/ms682009(v=vs.85).aspx The need for sorting the environment block is also mentioned in the CreateProcess() documentation, but with less details: https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx Task-number: QTBUG-61315 Change-Id: Ie1edd443301de79cf5f699d45beab01b7c0f9de3 Reviewed-by: Thiago Macieira --- tests/auto/corelib/io/qprocess/tst_qprocess.cpp | 42 +++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'tests/auto/corelib/io') diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index 0783a65d8b..f4d6d5cb40 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -94,6 +94,7 @@ private slots: void setEnvironment(); void setProcessEnvironment_data(); void setProcessEnvironment(); + void environmentIsSorted(); void spaceInName(); void setStandardInputFile(); void setStandardOutputFile_data(); @@ -1733,6 +1734,47 @@ void tst_QProcess::setProcessEnvironment() } } +void tst_QProcess::environmentIsSorted() +{ + QProcessEnvironment env; + env.insert(QLatin1String("a"), QLatin1String("foo_a")); + env.insert(QLatin1String("B"), QLatin1String("foo_B")); + env.insert(QLatin1String("c"), QLatin1String("foo_c")); + env.insert(QLatin1String("D"), QLatin1String("foo_D")); + env.insert(QLatin1String("e"), QLatin1String("foo_e")); + env.insert(QLatin1String("F"), QLatin1String("foo_F")); + env.insert(QLatin1String("Path"), QLatin1String("foo_Path")); + env.insert(QLatin1String("SystemRoot"), QLatin1String("foo_SystemRoot")); + + const QStringList envlist = env.toStringList(); + +#ifdef Q_OS_WIN32 + // The environment block passed to CreateProcess "[Requires that] All strings in the + // environment block must be sorted alphabetically by name. The sort is case-insensitive, + // Unicode order, without regard to locale." + // https://msdn.microsoft.com/en-us/library/windows/desktop/ms682009(v=vs.85).aspx + // So on Windows we sort that way. + const QStringList expected = { QLatin1String("a=foo_a"), + QLatin1String("B=foo_B"), + QLatin1String("c=foo_c"), + QLatin1String("D=foo_D"), + QLatin1String("e=foo_e"), + QLatin1String("F=foo_F"), + QLatin1String("Path=foo_Path"), + QLatin1String("SystemRoot=foo_SystemRoot") }; +#else + const QStringList expected = { QLatin1String("B=foo_B"), + QLatin1String("D=foo_D"), + QLatin1String("F=foo_F"), + QLatin1String("Path=foo_Path"), + QLatin1String("SystemRoot=foo_SystemRoot"), + QLatin1String("a=foo_a"), + QLatin1String("c=foo_c"), + QLatin1String("e=foo_e") }; +#endif + QCOMPARE(envlist, expected); +} + void tst_QProcess::systemEnvironment() { QVERIFY(!QProcess::systemEnvironment().isEmpty()); -- cgit v1.2.3