From 810bc3fb1942fa241c7ca263aec6eb53085003bf Mon Sep 17 00:00:00 2001 From: Kari Oikarinen Date: Wed, 28 Feb 2018 09:26:54 +0200 Subject: 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 Reviewed-by: Thiago Macieira --- tests/auto/corelib/plugin/qlibrary/qlibrary.pro | 3 +++ tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'tests/auto/corelib') 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() -- cgit v1.2.3