No flag propagation when compilers are different
Flag propagation is not activated on nodes with a compiler that is different from the propagation source
This commit is contained in:
parent
922b9b0e50
commit
f75555136b
@ -1244,15 +1244,18 @@ error(100, "Cannot propagate the variant '{0}' from the package: {1} because pac
|
||||
|
||||
% A propagated flag implies:
|
||||
% 1. The same flag type is not set on this node
|
||||
% 2. This node has the same compiler as the propagation source
|
||||
% 2. This node has the same compilers as the propagation source
|
||||
|
||||
node_compiler(node(X, Package), node(Y, Compiler)) :-
|
||||
attr("virtual_on_edge", node(X, Package), node(Y, Compiler), Language),
|
||||
attr("version", node(Y, Compiler), Version),
|
||||
compiler(Compiler), language(Language).
|
||||
|
||||
propagated_flag(node(PackageID, Package), node_flag(FlagType, Flag, FlagGroup, Source), SourceNode) :-
|
||||
propagate(node(PackageID, Package), node_flag(FlagType, Flag, FlagGroup, Source), _),
|
||||
not attr("node_flag_set", node(PackageID, Package), node_flag(FlagType, _, _, "literal")),
|
||||
% FIXME (compiler as nodes): do we need to match the compiler?
|
||||
% Same compiler as propagation source
|
||||
% node_compiler(node(PackageID, Package), CompilerID),
|
||||
% node_compiler(SourceNode, CompilerID),
|
||||
% Same compilers as propagation source
|
||||
node_compiler(node(PackageID, Package), CompilerNode) : node_compiler(SourceNode, CompilerNode);
|
||||
attr("propagate", SourceNode, node_flag(FlagType, Flag, FlagGroup, Source), _),
|
||||
node(PackageID, Package) != SourceNode,
|
||||
not runtime(Package).
|
||||
|
@ -198,10 +198,6 @@ def test_propagate_and_compiler_cfg(concretize_scope, test_repo):
|
||||
assert root_spec["y"].satisfies("cflags='-f1 -f2'")
|
||||
|
||||
|
||||
# Note: setting flags on a dependency overrides propagation, which
|
||||
# is tested in test/concretize.py:test_compiler_flag_propagation
|
||||
|
||||
|
||||
def test_propagate_and_pkg_dep(concretize_scope, test_repo):
|
||||
root_spec1 = spack.concretize.concretize_one("x ~activatemultiflag cflags=='-f1'")
|
||||
assert root_spec1["y"].satisfies("cflags='-f1 -d1'")
|
||||
@ -275,3 +271,12 @@ def test_diamond_dep_flag_mixing(concretize_scope, test_repo):
|
||||
spec1 = root_spec1["y"]
|
||||
assert spec1.satisfies('cflags="-c1 -c2 -d1 -d2 -e1 -e2"')
|
||||
assert spec1.compiler_flags["cflags"] == "-c1 -c2 -e1 -e2 -d1 -d2".split()
|
||||
|
||||
|
||||
def test_flag_injection_different_compilers(mock_packages, mutable_config):
|
||||
"""Tests that flag propagation is not activated on nodes with a compiler that is different
|
||||
from the propagation source.
|
||||
"""
|
||||
s = spack.concretize.concretize_one('mpileaks %gcc cflags=="-O2" ^callpath %llvm')
|
||||
assert s.satisfies('cflags="-O2"') and s["c"].name == "gcc"
|
||||
assert not s["callpath"].satisfies('cflags="-O2"') and s["callpath"]["c"].name == "llvm"
|
||||
|
Loading…
Reference in New Issue
Block a user