From 2951df2a3f1c6085c31482639bfed2f4d895b3dc Mon Sep 17 00:00:00 2001 From: Sudipta Pandit Date: Fri, 22 Nov 2024 20:22:33 +0530 Subject: [PATCH] xfstests: add new generic xfstests for ext4 filesystem (#3527) * add generic xfstests for ext4 filesystem * fix formatting --- microsoft/testsuites/xfstests/xfstesting.py | 71 +++++++++++++++++++++ microsoft/testsuites/xfstests/xfstests.py | 6 +- 2 files changed, 74 insertions(+), 3 deletions(-) diff --git a/microsoft/testsuites/xfstests/xfstesting.py b/microsoft/testsuites/xfstests/xfstesting.py index 97f2472fd1..297b3ce003 100644 --- a/microsoft/testsuites/xfstests/xfstesting.py +++ b/microsoft/testsuites/xfstests/xfstesting.py @@ -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 @@ -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 @@ -547,6 +617,7 @@ def _execute_xfstests( test_dev, _test_folder, test_type, + file_system.name, mount_opts, ) xfstests.set_excluded_tests(excluded_tests) diff --git a/microsoft/testsuites/xfstests/xfstests.py b/microsoft/testsuites/xfstests/xfstests.py index 97d91d2d5b..5fa396e787 100644 --- a/microsoft/testsuites/xfstests/xfstests.py +++ b/microsoft/testsuites/xfstests/xfstests.py @@ -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( @@ -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)