From 2515e1eb3d5ccc9da6fdb2a33dd776d4d2d2013e Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Wed, 20 Jan 2016 15:04:28 +0100 Subject: [PATCH] winrt: cleanup testcases We have to make sure that the plugins to be tested are located inside the virtual sandbox / relative to the application binary. Launching via winrtrunner, a test can find those plugins then. It is not possible to those via TESTDATA and extract them to temp, as LoadPackagedLibrary only loads inside the sandbox. Unfortunately this also implies that running those tests inside Visual Studio will fail, as Visual Studio copies the virtual sandbox to another location missing the plugins. For automated testing this should not matter though. Change-Id: I70f5ef2d56b3cf526b731fd885f12583c8f6e103 Reviewed-by: Oliver Wolff --- .../corelib/plugin/qfactoryloader/plugin1/plugin1.pro | 1 + .../corelib/plugin/qfactoryloader/plugin2/plugin2.pro | 1 + tests/auto/corelib/plugin/qfactoryloader/winrt.pri | 9 +++++++++ tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp | 6 ++++-- tests/auto/corelib/plugin/qpluginloader/lib/lib.pro | 1 + .../corelib/plugin/qpluginloader/theplugin/theplugin.pro | 1 + tests/auto/corelib/plugin/qpluginloader/winrt.pri | 9 +++++++++ tests/auto/corelib/plugin/quuid/tst_quuid.cpp | 2 ++ 8 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 tests/auto/corelib/plugin/qfactoryloader/winrt.pri create mode 100644 tests/auto/corelib/plugin/qpluginloader/winrt.pri diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro b/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro index 2496cd2f1e..fbc9f353d9 100644 --- a/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro +++ b/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro @@ -5,6 +5,7 @@ HEADERS = plugin1.h SOURCES = plugin1.cpp TARGET = $$qtLibraryTarget(plugin1) DESTDIR = ../bin +winrt:include(../winrt.pri) # This is testdata for the tst_qpluginloader test. target.path = $$[QT_INSTALL_TESTS]/tst_qfactoryloader/bin diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro b/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro index e70ed4fb25..4aa9bd0b95 100644 --- a/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro +++ b/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro @@ -5,6 +5,7 @@ HEADERS = plugin2.h SOURCES = plugin2.cpp TARGET = $$qtLibraryTarget(plugin2) DESTDIR = ../bin +winrt:include(../winrt.pri) # This is testdata for the tst_qpluginloader test. target.path = $$[QT_INSTALL_TESTS]/tst_qfactoryloader/bin diff --git a/tests/auto/corelib/plugin/qfactoryloader/winrt.pri b/tests/auto/corelib/plugin/qfactoryloader/winrt.pri new file mode 100644 index 0000000000..31602634b2 --- /dev/null +++ b/tests/auto/corelib/plugin/qfactoryloader/winrt.pri @@ -0,0 +1,9 @@ +# We cannot use TESTDATA as plugins have to reside physically +# inside the package directory +winrt { + CONFIG(debug, debug|release) { + DESTDIR = ../debug/bin + } else { + DESTDIR = ../release/bin + } +} diff --git a/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp b/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp index f31a7af6dd..9063ac38de 100644 --- a/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp +++ b/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp @@ -139,9 +139,11 @@ typedef int (*VersionFunction)(void); void tst_QLibrary::initTestCase() { +#ifndef Q_OS_WINRT // chdir to our testdata directory, and use relative paths in some tests. QString testdatadir = QFileInfo(QFINDTESTDATA("library_path")).absolutePath(); QVERIFY2(QDir::setCurrent(testdatadir), qPrintable("Could not chdir to " + testdatadir)); +#endif } void tst_QLibrary::version_data() @@ -417,7 +419,7 @@ void tst_QLibrary::loadHints_data() QString appDir = QCoreApplication::applicationDirPath(); lh |= QLibrary::ResolveAllSymbolsHint; -# if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) +# if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT) QTest::newRow( "ok01 (with suffix)" ) << appDir + "/mylib.dll" << int(lh) << true; QTest::newRow( "ok02 (with non-standard suffix)" ) << appDir + "/mylib.dl2" << int(lh) << true; QTest::newRow( "ok03 (with many dots)" ) << appDir + "/system.qt.test.mylib.dll" << int(lh) << true; @@ -469,7 +471,7 @@ void tst_QLibrary::fileName_data() QTest::newRow( "ok02" ) << sys_qualifiedLibraryName(QLatin1String("mylib")) << sys_qualifiedLibraryName(QLatin1String("mylib")); -#ifdef Q_OS_WIN +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) #ifndef Q_OS_WINCE QTest::newRow( "ok03" ) << "user32" << "USER32.dll"; diff --git a/tests/auto/corelib/plugin/qpluginloader/lib/lib.pro b/tests/auto/corelib/plugin/qpluginloader/lib/lib.pro index c74a00e9a6..51435b2266 100644 --- a/tests/auto/corelib/plugin/qpluginloader/lib/lib.pro +++ b/tests/auto/corelib/plugin/qpluginloader/lib/lib.pro @@ -4,6 +4,7 @@ CONFIG -= staticlib SOURCES = mylib.c TARGET = tst_qpluginloaderlib DESTDIR = ../bin +winrt:include(../winrt.pri) QT = core win32-msvc: DEFINES += WIN32_MSVC diff --git a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.pro b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.pro index 2ea9c27cc9..8acd58323c 100644 --- a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.pro +++ b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.pro @@ -6,6 +6,7 @@ SOURCES = theplugin.cpp #TARGET = $$qtLibraryTarget(theplugin) TARGET = theplugin DESTDIR = ../bin +winrt:include(../winrt.pri) QT = core # This is testdata for the tst_qpluginloader test. diff --git a/tests/auto/corelib/plugin/qpluginloader/winrt.pri b/tests/auto/corelib/plugin/qpluginloader/winrt.pri new file mode 100644 index 0000000000..31602634b2 --- /dev/null +++ b/tests/auto/corelib/plugin/qpluginloader/winrt.pri @@ -0,0 +1,9 @@ +# We cannot use TESTDATA as plugins have to reside physically +# inside the package directory +winrt { + CONFIG(debug, debug|release) { + DESTDIR = ../debug/bin + } else { + DESTDIR = ../release/bin + } +} diff --git a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp index f31aed6976..a40f226d59 100644 --- a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp +++ b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp @@ -94,9 +94,11 @@ void tst_QUuid::initTestCase() //"{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}"; uuidB = QUuid(0x1ab6e93a, 0xb1cb, 0x4a87, 0xba, 0x47, 0xec, 0x7e, 0x99, 0x03, 0x9a, 0x7b); +#ifndef QT_NO_PROCESS // chdir to the directory containing our testdata, then refer to it with relative paths QString testdata_dir = QFileInfo(QFINDTESTDATA("testProcessUniqueness")).absolutePath(); QVERIFY2(QDir::setCurrent(testdata_dir), qPrintable("Could not chdir to " + testdata_dir)); +#endif //"{3d813cbb-47fb-32ba-91df-831e1593ac29}"; http://www.rfc-editor.org/errata_search.php?rfc=4122&eid=1352 uuidC = QUuid(0x3d813cbb, 0x47fb, 0x32ba, 0x91, 0xdf, 0x83, 0x1e, 0x15, 0x93, 0xac, 0x29);