diff --git a/docs/releases.rst b/docs/releases.rst index 425d13b937..4cc2b52a9d 100644 --- a/docs/releases.rst +++ b/docs/releases.rst @@ -42,6 +42,9 @@ The ``tmt link`` command now supports providing multiple links by using the ``--link`` option. See the :ref:`link-issues` section for example usage. +The :ref:`/plugins/provision/beaker` provision plugin gains support +for :ref:`cpu.stepping` hardware requirement. + tmt-1.37.0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/spec/hardware/cpu.fmf b/spec/hardware/cpu.fmf index 98b411a6a2..5001be7357 100644 --- a/spec/hardware/cpu.fmf +++ b/spec/hardware/cpu.fmf @@ -65,6 +65,9 @@ description: | model, stepping and corresponding names. ``/proc/cpuinfo`` and ``lscpu`` are also useful resources. + .. versionchanged:: 1.38 + ``beaker`` plugins supports ``stepping`` + .. versionchanged:: 1.35 ``beaker`` plugins supports ``vendor-name`` @@ -108,8 +111,13 @@ example: cpu: hyper-threading: true + - | + # Request a CPU with specified stepping. + cpu: + stepping: 9 + link: - implemented-by: /tmt/steps/provision/artemis.py note: "``cpu.vendor``, ``cpu.vendor-name`` and ``cpu.hyper-threading`` not implemented yet" - implemented-by: /tmt/steps/provision/mrack.py - note: "``cpu.flag``, ``cpu.processors``, ``cpu.model``, ``cpu.cores``, ``cpu.model-name``, ``cpu.hyper-threading`` and ``cpu.vendor-name`` only" + note: "``cpu.flag``, ``cpu.processors``, ``cpu.model``, ``cpu.cores``, ``cpu.model-name``, ``cpu.hyper-threading``, ``cpu.stepping`` and ``cpu.vendor-name`` only" diff --git a/tests/unit/provision/mrack/test_hw.py b/tests/unit/provision/mrack/test_hw.py index e0d0827511..23ce742794 100644 --- a/tests/unit/provision/mrack/test_hw.py +++ b/tests/unit/provision/mrack/test_hw.py @@ -100,7 +100,14 @@ def test_maximal_constraint(root_logger: Logger) -> None: }, {'or': []}, {'or': []}, - {'or': []}, + { + 'cpu': { + 'stepping': { + '_op': '!=', + '_value': '10', + }, + }, + }, {'or': []}, { 'not': @@ -386,6 +393,20 @@ def test_cpu_cores(root_logger: Logger) -> None: } +def test_cpu_stepping(root_logger: Logger) -> None: + result = _CONSTRAINT_TRANSFORMERS['cpu.stepping']( + _parse_cpu({'stepping': '10'}), root_logger) + + assert result.to_mrack() == { + 'cpu': { + 'stepping': { + '_op': '==', + '_value': '10' + } + } + } + + def test_cpu_vendor_name(root_logger: Logger) -> None: result = _CONSTRAINT_TRANSFORMERS['cpu.vendor_name']( _parse_cpu({'vendor-name': 'GenuineIntel'}), root_logger) diff --git a/tmt/steps/provision/mrack.py b/tmt/steps/provision/mrack.py index d2be3b1d10..fb458e0770 100644 --- a/tmt/steps/provision/mrack.py +++ b/tmt/steps/provision/mrack.py @@ -297,6 +297,18 @@ def _transform_cpu_model_name( children=[MrackHWBinOp('model_name', beaker_operator, actual_value)]) +def _transform_cpu_stepping( + constraint: tmt.hardware.NumberConstraint, + logger: tmt.log.Logger) -> MrackBaseHWElement: + beaker_operator, actual_value, _ = operator_to_beaker_op( + constraint.operator, + str(constraint.value)) + + return MrackHWGroup( + 'cpu', + children=[MrackHWBinOp('stepping', beaker_operator, actual_value)]) + + def _transform_cpu_vendor_name( constraint: tmt.hardware.TextConstraint, logger: tmt.log.Logger) -> MrackBaseHWElement: @@ -572,12 +584,13 @@ def _transform_system_numa_nodes( _CONSTRAINT_TRANSFORMERS: Mapping[str, ConstraintTransformer] = { 'beaker.pool': _transform_beaker_pool, # type: ignore[dict-item] + 'cpu.cores': _transform_cpu_cores, # type: ignore[dict-item] '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] 'cpu.model_name': _transform_cpu_model_name, # type: ignore[dict-item] + 'cpu.processors': _transform_cpu_processors, # type: ignore[dict-item] + 'cpu.stepping': _transform_cpu_stepping, # type: ignore[dict-item] 'cpu.vendor_name': _transform_cpu_vendor_name, # type: ignore[dict-item] 'disk.driver': _transform_disk_driver, # type: ignore[dict-item] 'disk.model_name': _transform_disk_model_name, # type: ignore[dict-item]