Use depends_on over load in lmod module files generated by Spack (#28352)
This commit is contained in:
parent
640a4f7dcd
commit
c8e01752a1
@ -96,13 +96,7 @@ def test_autoload_direct(self, modulefile_content, module_configuration):
|
|||||||
module_configuration('autoload_direct')
|
module_configuration('autoload_direct')
|
||||||
content = modulefile_content(mpileaks_spec_string)
|
content = modulefile_content(mpileaks_spec_string)
|
||||||
|
|
||||||
assert len([x for x in content if 'if not isloaded(' in x]) == 2
|
assert len([x for x in content if 'depends_on(' in x]) == 2
|
||||||
assert len([x for x in content if 'load(' in x]) == 2
|
|
||||||
|
|
||||||
# The configuration file doesn't set the verbose keyword
|
|
||||||
# that defaults to False
|
|
||||||
messages = [x for x in content if 'LmodMessage("Autoloading' in x]
|
|
||||||
assert len(messages) == 0
|
|
||||||
|
|
||||||
def test_autoload_all(self, modulefile_content, module_configuration):
|
def test_autoload_all(self, modulefile_content, module_configuration):
|
||||||
"""Tests the automatic loading of all dependencies."""
|
"""Tests the automatic loading of all dependencies."""
|
||||||
@ -110,12 +104,7 @@ def test_autoload_all(self, modulefile_content, module_configuration):
|
|||||||
module_configuration('autoload_all')
|
module_configuration('autoload_all')
|
||||||
content = modulefile_content(mpileaks_spec_string)
|
content = modulefile_content(mpileaks_spec_string)
|
||||||
|
|
||||||
assert len([x for x in content if 'if not isloaded(' in x]) == 5
|
assert len([x for x in content if 'depends_on(' in x]) == 5
|
||||||
assert len([x for x in content if 'load(' in x]) == 5
|
|
||||||
|
|
||||||
# The configuration file sets the verbose keyword to True
|
|
||||||
messages = [x for x in content if 'LmodMessage("Autoloading' in x]
|
|
||||||
assert len(messages) == 5
|
|
||||||
|
|
||||||
def test_alter_environment(self, modulefile_content, module_configuration):
|
def test_alter_environment(self, modulefile_content, module_configuration):
|
||||||
"""Tests modifications to run-time environment."""
|
"""Tests modifications to run-time environment."""
|
||||||
@ -158,8 +147,7 @@ def test_blacklist(self, modulefile_content, module_configuration):
|
|||||||
module_configuration('blacklist')
|
module_configuration('blacklist')
|
||||||
content = modulefile_content(mpileaks_spec_string)
|
content = modulefile_content(mpileaks_spec_string)
|
||||||
|
|
||||||
assert len([x for x in content if 'if not isloaded(' in x]) == 1
|
assert len([x for x in content if 'depends_on(' in x]) == 1
|
||||||
assert len([x for x in content if 'load(' in x]) == 1
|
|
||||||
|
|
||||||
def test_no_hash(self, factory, module_configuration):
|
def test_no_hash(self, factory, module_configuration):
|
||||||
"""Makes sure that virtual providers (in the hierarchy) always
|
"""Makes sure that virtual providers (in the hierarchy) always
|
||||||
|
@ -62,12 +62,7 @@ setenv("LMOD_{{ name|upper() }}_VERSION", "{{ version_part }}")
|
|||||||
|
|
||||||
{% block autoloads %}
|
{% block autoloads %}
|
||||||
{% for module in autoload %}
|
{% for module in autoload %}
|
||||||
if not isloaded("{{ module }}") then
|
depends_on("{{ module }}")
|
||||||
{% if verbose %}
|
|
||||||
LmodMessage("Autoloading {{ module }}")
|
|
||||||
{% endif %}
|
|
||||||
load("{{ module }}")
|
|
||||||
end
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user