Add VDO tests converted from vdo-devel perl tests#5
Conversation
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>
|
currently this branch is based on PR #4 and incorporates those changes |
|
(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. |
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>
|
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. |
|
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. |
There was a problem hiding this comment.
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.
| raise AssertionError("VDO not online within 30 seconds") | ||
|
|
||
|
|
||
| def wait_until_packer_only(vdo): |
There was a problem hiding this comment.
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?)
| if status.vdo_status(dev)["index-state"] != "online": | ||
| raise AssertionError("VDO not online within 30 seconds") | ||
|
|
||
|
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| return tuple(int(p) for p in parts) | ||
|
|
||
|
|
||
| def _get_vdo_version(): |
There was a problem hiding this comment.
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.
| return None | ||
|
|
||
|
|
||
| def vdo_min_version(min_version_str): |
There was a problem hiding this comment.
Version comparison, similarly, seems potentially useful for any dm target.
| point removal on exit. | ||
| """ | ||
| if fs_class is None: | ||
| fs_class = Ext4 |
There was a problem hiding this comment.
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.
| @@ -3,8 +3,11 @@ | |||
| import dmtest.vdo.vdo_stack as vs | |||
There was a problem hiding this comment.
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}") |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.""" | |||
There was a problem hiding this comment.
We barely have sysfs parameters any more, right? Is it really worth adding sysfs tests?
| import dmtest.process as process | ||
|
|
||
|
|
||
| SECTOR_SIZE = 512 |
There was a problem hiding this comment.
I was just planning to add constants like "SECTOR_SIZE" to utils.py.
There was a problem hiding this comment.
I noticed since that it's already defined elsewhere
| @@ -0,0 +1,219 @@ | |||
| """VDO memory allocation failure test. | |||
There was a problem hiding this comment.
MemoryFail is such a huge test, might that be a better candidate for sts testing?
There was a problem hiding this comment.
It only works with our internal version; I sort of assumed STS tests would be applied mainly to released versions?
No description provided.