[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: [kio] /: unittest: set the qhash-related env vars in a global ctor function, to ensure they are 
From:       Christoph Feck <cfeck () kde ! org>
Date:       2015-08-15 22:41:17
Message-ID: 201508160041.17365.cfeck () kde ! org
[Download RAW message or body]

On Saturday 15 August 2015 09:37:32 David Faure wrote:
> Git commit 31161e0156db35a7cc23aa7c801b013b68939b89 by David 
Faure.
> Committed on 15/08/2015 at 07:37.
> Pushed by dfaure into branch 'master'.
> 
> unittest: set the qhash-related env vars in a global ctor function,
> to ensure they are set early enough
> 
> Change-Id: I78f45b0112ab8694e872e916e99d1990003f33eb
> 
> M  +7    -7    autotests/kfileplacesmodeltest.cpp
> M  +6    -0    src/filewidgets/kfileplacesmodel.cpp
> 
> 
http://commits.kde.org/kio/31161e0156db35a7cc23aa7c801b013b68939b89
> 
> diff --git a/autotests/kfileplacesmodeltest.cpp
> b/autotests/kfileplacesmodeltest.cpp index 0f8aa3e..6db61a4 100644
> --- a/autotests/kfileplacesmodeltest.cpp
> +++ b/autotests/kfileplacesmodeltest.cpp
> @@ -38,10 +38,13 @@
>  #define KDE_ROOT_PATH "/"
>  #endif
> 
> -QT_BEGIN_NAMESPACE
>  // Avoid QHash randomization so that the order of the devices is
> stable -extern Q_CORE_EXPORT QBasicAtomicInt qt_qhash_seed; //
> from qhash.cpp -QT_END_NAMESPACE
> +static void seedInit()
> +{
> +    qputenv("QT_HASH_SEED", 0);
> +    qputenv("QT_NO_CPU_FEATURE", "1");
> +}
> +Q_CONSTRUCTOR_FUNCTION(seedInit)
> 
>  class KFilePlacesModelTest : public QObject
>  {
> @@ -82,10 +85,6 @@ static QString bookmarksFile()
> 
>  void KFilePlacesModelTest::initTestCase()
>  {
> -    // Ensure ordering stability from QSet
> -    qt_qhash_seed.fetchAndStoreRelaxed(0);
> -    qputenv("QT_NO_CPU_FEATURE", "1");
> -
>      qputenv("KDE_FORK_SLAVES", "yes"); // to avoid a runtime
> dependency on klauncher QStandardPaths::setTestModeEnabled(true);
> 
> @@ -174,6 +173,7 @@ static const QStringList initialListOfUrls()
>  void KFilePlacesModelTest::testInitialList()
>  {
>      const QStringList urls = initialListOfUrls();
> +    qDebug() << placesUrls();
>      CHECK_PLACES_URLS(urls);
>  }
> 
> diff --git a/src/filewidgets/kfileplacesmodel.cpp
> b/src/filewidgets/kfileplacesmodel.cpp index 93b9692..6995a3e
> 100644
> --- a/src/filewidgets/kfileplacesmodel.cpp
> +++ b/src/filewidgets/kfileplacesmodel.cpp
> @@ -305,6 +305,7 @@ QModelIndex 
KFilePlacesModel::closestItem(const
> QUrl &url) const
> 
>  void KFilePlacesModel::Private::_k_initDeviceList()
>  {
> +    qDebug() << this;
>      Solid::DeviceNotifier *notifier =
> Solid::DeviceNotifier::instance();
> 
>      connect(notifier, SIGNAL(deviceAdded(QString)),
> @@ -315,6 +316,11 @@ void
> KFilePlacesModel::Private::_k_initDeviceList() const
> QList<Solid::Device> &deviceList =
> Solid::Device::listFromQuery(predicate);
> 
>      foreach (const Solid::Device &device, deviceList) {
> +        QString path;
> +        const Solid::StorageAccess *access =
> device.as<Solid::StorageAccess>(); +        if (access) { path =
> access->filePath(); }
> +        qDebug() << device.udi() << device.description() << path;
> +
>          availableDevices << device.udi();
>      }

Is the new debugging code in kfileplacesmodel.cpp intentional?
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic