Ignore test failure when reiser4 reports null UUID (#145)

The GitLab CI ubuntu_test job has occasionally been failing like this,
perhaps once every few weeks or so.

    [ RUN      ] My/SupportedFileSystemsTest.CreateAndReadUUID/reiser4
    test_SupportedFileSystems.cc:569: Failure
    Expected: (m_partition.uuid.size()) >= (9U), actual: 0 vs 9
    [  FAILED  ] My/SupportedFileSystemsTest.CreateAndReadUUID/reiser4, where GetParam() = 24 (17 ms)
    [----------] 1 test from My/SupportedFileSystemsTest (17 ms total)

Turns out there are 2 bugs in resier4progs.  One causes debugfs.reiser4
to report a null UUID if the first byte of the UUID happens to be zero
[1], and the other cases mkfs.resier4 to write a corrupted UUID,
sometimes a null (all zeros) UUID [2].

There is a 1 in 256 chance of getting a null UUID [2] when creating and
reading a reiser4 file system, hence the occasional failure of the CI
job.  The centos_test job isn't affected because CentOS doesn't have the
reiser4progs package.

Fix this by detecting when reiser4 reports a null UUID and assign a
dummy UUID to make the test pass.  This does mean that there is a 1 in
256 chance of not detecting a true failure.  However that still means
there is a 255 in 256 chance of detecting a true failure.  That's good
odds.  When a null UUID is detected for a reiser4 file system the test
output looks like this:

    [ RUN      ] My/SupportedFileSystemsTest.CreateAndReadUUID/reiser4
    test_SupportedFileSystems.cc:580: Ignore test failure of a null UUID.
    [       OK ] My/SupportedFileSystemsTest.CreateAndReadUUID/reiser4 (46 ms)

[1] 4802cdb18a
    Fix up repair_master_print()

[2] 44cc024f39
    Stop occasionally making file systems with null UUIDs

Closes #145 - Sporadic failure of test case
              My/SupportedFileSystemsTest.CreateAndReadUUID/reiser4
This commit is contained in:
Mike Fleetwood 2021-03-18 21:10:39 +00:00 committed by Curtis Gedak
parent 3d7c5db355
commit 975d9ecdc9
1 changed files with 12 additions and 0 deletions

View File

@ -228,6 +228,17 @@ const std::string param_fsname(const ::testing::TestParamInfo<FSType>& info)
} }
// Temporarily workaround bugs in mkfs.reiser4 and debugfs.reiser4 which occasionally
// create and read a null UUID respectively.
#define IGNORE_REISER4_NULL_UUID() \
if (m_fstype == FS_REISER4 && m_partition.uuid.size() == 0) \
{ \
std::cout << __FILE__ << ":" << __LINE__ << ": Ignore test " \
<< "failure of a null UUID." << std::endl; \
m_partition.uuid = "XXXXXXXXX"; \
}
const Byte_Value IMAGESIZE_Default = 256*MEBIBYTE; const Byte_Value IMAGESIZE_Default = 256*MEBIBYTE;
const Byte_Value IMAGESIZE_Larger = 512*MEBIBYTE; const Byte_Value IMAGESIZE_Larger = 512*MEBIBYTE;
@ -566,6 +577,7 @@ TEST_P(SupportedFileSystemsTest, CreateAndReadUUID)
// Test reading the UUID is successful. // Test reading the UUID is successful.
reload_partition(); reload_partition();
m_fs_object->read_uuid(m_partition); m_fs_object->read_uuid(m_partition);
IGNORE_REISER4_NULL_UUID();
EXPECT_GE(m_partition.uuid.size(), 9U); EXPECT_GE(m_partition.uuid.size(), 9U);
// Test messages from read operation are empty or print them. // Test messages from read operation are empty or print them.