diff --git a/src/modules/partition/tests/CMakeLists.txt b/src/modules/partition/tests/CMakeLists.txt index bb0b59af4..2839270fb 100644 --- a/src/modules/partition/tests/CMakeLists.txt +++ b/src/modules/partition/tests/CMakeLists.txt @@ -44,12 +44,12 @@ calamares_add_test( calamares_add_test( partitioncreatelayoutstest SOURCES + CreateLayoutsTests.cpp ${PartitionModule_SOURCE_DIR}/core/KPMHelpers.cpp ${PartitionModule_SOURCE_DIR}/core/PartitionInfo.cpp ${PartitionModule_SOURCE_DIR}/core/PartitionLayout.cpp ${PartitionModule_SOURCE_DIR}/core/PartUtils.cpp ${PartitionModule_SOURCE_DIR}/core/DeviceModel.cpp - CreateLayoutsTests.cpp LIBRARIES kpmcore Calamares::calamaresui @@ -67,4 +67,7 @@ calamares_add_test( partitiondevicestest SOURCES DevicesTests.cpp + ${PartitionModule_SOURCE_DIR}/core/DeviceList.cpp + LIBRARIES + kpmcore ) diff --git a/src/modules/partition/tests/DevicesTests.cpp b/src/modules/partition/tests/DevicesTests.cpp index 82311b288..02b1dc62e 100644 --- a/src/modules/partition/tests/DevicesTests.cpp +++ b/src/modules/partition/tests/DevicesTests.cpp @@ -11,6 +11,9 @@ #include "utils/Logger.h" +#include +#include + #include #include @@ -33,14 +36,13 @@ DevicesTests::testKPMScanDevices() { Logger::setupLogLevel( Logger::LOGVERBOSE ); -#if defined( WITH_KPMCORE4API ) cDebug() << "Getting devices via KPMCore"; CoreBackend* backend = CoreBackendManager::self()->backend(); - DeviceList devices = backend->scanDevices( /* not includeReadOnly, not includeLoopback */ ScanFlag( 0 ) ); + QVERIFY( backend ); + auto devices = backend->scanDevices(); // Whatever the default is /* not includeReadOnly, not includeLoopback */ ScanFlag( 0 ) ); cDebug() << Logger::SubEntry << "Done getting devices."; -#else - cWarning() << "Test skipped; use KPMCore4"; -#endif + + QVERIFY( devices.count() > 0 ); } void @@ -49,8 +51,14 @@ DevicesTests::testPartUtilScanDevices() Logger::setupLogLevel( Logger::LOGVERBOSE ); cDebug() << "Getting devices via PartUtils"; - auto l = PartUtils::getDevices(); + auto devices = PartUtils::getDevices(); cDebug() << Logger::SubEntry << "Done getting devices."; - QVERIFY( l.count() > 0 ); + QVERIFY( devices.count() > 0 ); } + +QTEST_GUILESS_MAIN( DevicesTests ) + +#include "utils/moc-warnings.h" + +#include "DevicesTests.moc"