diff --git a/test/xpu/run_test_with_skip.py b/test/xpu/run_test_with_skip.py index e1e578b16..1a4004dba 100644 --- a/test/xpu/run_test_with_skip.py +++ b/test/xpu/run_test_with_skip.py @@ -13,13 +13,6 @@ default="selected", help="Test cases scope", ) -# Add skip-cases parameter to import window skip dictionary -parser.add_argument( - "--skip-cases", - action="store_true", - default=False, - help="Use window skip dictionary for test cases", -) args = parser.parse_args() @@ -27,21 +20,28 @@ def should_skip_entire_file(skip_list): """Check if the skip list contains any entire file skip pattern (*.py::)""" if not skip_list: return False - return any(item.endswith(".py::") for item in skip_list) + return any(item.endswith(".py") for item in skip_list) -# Import window skip dictionary if skip-cases is True -if args.skip_cases: +platform = sys.platform +print(f"Running test on the platform: {platform}") +# Import window skip dictionary if Platform is Windows +if platform.startswith("win"): try: # Import the window skip dictionary module - from window_skip_dict import skip_dict as window_skip_dict + from windows_skip_cases import skip_dict as window_skip_dict # Merge the window skip dictionary with the default one using intelligent strategy merged_skip_dict = {} # First, copy all keys from default skip_dict for key in skip_dict: - merged_skip_dict[key] = skip_dict[key].copy() if skip_dict[key] else [] + if skip_dict[key] is None: + merged_skip_dict[key] = [] + elif isinstance(skip_dict[key], tuple): + merged_skip_dict[key] = list(skip_dict[key]) + else: + merged_skip_dict[key] = skip_dict[key].copy() if skip_dict[key] else [] # Then merge with window_skip_dict using intelligent strategy for key in window_skip_dict: @@ -104,6 +104,10 @@ def should_skip_entire_file(skip_list): skip_list = None # For "selected" case, use the skip_list as is + # If skip_list is empty, set it to None + if skip_list is not None and len(skip_list) == 0: + skip_list = None + print(f"Running test case: {key}") if skip_list: print(f"Skip list: {skip_list}") diff --git a/test/xpu/windows_skip_cases.py b/test/xpu/windows_skip_cases.py index e0f6633d7..b381605ab 100644 --- a/test/xpu/windows_skip_cases.py +++ b/test/xpu/windows_skip_cases.py @@ -5,8 +5,8 @@ skip_dict = { # Windows: Skip entire files using *.py:: pattern - "test_decomp": [ - "test_decomp.py::", # Skip entire file on Windows + "test_decomp.py": [ + "test_decomp.py", # Skip entire file on Windows ], # Files where Windows only needs to skip specific tests (will merge with Linux defaults) # "test_linalg": [ diff --git a/test/xpu/xpu_test_utils.py b/test/xpu/xpu_test_utils.py index 29bee2ce3..fc695ff36 100644 --- a/test/xpu/xpu_test_utils.py +++ b/test/xpu/xpu_test_utils.py @@ -1092,7 +1092,7 @@ def copy_tests( def launch_test(test_case, skip_list=None, exe_list=None): os.environ["PYTORCH_TEST_WITH_SLOW"] = "1" - if skip_list is not None: + if skip_list and len(skip_list) > 0: skip_options = ' -k "not ' + skip_list[0] for skip_case in skip_list[1:]: skip_option = " and not " + skip_case @@ -1103,7 +1103,7 @@ def launch_test(test_case, skip_list=None, exe_list=None): + test_case ) test_command += skip_options - elif exe_list is not None: + elif exe_list and len(exe_list) > 0: exe_options = ' -k "' + exe_list[0] for exe_case in exe_list[1:]: exe_option = " or " + exe_case