update compiler config with bootstrapped compiler when already installed (#16221)
Update compiler config with bootstrapped compiler when it was already installed and added config defaults to code so mutable_config test fixture works.
This commit is contained in:
@@ -415,7 +415,7 @@ def _set_variables_for_single_module(pkg, module):
|
||||
if getattr(module, marker, False):
|
||||
return
|
||||
|
||||
jobs = spack.config.get('config:build_jobs') if pkg.parallel else 1
|
||||
jobs = spack.config.get('config:build_jobs', 16) if pkg.parallel else 1
|
||||
jobs = min(jobs, multiprocessing.cpu_count())
|
||||
assert jobs is not None, "no default set for config:build_jobs"
|
||||
|
||||
|
@@ -111,7 +111,7 @@ def __call__(self, parser, namespace, jobs, option_string):
|
||||
def default(self):
|
||||
# This default is coded as a property so that look-up
|
||||
# of this value is done only on demand
|
||||
return min(spack.config.get('config:build_jobs'),
|
||||
return min(spack.config.get('config:build_jobs', 16),
|
||||
multiprocessing.cpu_count())
|
||||
|
||||
@default.setter
|
||||
|
@@ -336,7 +336,7 @@ def _fetch_from_url(self, url):
|
||||
else:
|
||||
curl_args.append('-sS') # just errors when not.
|
||||
|
||||
connect_timeout = spack.config.get('config:connect_timeout')
|
||||
connect_timeout = spack.config.get('config:connect_timeout', 10)
|
||||
|
||||
if self.extra_options:
|
||||
cookie = self.extra_options.get('cookie')
|
||||
|
@@ -1466,6 +1466,12 @@ def install(self, **kwargs):
|
||||
if lock is not None:
|
||||
self._update_installed(task)
|
||||
_print_installed_pkg(pkg.prefix)
|
||||
|
||||
# It's an already installed compiler, add it to the config
|
||||
if task.compiler:
|
||||
spack.compilers.add_compilers_to_config(
|
||||
spack.compilers.find_compilers([pkg.spec.prefix]))
|
||||
|
||||
else:
|
||||
# At this point we've failed to get a write or a read
|
||||
# lock, which means another process has taken a write
|
||||
|
@@ -15,11 +15,12 @@
|
||||
import llnl.util.filesystem as fs
|
||||
|
||||
import spack.config
|
||||
import spack.compilers as compilers
|
||||
import spack.hash_types as ht
|
||||
import spack.package
|
||||
import spack.cmd.install
|
||||
from spack.error import SpackError
|
||||
from spack.spec import Spec
|
||||
from spack.spec import Spec, CompilerSpec
|
||||
from spack.main import SpackCommand
|
||||
import spack.environment as ev
|
||||
|
||||
@@ -718,3 +719,30 @@ def test_cdash_auth_token(tmpdir, install_mockery, capfd):
|
||||
'--log-format=cdash',
|
||||
'a')
|
||||
assert 'Using CDash auth token from environment' in out
|
||||
|
||||
|
||||
def test_compiler_bootstrap(
|
||||
install_mockery, mock_packages, mock_fetch, mock_archive,
|
||||
mutable_config, monkeypatch):
|
||||
monkeypatch.setattr(spack.concretize.Concretizer,
|
||||
'check_for_compiler_existence', False)
|
||||
spack.config.set('config:install_missing_compilers', True)
|
||||
assert CompilerSpec('gcc@2.0') not in compilers.all_compiler_specs()
|
||||
|
||||
# Test succeeds if it does not raise an error
|
||||
install('a%gcc@2.0')
|
||||
|
||||
|
||||
@pytest.mark.regression('16221')
|
||||
def test_compiler_bootstrap_already_installed(
|
||||
install_mockery, mock_packages, mock_fetch, mock_archive,
|
||||
mutable_config, monkeypatch):
|
||||
monkeypatch.setattr(spack.concretize.Concretizer,
|
||||
'check_for_compiler_existence', False)
|
||||
spack.config.set('config:install_missing_compilers', True)
|
||||
|
||||
assert CompilerSpec('gcc@2.0') not in compilers.all_compiler_specs()
|
||||
|
||||
# Test succeeds if it does not raise an error
|
||||
install('gcc@2.0')
|
||||
install('a%gcc@2.0')
|
||||
|
Reference in New Issue
Block a user