[partition] Create KPM backend at start of test
This commit is contained in:
parent
3d0709c779
commit
1554c3a07c
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include "core/DeviceList.h"
|
#include "core/DeviceList.h"
|
||||||
|
|
||||||
|
#include "partition/KPMManager.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
#include <kpmcore/backend/corebackend.h>
|
#include <kpmcore/backend/corebackend.h>
|
||||||
@ -17,6 +18,8 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QtTest/QtTest>
|
#include <QtTest/QtTest>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
class DevicesTests : public QObject
|
class DevicesTests : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -27,9 +30,13 @@ public:
|
|||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void testKPMScanDevices();
|
void testKPMScanDevices();
|
||||||
void testPartUtilScanDevices();
|
void testPartUtilScanDevices();
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::unique_ptr< CalamaresUtils::Partition::KPMManager > m_d;
|
||||||
};
|
};
|
||||||
|
|
||||||
DevicesTests::DevicesTests() {}
|
DevicesTests::DevicesTests() : m_d( std::make_unique< CalamaresUtils::Partition::KPMManager >() )
|
||||||
|
{}
|
||||||
|
|
||||||
void
|
void
|
||||||
DevicesTests::testKPMScanDevices()
|
DevicesTests::testKPMScanDevices()
|
||||||
@ -39,7 +46,12 @@ DevicesTests::testKPMScanDevices()
|
|||||||
cDebug() << "Getting devices via KPMCore";
|
cDebug() << "Getting devices via KPMCore";
|
||||||
CoreBackend* backend = CoreBackendManager::self()->backend();
|
CoreBackend* backend = CoreBackendManager::self()->backend();
|
||||||
QVERIFY( backend );
|
QVERIFY( backend );
|
||||||
auto devices = backend->scanDevices(); // Whatever the default is /* not includeReadOnly, not includeLoopback */ ScanFlag( 0 ) );
|
#if defined( WITH_KPMCORE4API )
|
||||||
|
auto flags = ScanFlag( ~0 );
|
||||||
|
#else
|
||||||
|
auto flags = true;
|
||||||
|
#endif
|
||||||
|
auto devices = backend->scanDevices( flags ); // These flags try to get "all"
|
||||||
cDebug() << Logger::SubEntry << "Done getting devices.";
|
cDebug() << Logger::SubEntry << "Done getting devices.";
|
||||||
|
|
||||||
QVERIFY( devices.count() > 0 );
|
QVERIFY( devices.count() > 0 );
|
||||||
|
Loading…
Reference in New Issue
Block a user