Disable target determination for now (#64921)
authorNikita Shulga <nshulga@fb.com>
Tue, 14 Sep 2021 16:38:34 +0000 (09:38 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Tue, 14 Sep 2021 16:40:13 +0000 (09:40 -0700)
Summary:
There were several reports of target determinator incorrectly skipping
tests, most recent one is https://github.com/pytorch/pytorch/issues/64902

Let's disable it until it could be further stabilized

Pull Request resolved: https://github.com/pytorch/pytorch/pull/64921

Reviewed By: seemethere, janeyx99

Differential Revision: D30901186

Pulled By: malfet

fbshipit-source-id: 531afd2d390c6b51f727330d5dd1882d70b6fdde

test/run_test.py

index 5d3856b..09e2c0a 100644 (file)
@@ -32,15 +32,17 @@ try:
     from tools.testing.test_selections import (
         export_S3_test_times,
         get_shard_based_on_S3,
-        get_slow_tests_based_on_S3,
+        # NS: Disable target determination
+        # get_slow_tests_based_on_S3,
         get_specified_test_cases,
         get_reordered_tests,
         get_test_case_configs,
     )
-    from tools.testing.modulefinder_determinator import (
-        should_run_test,
-        TARGET_DET_LIST,
-    )
+    # NS: Disable target determination
+    # from tools.testing.modulefinder_determinator import (
+    #     should_run_test,
+    #     TARGET_DET_LIST,
+    # )
 
     HAVE_TEST_SELECTION_TOOLS = True
 except ImportError:
@@ -93,6 +95,7 @@ TESTS = discover_tests(
     blocklisted_tests=[
         'test_bundled_images',
         'test_cpp_extensions_aot',
+        'test_determination',
         'test_gen_backend_stubs',
         'test_jit_fuser',
         'test_jit_simple',
@@ -953,30 +956,31 @@ def main():
     if options.coverage and not PYTORCH_COLLECT_COVERAGE:
         shell(["coverage", "erase"])
 
-    if options.determine_from is not None and os.path.exists(options.determine_from):
-        slow_tests = get_slow_tests_based_on_S3(
-            TESTS, TARGET_DET_LIST, SLOW_TEST_THRESHOLD
-        )
-        print_to_stderr(
-            "Added the following tests to target_det tests as calculated based on S3:"
-        )
-        print_to_stderr(slow_tests)
-        with open(options.determine_from, "r") as fh:
-            touched_files = [
-                os.path.normpath(name.strip())
-                for name in fh.read().split("\n")
-                if len(name.strip()) > 0
-            ]
-        # HACK: Ensure the 'test' paths can be traversed by Modulefinder
-        sys.path.append(test_directory)
-        selected_tests = [
-            test
-            for test in selected_tests
-            if should_run_test(
-                TARGET_DET_LIST + slow_tests, test, touched_files, options
-            )
-        ]
-        sys.path.remove(test_directory)
+    # NS: Disable target determination until it can be made more reliable
+    # if options.determine_from is not None and os.path.exists(options.determine_from):
+    #     slow_tests = get_slow_tests_based_on_S3(
+    #         TESTS, TARGET_DET_LIST, SLOW_TEST_THRESHOLD
+    #     )
+    #     print_to_stderr(
+    #         "Added the following tests to target_det tests as calculated based on S3:"
+    #     )
+    #     print_to_stderr(slow_tests)
+    #     with open(options.determine_from, "r") as fh:
+    #         touched_files = [
+    #             os.path.normpath(name.strip())
+    #             for name in fh.read().split("\n")
+    #             if len(name.strip()) > 0
+    #         ]
+    #     # HACK: Ensure the 'test' paths can be traversed by Modulefinder
+    #     sys.path.append(test_directory)
+    #     selected_tests = [
+    #         test
+    #         for test in selected_tests
+    #         if should_run_test(
+    #             TARGET_DET_LIST + slow_tests, test, touched_files, options
+    #         )
+    #     ]
+    #     sys.path.remove(test_directory)
 
     if IS_IN_CI:
         selected_tests = get_reordered_tests(