Skip to content

Define a way to properly test external detection #39633

@alalazo

Description

@alalazo

Summary

As a user I want to have a way to test external package detection so to avoid regressions on known use cases.

Rationale

Currently we have unit-tests to verify compiler detection from known output. As an example:

@pytest.mark.parametrize(
"version_str,expected_version",
[
(
"Arm C/C++/Fortran Compiler version 19.0 (build number 73) (based on LLVM 7.0.2)\n"
"Target: aarch64--linux-gnu\n"
"Thread model: posix\n"
"InstalledDir:\n"
"/opt/arm/arm-hpc-compiler-19.0_Generic-AArch64_RHEL-7_aarch64-linux/bin\n",
"19.0",
),
(
"Arm C/C++/Fortran Compiler version 19.3.1 (build number 75) (based on LLVM 7.0.2)\n"
"Target: aarch64--linux-gnu\n"
"Thread model: posix\n"
"InstalledDir:\n"
"/opt/arm/arm-hpc-compiler-19.0_Generic-AArch64_RHEL-7_aarch64-linux/bin\n",
"19.3.1",
),
],
)
def test_arm_version_detection(version_str, expected_version):
version = spack.compilers.arm.Arm.extract_version_from_output(version_str)
assert version == expected_version

When compiler are moved from internal Compiler classes to packages, detection of the compilers on the system will be delegated to external package detection. It is thus necessary to:

  1. Define a way to test external package detection
  2. Port the current unit-test

to ensure that the new detection mechanism is as reliable as the old one.

Other references

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions