This reverts commit 330832c22c
.
This commit is contained in:
parent
6fd07479e3
commit
3d43ebec72
26
lib/spack/env/cc
vendored
26
lib/spack/env/cc
vendored
@ -401,8 +401,7 @@ input_command="$*"
|
|||||||
# command line and recombine them with Spack arguments later. We
|
# command line and recombine them with Spack arguments later. We
|
||||||
# parse these out so that we can make sure that system paths come
|
# parse these out so that we can make sure that system paths come
|
||||||
# last, that package arguments come first, and that Spack arguments
|
# last, that package arguments come first, and that Spack arguments
|
||||||
# are injected properly. Based on configuration, we also strip -Werror
|
# are injected properly.
|
||||||
# arguments.
|
|
||||||
#
|
#
|
||||||
# All other arguments, including -l arguments, are treated as
|
# All other arguments, including -l arguments, are treated as
|
||||||
# 'other_args' and left in their original order. This ensures that
|
# 'other_args' and left in their original order. This ensures that
|
||||||
@ -441,29 +440,6 @@ while [ $# -ne 0 ]; do
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${SPACK_COMPILER_FLAGS_KEEP}" ] ; then
|
|
||||||
# NOTE: the eval is required to allow `|` alternatives inside the variable
|
|
||||||
eval "\
|
|
||||||
case '$1' in
|
|
||||||
$SPACK_COMPILER_FLAGS_KEEP)
|
|
||||||
append other_args_list "$1"
|
|
||||||
shift
|
|
||||||
continue
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
"
|
|
||||||
fi
|
|
||||||
if [ -n "${SPACK_COMPILER_FLAGS_REMOVE}" ] ; then
|
|
||||||
eval "\
|
|
||||||
case '$1' in
|
|
||||||
$SPACK_COMPILER_FLAGS_REMOVE)
|
|
||||||
shift
|
|
||||||
continue
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
"
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-isystem*)
|
-isystem*)
|
||||||
arg="${1#-isystem}"
|
arg="${1#-isystem}"
|
||||||
|
@ -242,17 +242,6 @@ def clean_environment():
|
|||||||
# show useful matches.
|
# show useful matches.
|
||||||
env.set('LC_ALL', build_lang)
|
env.set('LC_ALL', build_lang)
|
||||||
|
|
||||||
remove_flags = set()
|
|
||||||
keep_flags = set()
|
|
||||||
if spack.config.get('config:flags:keep_werror') == 'all':
|
|
||||||
keep_flags.add('-Werror*')
|
|
||||||
else:
|
|
||||||
if spack.config.get('config:flags:keep_werror') == 'specific':
|
|
||||||
keep_flags.add('-Werror=*')
|
|
||||||
remove_flags.add('-Werror*')
|
|
||||||
env.set('SPACK_COMPILER_FLAGS_KEEP', '|'.join(keep_flags))
|
|
||||||
env.set('SPACK_COMPILER_FLAGS_REMOVE', '|'.join(remove_flags))
|
|
||||||
|
|
||||||
# Remove any macports installs from the PATH. The macports ld can
|
# Remove any macports installs from the PATH. The macports ld can
|
||||||
# cause conflicts with the built-in linker on el capitan. Solves
|
# cause conflicts with the built-in linker on el capitan. Solves
|
||||||
# assembler issues, e.g.:
|
# assembler issues, e.g.:
|
||||||
|
@ -105,9 +105,6 @@
|
|||||||
'build_stage': '$tempdir/spack-stage',
|
'build_stage': '$tempdir/spack-stage',
|
||||||
'concretizer': 'clingo',
|
'concretizer': 'clingo',
|
||||||
'license_dir': spack.paths.default_license_dir,
|
'license_dir': spack.paths.default_license_dir,
|
||||||
'flags': {
|
|
||||||
'keep_werror': 'none',
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,16 +91,7 @@
|
|||||||
'additional_external_search_paths': {
|
'additional_external_search_paths': {
|
||||||
'type': 'array',
|
'type': 'array',
|
||||||
'items': {'type': 'string'}
|
'items': {'type': 'string'}
|
||||||
},
|
}
|
||||||
'flags': {
|
|
||||||
'type': 'object',
|
|
||||||
'properties': {
|
|
||||||
'keep_werror': {
|
|
||||||
'type': 'string',
|
|
||||||
'enum': ['all', 'specific', 'none'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
'deprecatedProperties': {
|
'deprecatedProperties': {
|
||||||
'properties': ['module_roots'],
|
'properties': ['module_roots'],
|
||||||
|
@ -12,9 +12,6 @@
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import spack.build_environment
|
|
||||||
import spack.config
|
|
||||||
import spack.spec
|
|
||||||
from spack.paths import build_env_path
|
from spack.paths import build_env_path
|
||||||
from spack.util.environment import set_env, system_dirs
|
from spack.util.environment import set_env, system_dirs
|
||||||
from spack.util.executable import Executable, ProcessError
|
from spack.util.executable import Executable, ProcessError
|
||||||
@ -132,9 +129,7 @@ def wrapper_environment():
|
|||||||
SPACK_TARGET_ARGS="-march=znver2 -mtune=znver2",
|
SPACK_TARGET_ARGS="-march=znver2 -mtune=znver2",
|
||||||
SPACK_LINKER_ARG='-Wl,',
|
SPACK_LINKER_ARG='-Wl,',
|
||||||
SPACK_DTAGS_TO_ADD='--disable-new-dtags',
|
SPACK_DTAGS_TO_ADD='--disable-new-dtags',
|
||||||
SPACK_DTAGS_TO_STRIP='--enable-new-dtags',
|
SPACK_DTAGS_TO_STRIP='--enable-new-dtags'):
|
||||||
SPACK_COMPILER_FLAGS_KEEP='',
|
|
||||||
SPACK_COMPILER_FLAGS_REMOVE='-Werror*',):
|
|
||||||
yield
|
yield
|
||||||
|
|
||||||
|
|
||||||
@ -162,21 +157,6 @@ def check_args(cc, args, expected):
|
|||||||
assert expected == cc_modified_args
|
assert expected == cc_modified_args
|
||||||
|
|
||||||
|
|
||||||
def check_args_contents(cc, args, must_contain, must_not_contain):
|
|
||||||
"""Check output arguments that cc produces when called with args.
|
|
||||||
|
|
||||||
This assumes that cc will print debug command output with one element
|
|
||||||
per line, so that we see whether arguments that should (or shouldn't)
|
|
||||||
contain spaces are parsed correctly.
|
|
||||||
"""
|
|
||||||
with set_env(SPACK_TEST_COMMAND='dump-args'):
|
|
||||||
cc_modified_args = cc(*args, output=str).strip().split('\n')
|
|
||||||
for a in must_contain:
|
|
||||||
assert a in cc_modified_args
|
|
||||||
for a in must_not_contain:
|
|
||||||
assert a not in cc_modified_args
|
|
||||||
|
|
||||||
|
|
||||||
def check_env_var(executable, var, expected):
|
def check_env_var(executable, var, expected):
|
||||||
"""Check environment variables updated by the passed compiler wrapper
|
"""Check environment variables updated by the passed compiler wrapper
|
||||||
|
|
||||||
@ -662,63 +642,6 @@ def test_no_ccache_prepend_for_fc(wrapper_environment):
|
|||||||
common_compile_args)
|
common_compile_args)
|
||||||
|
|
||||||
|
|
||||||
def test_keep_and_remove(wrapper_environment):
|
|
||||||
werror_specific = ['-Werror=meh']
|
|
||||||
werror = ['-Werror']
|
|
||||||
werror_all = werror_specific + werror
|
|
||||||
with set_env(
|
|
||||||
SPACK_COMPILER_FLAGS_KEEP='',
|
|
||||||
SPACK_COMPILER_FLAGS_REMOVE='-Werror*',
|
|
||||||
):
|
|
||||||
check_args_contents(cc, test_args + werror_all, ['-Wl,--end-group'], werror_all)
|
|
||||||
with set_env(
|
|
||||||
SPACK_COMPILER_FLAGS_KEEP='-Werror=*',
|
|
||||||
SPACK_COMPILER_FLAGS_REMOVE='-Werror*',
|
|
||||||
):
|
|
||||||
check_args_contents(cc, test_args + werror_all, werror_specific, werror)
|
|
||||||
with set_env(
|
|
||||||
SPACK_COMPILER_FLAGS_KEEP='-Werror=*',
|
|
||||||
SPACK_COMPILER_FLAGS_REMOVE='-Werror*|-llib1|-Wl*',
|
|
||||||
):
|
|
||||||
check_args_contents(
|
|
||||||
cc,
|
|
||||||
test_args + werror_all,
|
|
||||||
werror_specific,
|
|
||||||
werror + ["-llib1", "-Wl,--rpath"]
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('cfg_override,initial,expected,must_be_gone', [
|
|
||||||
# Set and unset variables
|
|
||||||
('config:flags:keep_werror:all',
|
|
||||||
['-Werror', '-Werror=specific', '-bah'],
|
|
||||||
['-Werror', '-Werror=specific', '-bah'],
|
|
||||||
[],
|
|
||||||
),
|
|
||||||
('config:flags:keep_werror:specific',
|
|
||||||
['-Werror', '-Werror=specific', '-bah'],
|
|
||||||
['-Werror=specific', '-bah'],
|
|
||||||
['-Werror'],
|
|
||||||
),
|
|
||||||
('config:flags:keep_werror:none',
|
|
||||||
['-Werror', '-Werror=specific', '-bah'],
|
|
||||||
['-bah'],
|
|
||||||
['-Werror', '-Werror=specific'],
|
|
||||||
),
|
|
||||||
])
|
|
||||||
@pytest.mark.usefixtures('wrapper_environment', 'mutable_config')
|
|
||||||
def test_flag_modification(cfg_override, initial, expected, must_be_gone):
|
|
||||||
spack.config.add(cfg_override)
|
|
||||||
env = spack.build_environment.clean_environment()
|
|
||||||
env.apply_modifications()
|
|
||||||
check_args_contents(
|
|
||||||
cc,
|
|
||||||
test_args + initial,
|
|
||||||
expected,
|
|
||||||
must_be_gone
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.regression('9160')
|
@pytest.mark.regression('9160')
|
||||||
def test_disable_new_dtags(wrapper_environment, wrapper_flags):
|
def test_disable_new_dtags(wrapper_environment, wrapper_flags):
|
||||||
with set_env(SPACK_TEST_COMMAND='dump-args'):
|
with set_env(SPACK_TEST_COMMAND='dump-args'):
|
||||||
|
Loading…
Reference in New Issue
Block a user