Skip to content

Commit

Permalink
Support cpu.hyper-threading hw requirement for mrack (teemtee#2953)
Browse files Browse the repository at this point in the history
  • Loading branch information
skycastlelily authored and The-Mule committed Oct 14, 2024
1 parent 71b1582 commit 480634b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tests/unit/provision/mrack/test_hw.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,17 @@ def test_maximal_constraint(root_logger: Logger) -> None:
'_value': 'smep'
}
}
}
},
]
}
},
{
'cpu': {
'hyper': {
'_op': '==',
'_value': 'True'
}
}
},
]
},
{
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/test_hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ def test_normalize_invalid_hardware(
- avx
- "= avx2"
- "!= smep"
hyper-threading: true
device:
device-name: '~ .*Thunderbolt.*'
device: 79
Expand Down Expand Up @@ -263,6 +264,7 @@ def test_parse_maximal_constraint() -> None:
- cpu.flag: contains avx
- cpu.flag: contains avx2
- cpu.flag: not contains smep
- cpu.hyper-threading: == True
- and:
- device.vendor: '> 97'
- device.device: == 79
Expand Down
13 changes: 13 additions & 0 deletions tmt/steps/provision/mrack.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,18 @@ def _transform_cpu_model_name(
children=[MrackHWBinOp('model_name', beaker_operator, actual_value)])


def _transform_cpu_hyper_threading(
constraint: tmt.hardware.FlagConstraint,
logger: tmt.log.Logger) -> MrackBaseHWElement:
beaker_operator, actual_value, _ = operator_to_beaker_op(
constraint.operator,
str(constraint.value))

return MrackHWGroup(
'cpu',
children=[MrackHWBinOp('hyper', beaker_operator, actual_value)])


def _transform_disk_driver(
constraint: tmt.hardware.TextConstraint,
logger: tmt.log.Logger) -> MrackBaseHWElement:
Expand Down Expand Up @@ -471,6 +483,7 @@ def _transform_system_numa_nodes(

_CONSTRAINT_TRANSFORMERS: Mapping[str, ConstraintTransformer] = {
'cpu.flag': _transform_cpu_flag, # type: ignore[dict-item]
'cpu.hyper_threading': _transform_cpu_hyper_threading, # type: ignore[dict-item]
'cpu.model': _transform_cpu_model, # type: ignore[dict-item]
'cpu.processors': _transform_cpu_processors, # type: ignore[dict-item]
'cpu.cores': _transform_cpu_cores, # type: ignore[dict-item]
Expand Down

0 comments on commit 480634b

Please sign in to comment.