Skip to content

Commit

Permalink
Add validation for platform strings to exclude_parser.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jiekang committed Sep 26, 2024
1 parent a3280ca commit b7a3fba
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions scripts/disabled_tests/exclude_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"x86": "x86-32",
}

ERROR_FOUND = False

class ExclusionFileProcessingException(Exception):
pass
Expand Down Expand Up @@ -185,9 +186,18 @@ def transform_platform(os_arch_platform: str) -> str:

return f"{arch_name}_{os_name}"

def validate_platforms(split: TestExclusionSplitLine):
# the platform exclusion list must be comma-delimited with no spaces
platforms = split.raw_platform
if ' ' in platforms.strip():
LOG.error(f'{split.origin_file.path}:{split.line_number} : '
f'Space found in platform exclusion text. Please remove')
global ERROR_FOUND
ERROR_FOUND = True

def resolve_platforms(split: TestExclusionSplitLine) -> List[str]:
revolved_platforms = []
validate_platforms(split)
list_of_unresolved_platform_names = [s.strip() for s in split.raw_platform.split(",") if s.strip()]
for plat in list_of_unresolved_platform_names:
if plat == "generic-all":
Expand Down Expand Up @@ -283,6 +293,9 @@ def main():
fp=fp,
indent=2,
)
if ERROR_FOUND:
LOG.debug(f"Error found. Exiting with code 1")
sys.exit(1)


if __name__ == '__main__':
Expand Down

0 comments on commit b7a3fba

Please sign in to comment.