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 LIT parameter priority #5032

Merged
merged 4 commits into from
Oct 24, 2024
Merged
Changes from 1 commit
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
21 changes: 21 additions & 0 deletions tests/utils/stl/test/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,23 @@ def pretty(self, config, litParams):
return 'exclude run.pl tags {}'.format(str(self._taglist))


def be_nice(prio: str) -> list[ConfigAction]:
"""
Set the process priority to run tests with.
"""
try:
import psutil
priority_map = {
'normal': psutil.NORMAL_PRIORITY_CLASS,
'low': psutil.BELOW_NORMAL_PRIORITY_CLASS,
'idle': psutil.IDLE_PRIORITY_CLASS,
}
psutil.Process().nice(priority_map[prio])
except ImportError:
pass
StephanTLavavej marked this conversation as resolved.
Show resolved Hide resolved
return []


def getDefaultParameters(config, litConfig):
DEFAULT_PARAMETERS = [
Parameter(name='long_tests', choices=[True, False], type=bool, default=True,
Expand All @@ -47,6 +64,10 @@ def getDefaultParameters(config, litConfig):
Parameter(name="notags", type=list, default=[],
help="Comma-separated list of run.pl tags to exclude tests",
actions=lambda tags: [AddRunPLNotags(tags)]),
Parameter(name="priority", choices=["idle", "low", "normal"], default="idle", type=str,
help='Process priority to run tests with: "idle" (the default), "low", or "normal". ' +
'Module "psutil" must be installed for to have any effect.',
CaseyCarter marked this conversation as resolved.
Show resolved Hide resolved
actions=lambda prio: be_nice(prio)),
]

return DEFAULT_PARAMETERS
Loading