Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add validation for platform strings to exclude_parser.py #5651

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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