From f42fcc384e1eeab2f8c0927ea1fd60b6f150d721 Mon Sep 17 00:00:00 2001 From: libohao1201 Date: Thu, 20 Nov 2025 23:43:25 -0800 Subject: [PATCH 1/2] Revise windows skip logic --- test/xpu/run_test_with_skip.py | 15 ++++++++++++--- test/xpu/windows_skip_cases.py | 4 ++-- test/xpu/xpu_test_utils.py | 4 ++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/test/xpu/run_test_with_skip.py b/test/xpu/run_test_with_skip.py index e1e578b16a..1dc46e1d16 100644 --- a/test/xpu/run_test_with_skip.py +++ b/test/xpu/run_test_with_skip.py @@ -27,21 +27,26 @@ 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: 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 +109,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 e0f6633d71..b381605ab0 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 29bee2ce3a..fc695ff362 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 From fe77177b1911816dffe5c67e4ff672d99e96d681 Mon Sep 17 00:00:00 2001 From: libohao1201 Date: Sun, 23 Nov 2025 22:23:51 -0800 Subject: [PATCH 2/2] Using windows skip dictionary when the platform is Windows. --- test/xpu/run_test_with_skip.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/test/xpu/run_test_with_skip.py b/test/xpu/run_test_with_skip.py index 1dc46e1d16..1a4004dbaf 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() @@ -30,8 +23,10 @@ def should_skip_entire_file(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 windows_skip_cases import skip_dict as window_skip_dict