Skip to content
Snippets Groups Projects
Commit f07e31de authored by Adriaan de Groot's avatar Adriaan de Groot
Browse files

[partition] Test for basic legacy configuration

parent 13acdace
No related branches found
No related tags found
No related merge requests found
---
efiSystemPartitionSize: 100MiB
---
efiSystemPartitionSize: 100MB
...@@ -9,12 +9,13 @@ ...@@ -9,12 +9,13 @@
#include "Config.h" #include "Config.h"
#include "core/PartUtils.h"
#include "GlobalStorage.h" #include "GlobalStorage.h"
#include "JobQueue.h" #include "JobQueue.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/System.h" #include "utils/System.h"
#include "utils/Yaml.h"
#include "core/PartUtils.h"
#include <QObject> #include <QObject>
#include <QtTest/QtTest> #include <QtTest/QtTest>
...@@ -31,6 +32,7 @@ public: ...@@ -31,6 +32,7 @@ public:
private Q_SLOTS: private Q_SLOTS:
void initTestCase(); void initTestCase();
void testEmptyConfig(); void testEmptyConfig();
void testLegacySize();
}; };
ConfigTests::ConfigTests() = default; ConfigTests::ConfigTests() = default;
...@@ -38,7 +40,7 @@ ConfigTests::ConfigTests() = default; ...@@ -38,7 +40,7 @@ ConfigTests::ConfigTests() = default;
void void
ConfigTests::initTestCase() ConfigTests::initTestCase()
{ {
Logger::setupLogLevel( Logger::LOGDEBUG ); Logger::setupLogLevel( Logger::LOGVERBOSE );
// Ensure we have a system object, expect it to be a "bogus" one // Ensure we have a system object, expect it to be a "bogus" one
Calamares::System* system = Calamares::System::instance(); Calamares::System* system = Calamares::System::instance();
...@@ -60,8 +62,6 @@ ConfigTests::initTestCase() ...@@ -60,8 +62,6 @@ ConfigTests::initTestCase()
void void
ConfigTests::testEmptyConfig() ConfigTests::testEmptyConfig()
{ {
Logger::setupLogLevel( Logger::LOGVERBOSE );
Config c( nullptr ); Config c( nullptr );
c.setConfigurationMap( {} ); c.setConfigurationMap( {} );
...@@ -79,6 +79,43 @@ ConfigTests::testEmptyConfig() ...@@ -79,6 +79,43 @@ ConfigTests::testEmptyConfig()
QCOMPARE( gs->value( "efiSystemPartition" ).toString(), "/boot/efi" ); // Default QCOMPARE( gs->value( "efiSystemPartition" ).toString(), "/boot/efi" ); // Default
} }
void
ConfigTests::testLegacySize()
{
Config c( nullptr );
const auto* gs = Calamares::JobQueue::instanceGlobalStorage();
QVERIFY( gs );
// Config with just one legacy key
{
const auto file = QStringLiteral( BUILD_AS_TEST "/1a-legacy.conf" );
bool ok = false;
c.setConfigurationMap( Calamares::YAML::load( file, &ok ) );
cDebug() << "Tried to load" << file << "success?" << ok;
QVERIFY( ok );
QVERIFY( gs->value( PartUtils::efiFilesystemRecommendedSizeGSKey() ).isValid() ); // Something was filled in
QCOMPARE( PartUtils::efiFilesystemRecommendedSize(), 100_MiB ); // From config
QCOMPARE( PartUtils::efiFilesystemMinimumSize(), 100_MiB ); // Taken from config
}
// Different legacy key value
{
bool ok = false;
c.setConfigurationMap( Calamares::YAML::load( QStringLiteral( BUILD_AS_TEST "/1b-legacy.conf" ), &ok ) );
QVERIFY( ok );
QCOMPARE( PartUtils::efiFilesystemRecommendedSize(), 100000000 ); // From config, MB
QCOMPARE( PartUtils::efiFilesystemMinimumSize(), 100000000 ); // Taken from config
}
}
QTEST_GUILESS_MAIN( ConfigTests ) QTEST_GUILESS_MAIN( ConfigTests )
#include "utils/moc-warnings.h" #include "utils/moc-warnings.h"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment