Fix setting SPACK_TARGET_ARGS for concrete specs
This commit is contained in:
parent
eb85f2e862
commit
32fc8c351d
@ -13,12 +13,14 @@
|
|||||||
from llnl.util.filesystem import HeaderList, LibraryList
|
from llnl.util.filesystem import HeaderList, LibraryList
|
||||||
|
|
||||||
import spack.build_environment
|
import spack.build_environment
|
||||||
|
import spack.build_systems.compiler
|
||||||
import spack.concretize
|
import spack.concretize
|
||||||
import spack.config
|
import spack.config
|
||||||
import spack.deptypes as dt
|
import spack.deptypes as dt
|
||||||
import spack.package_base
|
import spack.package_base
|
||||||
import spack.paths
|
import spack.paths
|
||||||
import spack.spec
|
import spack.spec
|
||||||
|
import spack.util.environment
|
||||||
import spack.util.spack_yaml as syaml
|
import spack.util.spack_yaml as syaml
|
||||||
from spack.build_environment import UseMode, _static_to_shared_library, dso_suffix
|
from spack.build_environment import UseMode, _static_to_shared_library, dso_suffix
|
||||||
from spack.context import Context
|
from spack.context import Context
|
||||||
@ -779,3 +781,23 @@ def test_optimization_flags(compiler_spec, target_name, expected_flags, compiler
|
|||||||
compiler = spack.spec.parse_with_version_concrete(compiler_spec)
|
compiler = spack.spec.parse_with_version_concrete(compiler_spec)
|
||||||
opt_flags = spack.build_environment.optimization_flags(compiler, target)
|
opt_flags = spack.build_environment.optimization_flags(compiler, target)
|
||||||
assert opt_flags == expected_flags
|
assert opt_flags == expected_flags
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(
|
||||||
|
str(archspec.cpu.host().family) != "x86_64", reason="tests check specific x86_64 uarch flags"
|
||||||
|
)
|
||||||
|
@pytest.mark.not_on_windows("Windows doesn't support the compiler wrapper")
|
||||||
|
def test_optimization_flags_are_using_node_target(default_mock_concretization, monkeypatch):
|
||||||
|
"""Tests that we are using the target on the node to be compiled to retrieve the uarch
|
||||||
|
specific flags, and not the target of the compiler.
|
||||||
|
"""
|
||||||
|
monkeypatch.setattr(spack.build_systems.compiler, "_implicit_rpaths", lambda pkg: [])
|
||||||
|
gcc = default_mock_concretization("gcc target=core2")
|
||||||
|
mpileaks = default_mock_concretization("gcc target=x86_64")
|
||||||
|
|
||||||
|
env = EnvironmentModifications()
|
||||||
|
gcc.package.setup_dependent_build_environment(env, mpileaks)
|
||||||
|
actions = env.group_by_name()["SPACK_TARGET_ARGS"]
|
||||||
|
|
||||||
|
assert len(actions) == 1 and isinstance(actions[0], spack.util.environment.SetEnv)
|
||||||
|
assert actions[0].value == "-march=x86-64 -mtune=generic"
|
||||||
|
Loading…
Reference in New Issue
Block a user