Skip to content

Commit

Permalink
xfstests: add new generic xfstests for ext4 filesystem (#3527)
Browse files Browse the repository at this point in the history
* add generic xfstests for ext4 filesystem

* fix formatting
  • Loading branch information
realsdx authored Nov 22, 2024
1 parent fa952fe commit 2951df2
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 3 deletions.
71 changes: 71 additions & 0 deletions microsoft/testsuites/xfstests/xfstesting.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,44 @@ def verify_generic_standard_datadisk(
excluded_tests=self.excluded_tests,
)

@TestCaseMetadata(
description="""
This test case will run generic xfstests testing against
standard data disk with ext4 type system.
""",
requirement=simple_requirement(
disk=schema.DiskOptionSettings(
data_disk_type=schema.DiskType.StandardHDDLRS,
os_disk_type=schema.DiskType.StandardHDDLRS,
data_disk_iops=500,
data_disk_count=search_space.IntRange(min=1),
),
unsupported_os=[BSD, Windows],
),
timeout=TIME_OUT,
use_new_environment=True,
priority=3,
)
def verify_generic_ext4_standard_datadisk(
self, log_path: Path, result: TestResult
) -> None:
environment = result.environment
assert environment, "fail to get environment from testresult"
node = cast(RemoteNode, environment.nodes[0])
xfstests = self._install_xfstests(node)
disk = node.features[Disk]
data_disks = disk.get_raw_data_disks()
self._execute_xfstests(
log_path,
xfstests,
result,
data_disks[0],
f"{data_disks[0]}1",
f"{data_disks[0]}2",
file_system=FileSystem.ext4,
excluded_tests=self.excluded_tests,
)

@TestCaseMetadata(
description="""
This test case will run xfs xfstests testing against
Expand Down Expand Up @@ -320,6 +358,38 @@ def verify_generic_nvme_datadisk(self, log_path: Path, result: TestResult) -> No
excluded_tests=self.excluded_tests,
)

@TestCaseMetadata(
description="""
This test case will run generic xfstests testing against
nvme data disk with ext4 type system.
""",
timeout=TIME_OUT,
priority=3,
use_new_environment=True,
requirement=simple_requirement(
supported_features=[Nvme], unsupported_os=[BSD, Windows]
),
)
def verify_generic_ext4_nvme_datadisk(
self, log_path: Path, result: TestResult
) -> None:
environment = result.environment
assert environment, "fail to get environment from testresult"
node = cast(RemoteNode, environment.nodes[0])
xfstests = self._install_xfstests(node)
nvme_disk = node.features[Nvme]
nvme_data_disks = nvme_disk.get_raw_data_disks()
self._execute_xfstests(
log_path,
xfstests,
result,
nvme_data_disks[0],
f"{nvme_data_disks[0]}p1",
f"{nvme_data_disks[0]}p2",
file_system=FileSystem.ext4,
excluded_tests=self.excluded_tests,
)

@TestCaseMetadata(
description="""
This test case will run xfs xfstests testing against
Expand Down Expand Up @@ -547,6 +617,7 @@ def _execute_xfstests(
test_dev,
_test_folder,
test_type,
file_system.name,
mount_opts,
)
xfstests.set_excluded_tests(excluded_tests)
Expand Down
6 changes: 3 additions & 3 deletions microsoft/testsuites/xfstests/xfstests.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,14 +304,14 @@ def set_local_config(
test_dev: str,
test_folder: str,
test_type: str,
fs_type: str,
mount_opts: str = "",
) -> None:
xfstests_path = self.get_xfstests_path()
config_path = xfstests_path.joinpath("local.config")
if self.node.shell.exists(config_path):
self.node.shell.remove(config_path)
if "generic" == test_type:
test_type = "xfs"

echo = self.node.tools[Echo]
if mount_opts:
content = "\n".join(
Expand All @@ -326,7 +326,7 @@ def set_local_config(
content = "\n".join(
[
f"[{test_type}]",
f"FSTYP={test_type}",
f"FSTYP={fs_type}",
]
)
echo.write_to_file(content, config_path, append=True)
Expand Down

0 comments on commit 2951df2

Please sign in to comment.