[partition] expect failures when kpm can't read the disk
This commit is contained in:
parent
1554c3a07c
commit
09491e4cbb
@ -20,6 +20,8 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
class DevicesTests : public QObject
|
class DevicesTests : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -33,9 +35,12 @@ private Q_SLOTS:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr< CalamaresUtils::Partition::KPMManager > m_d;
|
std::unique_ptr< CalamaresUtils::Partition::KPMManager > m_d;
|
||||||
|
bool m_isRoot = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
DevicesTests::DevicesTests() : m_d( std::make_unique< CalamaresUtils::Partition::KPMManager >() )
|
DevicesTests::DevicesTests()
|
||||||
|
: m_d( std::make_unique< CalamaresUtils::Partition::KPMManager >() )
|
||||||
|
, m_isRoot( geteuid() == 0 )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -54,6 +59,10 @@ DevicesTests::testKPMScanDevices()
|
|||||||
auto devices = backend->scanDevices( flags ); // These flags try to get "all"
|
auto devices = backend->scanDevices( flags ); // These flags try to get "all"
|
||||||
cDebug() << Logger::SubEntry << "Done getting devices.";
|
cDebug() << Logger::SubEntry << "Done getting devices.";
|
||||||
|
|
||||||
|
if ( !m_isRoot )
|
||||||
|
{
|
||||||
|
QEXPECT_FAIL( "", "Test invalid when not root", Continue );
|
||||||
|
}
|
||||||
QVERIFY( devices.count() > 0 );
|
QVERIFY( devices.count() > 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,6 +75,10 @@ DevicesTests::testPartUtilScanDevices()
|
|||||||
auto devices = PartUtils::getDevices();
|
auto devices = PartUtils::getDevices();
|
||||||
cDebug() << Logger::SubEntry << "Done getting devices.";
|
cDebug() << Logger::SubEntry << "Done getting devices.";
|
||||||
|
|
||||||
|
if ( !m_isRoot )
|
||||||
|
{
|
||||||
|
QEXPECT_FAIL( "", "Test invalid when not root", Continue );
|
||||||
|
}
|
||||||
QVERIFY( devices.count() > 0 );
|
QVERIFY( devices.count() > 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user