Make ksycocadicttest work when sycoca does not exist yet.

Review Request #121972 - Created Jan. 10, 2015 and submitted

Information
Alex Merry
kservice
master
8bc0cf4...
Reviewers
kdeframeworks
dfaure

Using KServiceType::serviceType when the sycoca database does not yet
exist can lead to an assert in the KServiceTypeFactory constructor being
called, meaning we never get to the line where we rebuild sycoca.

rm -rf ~/.qttest; ./ksycocadicttest

Without this patch, this fails with:

********* Start testing of KSycocaDictTest *********
Config: Using QtTest library 5.4.0, Qt 5.4.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 4.9.2)
QDEBUG : KSycocaDictTest::initTestCase() ksycocadicttest(3942)/(kf5.kservice.sycoca) ?[31m?[34mKSycocaPrivate::openDatabase?[0m: Trying to open ksycoca from "/home/kde-devel/.qttest/cache/ksycoca5"
QDEBUG : KSycocaDictTest::initTestCase() ksycocadicttest(3942)/(kf5.kservice.sycoca) ?[31m?[34mKSycocaPrivate::openDatabase?[0m: Trying to open global ksycoca from  "/home/kde-devel/.qttest/share/kservices5/ksycoca5"
QDEBUG : KSycocaDictTest::initTestCase() ksycocadicttest(3942)/(kf5.kservice.sycoca) ?[31m?[34mKSycocaPrivate::openDatabase?[0m: Trying to open ksycoca from "/home/kde-devel/.qttest/cache/ksycoca5"
QDEBUG : KSycocaDictTest::initTestCase() ksycocadicttest(3942)/(kf5.kservice.sycoca) ?[31m?[34mKSycocaPrivate::openDatabase?[0m: Trying to open global ksycoca from  "/home/kde-devel/.qttest/share/kservices5/ksycoca5"
QDEBUG : KSycocaDictTest::initTestCase() ksycocadicttest(3942)/(kf5.kservice.sycoca) ?[31m?[34mKSycocaPrivate::openDatabase?[0m: Trying to open ksycoca from "/home/kde-devel/.qttest/cache/ksycoca5"
QDEBUG : KSycocaDictTest::initTestCase() ksycocadicttest(3942)/(kf5.kservice.sycoca) ?[31m?[34mKSycocaPrivate::openDatabase?[0m: Trying to open global ksycoca from  "/home/kde-devel/.qttest/share/kservices5/ksycoca5"
QDEBUG : KSycocaDictTest::initTestCase() ksycocadicttest(3942)/(kf5.kservice.sycoca) ?[31m?[34mKSycocaPrivate::checkDatabase?[0m: Still no database...
QFATAL : KSycocaDictTest::initTestCase() ksycocadicttest(3942)/(default) ?[31munknown?[0m: ASSERT failure in KServiceTypeFactory::KServiceTypeFactory(): "Could not open sycoca database, you must run kbuildsycoca first!", file /home/kde-devel/src/frameworks/kservice/src/services/kservicetypefactory.cpp, line 38
FAIL!  : KSycocaDictTest::initTestCase() Received a fatal error.
   Loc: [Unknown file(0)]
Totals: 0 passed, 1 failed, 0 skipped, 0 blacklisted
********* Finished testing of KSycocaDictTest *********

With the patch, it succeeds.

David Faure
David Faure
Alex Merry
Review request changed

Status: Closed (submitted)

Loading...