summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKari Oikarinen <kari.oikarinen@qt.io>2018-02-28 09:26:54 +0200
committerKari Oikarinen <kari.oikarinen@qt.io>2018-03-02 07:20:04 +0000
commit810bc3fb1942fa241c7ca263aec6eb53085003bf (patch)
tree5a1ccd8b648ee1cbb9e5ad0366fec80204e12b64 /tests
parent4e02c8d5b89966a97703b6fe548937b9e94f7441 (diff)
tst_QLibrary: Ensure installation order of testdata libs
This test executable was not flaky in the normal sense that when run, it sometimes passes and sometimes fails. Instead, in some builds it would fail consistently and in some builds it would pass consistently. The first test to fail was version(ok00, default to last version) which gives "mylib" as the library name and -1 as the library version. The description implies that QLibrary selects the biggest or last used version when given -1. However, versions less than 0 are not used at all. Instead the loading uses only the name to select the library. Change the description to match. So why did the test sometimes pass, sometimes fail? The test uses two library projects lib and lib2 which install two different major versions of libmylib. That includes the symbolic links: libmylib.so -> libmylib.so.1.0.0* libmylib.so.1 -> libmylib.so.1.0.0* libmylib.so.1.0 -> libmylib.so.1.0.0* libmylib.so.1.0.0* libmylib.so -> libmylib.so.2.0.0* libmylib.so.2 -> libmylib.so.2.0.0* libmylib.so.2.0 -> libmylib.so.2.0.0* libmylib.so.2.0.0* The key thing being that both set the libmylib.so symbolic link. In a multithreaded installation it's undefined which happens to set the link last. The test code expected libmylib.so to point to libmylib.so.2.0.0. Ensure that by building and installing lib2 after lib. Task-number: QTBUG-66722 Task-number: QTBUG-66216 Change-Id: Ic513c772902273049c28e43fc1d83d550aafcd23 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/plugin/qlibrary/qlibrary.pro3
-rw-r--r--tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp2
2 files changed, 4 insertions, 1 deletions
diff --git a/tests/auto/corelib/plugin/qlibrary/qlibrary.pro b/tests/auto/corelib/plugin/qlibrary/qlibrary.pro
index 44f791f582..ec230601c4 100644
--- a/tests/auto/corelib/plugin/qlibrary/qlibrary.pro
+++ b/tests/auto/corelib/plugin/qlibrary/qlibrary.pro
@@ -2,6 +2,9 @@ QT = core
TEMPLATE = subdirs
tst.depends = lib lib2
+# lib2 has to be installed after lib, so that plain libmylib.so symlink points
+# to version 2 as expected by the test
+lib2.depends = lib
SUBDIRS = lib \
lib2 \
diff --git a/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp b/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp
index 16177bb0b7..72d60d71c7 100644
--- a/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp
+++ b/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp
@@ -149,7 +149,7 @@ void tst_QLibrary::version_data()
QTest::newRow( "ok00, version 1" ) << "mylib" << 1 << 1;
QTest::newRow( "ok00, version 2" ) << "mylib" << 2 << 2;
- QTest::newRow( "ok00, default to last version" ) << "mylib" << -1 << 2;
+ QTest::newRow( "ok00, load without version" ) << "mylib" << -1 << 2;
}
void tst_QLibrary::version()