Add simple ext2 write tests: label, UUID, check and remove (!49)

Closes !49 - Add file system interface tests
This commit is contained in:
Mike Fleetwood 2019-07-26 21:11:51 +01:00 committed by Curtis Gedak
parent 571525084b
commit 1c6a594e8d
1 changed files with 55 additions and 0 deletions

View File

@ -343,6 +343,61 @@ TEST_F(ext2Test, CreateAndReadUUID)
}
TEST_F(ext2Test, CreateAndWriteLabel)
{
SKIP_IF_FS_DOESNT_SUPPORT(create);
SKIP_IF_FS_DOESNT_SUPPORT(write_label);
extra_setup();
m_partition.set_filesystem_label("FIRST");
ASSERT_TRUE(s_ext2_obj->create(m_partition, m_operation_detail)) << m_operation_detail;
// Test writing a label is successful.
m_partition.set_filesystem_label("SECOND");
ASSERT_TRUE(s_ext2_obj->write_label(m_partition, m_operation_detail)) << m_operation_detail;
}
TEST_F(ext2Test, CreateAndWriteUUID)
{
SKIP_IF_FS_DOESNT_SUPPORT(create);
SKIP_IF_FS_DOESNT_SUPPORT(write_uuid);
extra_setup();
ASSERT_TRUE(s_ext2_obj->create(m_partition, m_operation_detail)) << m_operation_detail;
// Test writing a new random UUID is successful.
ASSERT_TRUE(s_ext2_obj->write_uuid(m_partition, m_operation_detail)) << m_operation_detail;
}
TEST_F(ext2Test, CreateAndCheck)
{
SKIP_IF_FS_DOESNT_SUPPORT(create);
SKIP_IF_FS_DOESNT_SUPPORT(check);
extra_setup();
ASSERT_TRUE(s_ext2_obj->create(m_partition, m_operation_detail)) << m_operation_detail;
// Test checking the file system is successful.
ASSERT_TRUE(s_ext2_obj->check_repair(m_partition, m_operation_detail)) << m_operation_detail;
}
TEST_F(ext2Test, CreateAndRemove)
{
SKIP_IF_FS_DOESNT_SUPPORT(create);
SKIP_IF_FS_DOESNT_SUPPORT(remove);
extra_setup();
ASSERT_TRUE(s_ext2_obj->create(m_partition, m_operation_detail)) << m_operation_detail;
// Test removing the file system is successful. Note that most file systems don't
// implement remove so will skip this test.
ASSERT_TRUE(s_ext2_obj->remove(m_partition, m_operation_detail)) << m_operation_detail;
}
} // namespace GParted