Skip to content

Add VDO tests converted from vdo-devel perl tests#5

Open
raeburn wants to merge 17 commits into
device-mapper-utils:mainfrom
raeburn:vdo-convert
Open

Add VDO tests converted from vdo-devel perl tests#5
raeburn wants to merge 17 commits into
device-mapper-utils:mainfrom
raeburn:vdo-convert

Conversation

@raeburn

@raeburn raeburn commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

raeburn added 2 commits June 2, 2026 01:01
The toml package is unmaintained. Use the stdlib tomllib (Python 3.11+)
for reading and the tomli_w package for writing.

Sort entries by test name before writing to test_dependencies.toml.

Assisted-by: Claude Opus 4.6 <claude-opus-4-6>
Assisted-by: Claude Opus 4.6 <claude-opus-4-6>
@raeburn

raeburn commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator Author

currently this branch is based on PR #4 and incorporates those changes

@raeburn

raeburn commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator Author

(sigh) Looks like the Claude-driven refactoring broke some intermediate versions, like changing full_tests.py to import get_free_blocks from stats.py in one commit, but the adding of get_free_blocks to stats.py happens later. Look for a regrouping of patches coming soon. The final contents should be the same though.

raeburn added 15 commits June 22, 2026 14:23
Use register() instead of register_batch() for single-test modules.

Assisted-by: Claude Sonnet 4.5 <claude-sonnet-4-5@20250929>
Assisted-by: Claude Sonnet 4.5 <claude-sonnet-4-5>
Move the function from compress_tests.py to utils.py so it can be
shared by other test modules.

Assisted-by: Claude Opus 4.6 <claude-opus-4-6>
Remove unnecessary udevadm settle calls from compress, dedupe, and
full tests. The dmtest framework handles device settling internally.

Assisted-by: Claude Opus 4.6 <claude-opus-4-6>
Add mounted_fs() for filesystem test setup with automatic cleanup,
SLAB_BITS_SMALL constant, VDO kernel module version checking helpers,
wait_until_packer_only() for compression testing, and fsync() utility.

Assisted-by: Claude Opus 4.6 <claude-opus-4-6>
Add basic_01 (write/read/dedupe), basic_fs_dedupe (filesystem-level
dedup verification), create_03 (device lifecycle stability), and
uds_timeout (UDS dedup timeout handling via dm-delay).

Assisted-by: Claude Opus 4.6 <claude-opus-4-6>
Add full boundary (precise fill-to-capacity), full_02 (direct and
cached parallel writes), full_03 (ENOSPC stress), and full_warn
(space warning thresholds). Includes gendatablocks O_DIRECT support
and stats helpers (get_free_blocks, get_usable_data_blocks).

Assisted-by: Claude Opus 4.6 <claude-opus-4-6>
Add direct_01 through direct_06 testing raw block device operations:
overwrites, discards, in-flight deduplication, dedup during overwrites,
and comprehensive I/O patterns.

Assisted-by: Claude Opus 4.6 <claude-opus-4-6>
Add compress_01 (merged into compress_tests), collide_01/02/03 (merged
into collide_tests), and in_flight_dedupe_and_compress. Includes
murmur3collide module for generating blocks with identical hashes.

Assisted-by: Claude Opus 4.6 <claude-opus-4-6>
Add gen_data_01 (serial write/verify), gen_data_02 (parallel
compression), gen_data_03 (space reclamation cycles), and gen_data_04
(parallel writes). Consolidates dataset helper functions.

Assisted-by: Claude Opus 4.6 <claude-opus-4-6>
Add discard_512 tests (uncompressed and compressed, merged into one
file) and zero block optimization tests (dedupe and discard).

Assisted-by: Claude Opus 4.6 <claude-opus-4-6>
Add compress_dedupe_flags, device_swap, dmsetup, dual (discard during
write), instance, load_failure (with mixed_zone_counts and
phys_zones_exceeds), major_minor, slab_count, sysfs, thread_config,
and vdo_rename tests.

Assisted-by: Claude Opus 4.6 <claude-opus-4-6>
Add grow_logical_01 (online growth), grow_logical_02 (filesystem
growth), grow_logical_03 (auto-grow), grow_physical_01 (basic/offline/
too-small), and grow_physical_03 (filesystem usability after growth).

Assisted-by: Claude Opus 4.6 <claude-opus-4-6>
Add vdo_format_in_kernel tests for kernel-side VDO formatting with
parameter validation and minimum size calculation. Includes VDO
kernel module version checking.

Assisted-by: Claude Opus 4.6 <claude-opus-4-6>
Add memory_fail_01 testing VDO behavior under memory allocation
failures during grow operations (requires kvdo module).

Assisted-by: Claude Opus 4.6 <claude-opus-4-6>
@raeburn

raeburn commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator Author

The newer push is basically the same total overall content (plus one bugfix, using "--force" with blkdiscard because one test issues calls in parallel), but regrouped to a more sensible patch set (no calling a function before introducing it).

Still based on PR #4.

@raeburn

raeburn commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator Author

Also this changeset really wants Hank's tagging feature so that we can specify that some of the tests should not be run by default, only if explicitly requested. A couple stress tests are really slow.

@lorelei-sakai lorelei-sakai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I didn't read the details of any of the new tests, just the general shape of the series. Some thoughts:

a) It's worth thinking about the right level for the various infrastructure improvements; several of them would be useful for any dm target, while others are more specific to VDO or even to particular tests. (I've called out some of these cases.)
b) I think infrastructure improvements and new test should not be in the same commits. Though I could see having a small series that is (infrastructure to implement certains tests / add the tests).
c) Some of the test grouping seem like catch-alls instead of logical grouping; in my opinion that makes it harder to properly evaluate any of the test (versus splitting them into separate commits).
d) It's probably also worth splitting the series as a whole by breaking out several smaller series in order to make review tractable, and so we can commit separate tests as they get approved.
e) For the specific tests, I think it's asking whether all of these tests are still valuable or whether we should cut down on the volume. Do we really need 3-4 variations on GenData tests? etc.
f) For test that are valuable, I think it's worth having more detail in the commit messages in order to help a reviewer understand which original perl tests are being migrated, what was changed, dropped, or consolidate compared to the original test, and why that's appropriate. As a reviewer, if I see a change in behavior between the original perl test and the new one, I would like to understand if it was intentional or not, and what the effect of the change is on our test coverage, and our test resource cost.

Comment thread src/dmtest/vdo/utils.py
raise AssertionError("VDO not online within 30 seconds")


def wait_until_packer_only(vdo):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we find a better name for this function? Especially if it's going to be in a generic utils location, it should really describe its goal so new test writers can know whether it's appropriate. (The expanded comment is good, can we capture some that idea in the function name?)

Comment thread src/dmtest/vdo/utils.py
if status.vdo_status(dev)["index-state"] != "online":
raise AssertionError("VDO not online within 30 seconds")


Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also a bit of hobbyhorse for me, but can you check for double blank lines? You've added them both before and after this new function.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's PEP 8, the Python coding style standard. Most but not all of dmtest outside of 'vdo' conforms. We should be following it.

Comment thread src/dmtest/vdo/utils.py
return tuple(int(p) for p in parts)


def _get_vdo_version():

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This version manipulation feels a little awkward (does returning the version as a tuple provide any real value, over,say, just an int?), but if this kind of version parsing is useful, it's probably better off being elevated to block_dev of something since it seems equally useful for any dm target.

Comment thread src/dmtest/vdo/utils.py
return None


def vdo_min_version(min_version_str):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version comparison, similarly, seems potentially useful for any dm target.

Comment thread src/dmtest/vdo/utils.py
point removal on exit.
"""
if fs_class is None:
fs_class = Ext4

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why use Ext4 as the default filesystem, when the Fedora default (iirc) is XFS?
This function also seesm like a utility that any dm target test could theoretically benefit from.

Comment thread src/dmtest/vdo/utils.py
@@ -3,8 +3,11 @@
import dmtest.vdo.vdo_stack as vs

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commit message makes this commit feel overstuffed, maybe break this into a couple smaller, clearer functional improvements? It also mentions wait_until_packer_only(), which is not here. (It's in a prior commit.)

byte_offset = self.block_size * self.offset
byte_size = self.block_size * self.block_count
process.run(f"blkdiscard -o {byte_offset} -l {byte_size} {self.path}")
process.run(f"blkdiscard --force -o {byte_offset} -l {byte_size} {self.path}")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's weird having tool improvements interspersed with new tests. I'd prefer to see tool and utility fixes and improvements described and justified on their own merits. I think it's too easy to overlook the broader implications of a change if it's not the main focus of the commit.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured this was a bugfix (to make concurrent invocations work) needed for one of the tests, not a significant improvement on its own.

@@ -0,0 +1,334 @@
"""Tests VDO sysfs interface."""

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We barely have sysfs parameters any more, right? Is it really worth adding sysfs tests?

import dmtest.process as process


SECTOR_SIZE = 512

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just planning to add constants like "SECTOR_SIZE" to utils.py.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed since that it's already defined elsewhere

@@ -0,0 +1,219 @@
"""VDO memory allocation failure test.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MemoryFail is such a huge test, might that be a better candidate for sts testing?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It only works with our internal version; I sort of assumed STS tests would be applied mainly to released versions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants