From 1554c3a07cbf3779589d923778e0811e56bef1f2 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 31 Aug 2021 13:54:23 +0200 Subject: [PATCH] [partition] Create KPM backend at start of test --- src/modules/partition/tests/DevicesTests.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/modules/partition/tests/DevicesTests.cpp b/src/modules/partition/tests/DevicesTests.cpp index 02b1dc62e..6d42e71e4 100644 --- a/src/modules/partition/tests/DevicesTests.cpp +++ b/src/modules/partition/tests/DevicesTests.cpp @@ -9,6 +9,7 @@ #include "core/DeviceList.h" +#include "partition/KPMManager.h" #include "utils/Logger.h" #include @@ -17,6 +18,8 @@ #include #include +#include + class DevicesTests : public QObject { Q_OBJECT @@ -27,9 +30,13 @@ public: private Q_SLOTS: void testKPMScanDevices(); void testPartUtilScanDevices(); + +private: + std::unique_ptr< CalamaresUtils::Partition::KPMManager > m_d; }; -DevicesTests::DevicesTests() {} +DevicesTests::DevicesTests() : m_d( std::make_unique< CalamaresUtils::Partition::KPMManager >() ) +{} void DevicesTests::testKPMScanDevices() @@ -39,7 +46,12 @@ DevicesTests::testKPMScanDevices() cDebug() << "Getting devices via KPMCore"; CoreBackend* backend = CoreBackendManager::self()->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."; QVERIFY( devices.count() > 0 );