[partition] Add test demonstrating size edge-case

This commit is contained in:
Adriaan de Groot 2023-11-13 21:32:05 +01:00
parent 5c0b20d06a
commit 12413ad9e8
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,5 @@
---
efi:
recommendedSize: 133MiB
minimumSize: 200MiB
label: "bigmin"

View File

@ -34,6 +34,7 @@ private Q_SLOTS:
void testEmptyConfig(); void testEmptyConfig();
void testLegacySize(); void testLegacySize();
void testAll(); void testAll();
void testWeirdConfig();
}; };
ConfigTests::ConfigTests() = default; ConfigTests::ConfigTests() = default;
@ -195,6 +196,31 @@ ConfigTests::testAll()
} }
} }
void
ConfigTests::testWeirdConfig()
{
Config c( nullptr );
auto* gs = Calamares::JobQueue::instanceGlobalStorage();
QVERIFY( gs );
// Config with an invalid minimum size
{
const auto file = QStringLiteral( BUILD_AS_TEST "/3a-min-too-large.conf" );
bool ok = false;
c.setConfigurationMap( Calamares::YAML::load( file, &ok ) );
cDebug() << "Tried to load" << file << "success?" << ok;
QVERIFY( ok );
QCOMPARE( PartUtils::efiFilesystemRecommendedSize(), 133_MiB );
QCOMPARE( PartUtils::efiFilesystemMinimumSize(), 133_MiB ); // Config setting was ignored
QCOMPARE( gs->value( "efiSystemPartitionName" ).toString(), QStringLiteral( "bigmin" ) );
}
}
QTEST_GUILESS_MAIN( ConfigTests ) QTEST_GUILESS_MAIN( ConfigTests )