Skip to content

Commit 95a4f8d

Browse files
lavenzgfacebook-github-bot
authored andcommittedFeb 3, 2025·
Add support for platform specific skiplist
Reviewed By: dannysu Differential Revision: D68920246 fbshipit-source-id: fc01ca964f2cf859f9a32ca7438f1d53350620a6
1 parent ef2774a commit 95a4f8d

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed
 

‎utils/testsuite/cli.py

+1
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ async def run(
337337
skip_categories = [
338338
SkipCategory.SKIP_LIST,
339339
SkipCategory.MANUAL_SKIP_LIST,
340+
SkipCategory.PLATFORM_SKIP_LIST,
340341
]
341342
if lazy:
342343
skip_categories.append(SkipCategory.LAZY_SKIP_LIST)

‎utils/testsuite/skiplist.py

+17-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import json
77
import os
8+
import sys
89
from enum import Enum, unique
910
from pathlib import Path
1011
from typing import cast, Dict, List, Optional, Pattern, Sequence, Tuple, Union
@@ -23,6 +24,7 @@ class SkipCategory(Enum):
2324
UNSUPPORTED_FEATURES = "unsupported_features"
2425
PERMANENT_UNSUPPORTED_FEATURES = "permanent_unsupported_features"
2526
INTL_TESTS = "intl_tests"
27+
PLATFORM_SKIP_LIST = "platform_skip_list"
2628

2729

2830
SKIPCAT_TO_RETCODE = {
@@ -33,6 +35,8 @@ class SkipCategory(Enum):
3335
SkipCategory.UNSUPPORTED_FEATURES: TestResultCode.TEST_SKIPPED,
3436
SkipCategory.PERMANENT_UNSUPPORTED_FEATURES: TestResultCode.TEST_PERMANENTLY_SKIPPED,
3537
SkipCategory.INTL_TESTS: TestResultCode.TEST_SKIPPED,
38+
SkipCategory.PERMANENT_SKIP_LIST: TestResultCode.TEST_SKIPPED,
39+
SkipCategory.PLATFORM_SKIP_LIST: TestResultCode.TEST_SKIPPED,
3640
}
3741
"""Mapping from a skip category to result code."""
3842

@@ -47,6 +51,18 @@ def __init__(self, config_path: PathT):
4751
self.paths_features: SkippedPathsOrFeaturesDict = json.load(f)
4852
self.config_path = config_path
4953

54+
def get_skiplist_for_cat(self, skip_cat: SkipCategory) -> List[SkippedPathItem]:
55+
"""
56+
Get the skip list for given category. For PLATFORM_SKIP_LIST, get the
57+
list for the host platform.
58+
"""
59+
if skip_cat == SkipCategory.PLATFORM_SKIP_LIST:
60+
platform_skip_list: Dict[str, List[SkippedPathItem]] = (
61+
self.paths_features.get(skip_cat.value, {})
62+
)
63+
return platform_skip_list.get(sys.platform, [])
64+
return self.paths_features.get(skip_cat.value, [])
65+
5066
def should_skip_cat(
5167
self, test_or_feature: Union[str, Pattern[str]], skip_cat: SkipCategory
5268
) -> bool:
@@ -68,7 +84,7 @@ def should_skip(test_or_feature: Union[str, Pattern[str]], value: str) -> bool:
6884
return True
6985
return False
7086

71-
values: List[SkippedPathItem] = self.paths_features.get(skip_cat.value, [])
87+
values: List[SkippedPathItem] = self.get_skiplist_for_cat(skip_cat)
7288
for value in values:
7389
if isinstance(value, dict):
7490
for p in value.get("paths", []):

‎utils/testsuite/typing_defs.py

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class SkippedPathsOrFeaturesDict(TypedDict):
4444
unsupported_features: List[str]
4545
permant_unsupported_features: List[str]
4646
intl_tests: List[SkippedPathItem]
47+
platform_skip_list: Dict[str, List[SkippedPathItem]]
4748

4849

4950
# Use | with Python 3.10+

0 commit comments

Comments
 (0)
Please sign in to comment.