pytest_mh.utils.coredumpd
Classes
|
Coredumpd utilities. |
- class pytest_mh.utils.coredumpd.Coredumpd(*args, **kwargs)
Bases:
MultihostUtility[MultihostHost]Coredumpd utilities.
Collects generated core files from /var/lib/systemd/coredump and if there are any, optionally fail the test.
Note
In order for this functionality to work correctly, systemd-coredumpd must be configured to store the core files in a directory (default), not in a journal.
See
man coredump.confand itsStorageoption for more information.modevalues:ignore: all failures are ignoredwarn: test result category is set to “COREDUMPS” and the test is marked as such in a test summary, however test outcome and pytest exit code is kept intactfail: test result category is set to “COREDUMPS” and the test is marked as such in a test summary, if a test outcome ispassedit is set tofailedand pytest will return non-zero exit code
- Parameters:
host (MultihostHost) – Multihost host.
mode (Literal["fail", "warn", "ignore"]) – Action taken when a core file is found.
filter (str | None, optional) – Regular expression used to filter the core file names, defaults to None
path (str) – Path to the directory where core files are stored, defaults to
/var/lib/systemd/coredump
- setup() None
Backup and remove /var/lib/systemd/coredump.
This directory will be automatically re-created by systemd-coredumpd if needed.
- parse_core_file_name(name: str) tuple[str, str]
Parse core file name and get the PID and timestamp information.
Expected format is core.{binary}.{bootid}.{pid}.{timestamp}[.zst]
- Parameters:
name (str) – Core file name.
- Raises:
ValueError – If the core file name has unexpected format.
- Returns:
Tuple of
(PID, timestamp).- Return type:
- get_artifacts_list(host: MultihostHost, artifacts_type: Literal['pytest_setup', 'pytest_teardown', 'topology_setup', 'topology_teardown', 'test']) set[str]
Dump backtrace and other information from generated core files for easy access.
- Parameters:
host (MultihostHost) – Host where the artifacts are being collected.
artifacts_type (MultihostArtifactsType) – Type of artifacts that are being collected.
- Returns:
List of artifacts to collect.
- Return type:
- pytest_report_teststatus(report: CollectReport | TestReport, config: Config) tuple[str, str, str | tuple[str, dict[str, bool]]] | None
Report core file found error if found and matches requested filter.
- Parameters:
report (pytest.CollectReport | pytest.TestReport) – Pytest report
config (pytest.Config) – Pytest config
- Returns:
Pytest test status
- Return type: