From 7cf6348777368a29e3cb629a3a105fe5c5b7ea63 Mon Sep 17 00:00:00 2001 From: Michael Cuevas Date: Tue, 19 Dec 2023 22:20:08 -0800 Subject: [PATCH] add FilteredHg mixin type to EdenRepoTest Summary: Since FilteredFS uses an entirely separate `eden clone` command, none of the existing Hg tests run using a FilteredBackingStore-backed repo. To ensure we have proper test coverage for FilteredFS, we should add a FilteredFS mixin type that runs all existing tests with the new FilteredBackingStore setup. Introducing these mixins revealed a number of broken tests (some legit issues with FilteredFS, others are just incompatibilities with new FilteredBackingStore Root/Object Ids). We will disable all of these broken tests and incrementally fix them in the next diffs in this stack. Note: A small number of tests are already broken/flakey for non-FilteredFS tests. They are "ignored" on other diff signals since they are marked flakey/broken in TestX, but the FilteredHg counterpart won't be marked accordingly (due to no run history). I'm not planning to fix those existing flakey/broken tests just yet. Reviewed By: kmancini Differential Revision: D51287692 fbshipit-source-id: 8135cb9e5e9dba08be48a4814dfc3405122127b8 --- CMake/eden-config.py.in | 1 + CMakeLists.txt | 2 + eden/integration/lib/skip.py | 96 ++++++++++++++++++++++++++++++++ eden/integration/lib/testcase.py | 11 +++- 4 files changed, 109 insertions(+), 1 deletion(-) diff --git a/CMake/eden-config.py.in b/CMake/eden-config.py.in index 7dd5210179..ab51f2f3d6 100644 --- a/CMake/eden-config.py.in +++ b/CMake/eden-config.py.in @@ -21,3 +21,4 @@ BUILD_FLAVOR = "CMake" HAVE_GIT = @EDEN_HAVE_GIT_PY@ HAVE_NFS = @EDEN_HAVE_NFS_PY@ +HAVE_FILTEREDHG = @EDEN_HAVE_FILTEREDHG_PY@ diff --git a/CMakeLists.txt b/CMakeLists.txt index 03dbaf2c31..edd250d648 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -178,6 +178,8 @@ else() set(EDEN_HAVE_NFS_PY "False") endif() +set(EDEN_HAVE_FILTEREDHG_PY "False") + configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/CMake/eden-config.py.in ${CMAKE_CURRENT_BINARY_DIR}/eden/fs/py/eden/config.py diff --git a/eden/integration/lib/skip.py b/eden/integration/lib/skip.py index 2d558594fe..df01fc95da 100644 --- a/eden/integration/lib/skip.py +++ b/eden/integration/lib/skip.py @@ -425,6 +425,102 @@ except ImportError: pass +# We temporarily need to add skips for FilteredFS mixins. Do not add FilteredFS +# specific skips here. Add them below to FILTERED_TEST_DISABLED instead. +FILTEREDFS_PARITY = {} +for (class_name, value_name) in TEST_DISABLED.items(): + if class_name.endswith("Hg"): + FILTEREDFS_PARITY[class_name.replace("Hg", "FilteredHg")] = value_name + elif not class_name.endswith("FilteredHg") and not class_name.endswith("Git"): + FILTEREDFS_PARITY[class_name + "FilteredHg"] = value_name +TEST_DISABLED.update(FILTEREDFS_PARITY) + +# Some tests fail on FilteredFS. We will fix these in follow-up diffs. +FILTEREDFS_TEST_DISABLED = { + "info_test.InfoTest": ["test_relative_path"], + "thrift_test.ThriftTest": [ + "test_pid_fetch_counts", + "test_unload_free_inodes", + "test_diff_revisions_hex", + "test_diff_revisions_with_reverted_file", + "test_diff_revisions", + ], + "glob_test.GlobTest": [ + "test_glob_background", + "test_glob_multiple_commits", + "test_duplicate_file_multiple_commits", + "test_multiple_file_multiple_commits", + "test_glob_on_non_current_commit", + "test_search_root_with_specified_commits", + "test_prefetch_matching_files", + "test_simple_matching_commit", + ], + "mount_test.MountTest": [ + "test_unmount_succeeds_while_dir_handle_is_open", + "test_unmount_succeeds_while_file_handle_is_open", + ], + "readdir_test.ReaddirTest": [ + "test_get_attributes_directory", + "test_get_attributes", + "test_readdir", + "test_get_attributes_symlink", + "test_readdir_directory_symlink_and_other", + ], + "config_test.ConfigTestDefault": ["test_periodic_reload"], + "xattr_test.XattrTest": [ + "test_get_sha1_xattr", + "test_get_sha1_xattr_succeeds_after_querying_xattr_on_dir", + ], + "setattr_test.SetAttrTest": [ + "test_setuid_setgid_and_sticky_bits_fail_with_eperm", + "test_chown_uid_as_nonroot_fails", + "test_chown_gid_as_nonroot_fails_if_not_member", + ], + "takeover_test.TakeoverTest": [ + "test_takeover_succeeds", + "test_takeover_with_inode_number", + ], + # Windows specific failures + "prjfs_stress.PrjFSStress": [ + "test_create_directory_to_file", + "test_create_already_removed", + "test_rename_hierarchy", + "test_create_and_remove_file", + "test_out_of_order_file_removal_to_renamed", + "test_create_file_to_directory", + "test_out_of_order_file_removal", + "test_rename_twice", + "test_rename_and_replace", + "test_rename_to_file", + "test_truncate", + ], + "prjfs_stress.PrjfsStressNoListenToFull": ["test_truncate"], + "windows_fsck_test.WindowsRebuildOverlayTest": [ + "test_rebuild_partial_overlay", + "test_rebuild_entire_overlay", + ], + "windows_fsck_test.WindowsFsckTest": ["test_loaded_inodes_not_loaded_on_restart"], + # macOS specific failures + "takeover_test.TakeoverTest": ["test_takeover_after_diff_revisions"], +} +for (testModule, disabled) in FILTEREDFS_TEST_DISABLED.items(): + # We should add skips for all combinations of FilteredHg mixins. + for fs_type in ["", "NFS"]: + # We need to be careful that we don't overwrite any pre-existing lists + # or bulk disables that were disabled by other criteria. + new_class_name = testModule + fs_type + "FilteredHg" + prev_disabled = TEST_DISABLED.get(new_class_name) + if prev_disabled is None: + # There are no previously disabled tests, we're free to bulk add + TEST_DISABLED[new_class_name] = disabled + else: + # If there's a list of previously disabled tests, we need to append + # our list. Otherwise, we can no-op since all tests (including the + # ones we specified) are already disabled. + if isinstance(prev_disabled, list): + TEST_DISABLED[new_class_name] = prev_disabled + disabled + + def is_class_disabled(class_name: str) -> bool: class_skipped = TEST_DISABLED.get(class_name) if class_skipped is None: diff --git a/eden/integration/lib/testcase.py b/eden/integration/lib/testcase.py index f11713d173..0ab0709e33 100644 --- a/eden/integration/lib/testcase.py +++ b/eden/integration/lib/testcase.py @@ -619,9 +619,11 @@ def _replicate_eden_repo_test( nfs_variants.append(("NFS", [NFSTestMixin])) scm_variants: MixinList = [("Hg", [HgRepoTestMixin])] - # Only run the git tests if EdenFS was built with git support. + # Gate some tests on whether EdenFS was built to support them. if eden.config.HAVE_GIT: scm_variants.append(("Git", [GitRepoTestMixin])) + if eden.config.HAVE_FILTEREDHG: + scm_variants.append(("FilteredHg", [FilteredHgTestMixin])) case_variants: MixinList = [("", [])] if case_sensitivity_dependent: @@ -674,6 +676,13 @@ class HgRepoTestMixin: ) +class FilteredHgTestMixin(HgRepoTestMixin): + backing_store_type: Optional[str] = "filteredhg" + + def create_repo(self, name: str) -> repobase.Repository: + return super().create_repo(name) + + class GitRepoTestMixin: repo_type: str = "git"