Add a (failing for now) test for extended partitions
This reproduces bug #28
This commit is contained in:
parent
43f29b8058
commit
6f65a4b16c
@ -80,14 +80,14 @@ JobTests::initTestCase()
|
|||||||
void
|
void
|
||||||
JobTests::testPartitionTable()
|
JobTests::testPartitionTable()
|
||||||
{
|
{
|
||||||
queuePartitionTableCreation();
|
queuePartitionTableCreation( PartitionTable::gpt );
|
||||||
m_runner.run();
|
m_runner.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
JobTests::queuePartitionTableCreation()
|
JobTests::queuePartitionTableCreation( PartitionTable::TableType type)
|
||||||
{
|
{
|
||||||
auto job = new CreatePartitionTableJob( m_device.data(), PartitionTable::gpt );
|
auto job = new CreatePartitionTableJob( m_device.data(), type );
|
||||||
job->updatePreview();
|
job->updatePreview();
|
||||||
m_queue.enqueue( job_ptr( job ) );
|
m_queue.enqueue( job_ptr( job ) );
|
||||||
}
|
}
|
||||||
@ -128,7 +128,7 @@ Partition* firstFreePartition( PartitionNode* parent )
|
|||||||
void
|
void
|
||||||
JobTests::testCreatePartition()
|
JobTests::testCreatePartition()
|
||||||
{
|
{
|
||||||
queuePartitionTableCreation();
|
queuePartitionTableCreation( PartitionTable::gpt );
|
||||||
CreatePartitionJob* job;
|
CreatePartitionJob* job;
|
||||||
|
|
||||||
Partition* partition = firstFreePartition( m_device->partitionTable() );
|
Partition* partition = firstFreePartition( m_device->partitionTable() );
|
||||||
@ -137,13 +137,40 @@ JobTests::testCreatePartition()
|
|||||||
job->updatePreview();
|
job->updatePreview();
|
||||||
m_queue.enqueue( job_ptr( job ) );
|
m_queue.enqueue( job_ptr( job ) );
|
||||||
|
|
||||||
|
partition = firstFreePartition( m_device->partitionTable() );
|
||||||
job = newCreatePartitionJob( partition, PartitionRole( PartitionRole::Primary ), FileSystem::LinuxSwap, 10 * MB);
|
job = newCreatePartitionJob( partition, PartitionRole( PartitionRole::Primary ), FileSystem::LinuxSwap, 10 * MB);
|
||||||
job->updatePreview();
|
job->updatePreview();
|
||||||
m_queue.enqueue( job_ptr( job ) );
|
m_queue.enqueue( job_ptr( job ) );
|
||||||
|
|
||||||
|
partition = firstFreePartition( m_device->partitionTable() );
|
||||||
job = newCreatePartitionJob( partition, PartitionRole( PartitionRole::Primary ), FileSystem::Btrfs, 10 * MB);
|
job = newCreatePartitionJob( partition, PartitionRole( PartitionRole::Primary ), FileSystem::Btrfs, 10 * MB);
|
||||||
job->updatePreview();
|
job->updatePreview();
|
||||||
m_queue.enqueue( job_ptr( job ) );
|
m_queue.enqueue( job_ptr( job ) );
|
||||||
|
|
||||||
m_runner.run();
|
m_runner.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
JobTests::testCreatePartitionExtended()
|
||||||
|
{
|
||||||
|
queuePartitionTableCreation( PartitionTable::msdos );
|
||||||
|
CreatePartitionJob* job;
|
||||||
|
|
||||||
|
Partition* partition = firstFreePartition( m_device->partitionTable() );
|
||||||
|
job = newCreatePartitionJob( partition, PartitionRole( PartitionRole::Primary ), FileSystem::Ext4, 10 * MB);
|
||||||
|
QVERIFY( job );
|
||||||
|
job->updatePreview();
|
||||||
|
m_queue.enqueue( job_ptr( job ) );
|
||||||
|
|
||||||
|
partition = firstFreePartition( m_device->partitionTable() );
|
||||||
|
job = newCreatePartitionJob( partition, PartitionRole( PartitionRole::Extended ), FileSystem::Unformatted, 10 * MB);
|
||||||
|
job->updatePreview();
|
||||||
|
m_queue.enqueue( job_ptr( job ) );
|
||||||
|
Partition* extendedPartition = job->partition();
|
||||||
|
|
||||||
|
job = newCreatePartitionJob( firstFreePartition( extendedPartition ), PartitionRole( PartitionRole::Logical ), FileSystem::Ext4, 10 * MB);
|
||||||
|
job->updatePreview();
|
||||||
|
m_queue.enqueue( job_ptr( job ) );
|
||||||
|
|
||||||
|
m_runner.run();
|
||||||
|
}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <core/device.h>
|
#include <core/device.h>
|
||||||
#include <core/partition.h>
|
#include <core/partition.h>
|
||||||
#include <core/partitionrole.h>
|
#include <core/partitionrole.h>
|
||||||
|
#include <core/partitiontable.h>
|
||||||
#include <fs/filesystem.h>
|
#include <fs/filesystem.h>
|
||||||
|
|
||||||
// Qt
|
// Qt
|
||||||
@ -37,13 +38,14 @@ private Q_SLOTS:
|
|||||||
void initTestCase();
|
void initTestCase();
|
||||||
void testPartitionTable();
|
void testPartitionTable();
|
||||||
void testCreatePartition();
|
void testCreatePartition();
|
||||||
|
void testCreatePartitionExtended();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer< Device > m_device;
|
QScopedPointer< Device > m_device;
|
||||||
Calamares::JobQueue m_queue;
|
Calamares::JobQueue m_queue;
|
||||||
QueueRunner m_runner;
|
QueueRunner m_runner;
|
||||||
|
|
||||||
void queuePartitionTableCreation();
|
void queuePartitionTableCreation( PartitionTable::TableType type );
|
||||||
CreatePartitionJob* newCreatePartitionJob( Partition* freeSpacePartition, PartitionRole, FileSystem::Type type, qint64 size );
|
CreatePartitionJob* newCreatePartitionJob( Partition* freeSpacePartition, PartitionRole, FileSystem::Type type, qint64 size );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user