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

Translate cpu.stepping hardware requirement for mrack #3295

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion docs/releases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
Releases
======================


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should not be removed...

tmt-1.38.0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... and this one should not be added.

The :ref:`/plugins/report/junit` report plugin now removes all
invalid XML characters from the final JUnit XML.

Expand All @@ -29,6 +29,9 @@ A race condition in the
thus multihost tests using this provision method should now work
reliably without unexpected connection failures.

The :ref:`/plugins/provision/beaker` provision plugin gains support
for :ref:`cpu.stepping</spec/hardware/cpu>` hardware requirement.


happz marked this conversation as resolved.
Show resolved Hide resolved
tmt-1.37.0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
10 changes: 9 additions & 1 deletion spec/hardware/cpu.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -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``

Expand Down Expand Up @@ -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"
23 changes: 22 additions & 1 deletion tests/unit/provision/mrack/test_hw.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,14 @@ def test_maximal_constraint(root_logger: Logger) -> None:
},
{'or': []},
{'or': []},
{'or': []},
{
'cpu': {
'stepping': {
'_op': '!=',
'_value': '10',
},
},
},
{'or': []},
{
'not':
Expand Down Expand Up @@ -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)
Expand Down
17 changes: 15 additions & 2 deletions tmt/steps/provision/mrack.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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]
Expand Down
Loading