Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions reframe/frontend/autodetect.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,7 @@ def _emit_script(job):
def detect_topology():
rt = runtime()
detect_remote_systems = rt.get_option('general/0/remote_detect')
config_file = rt.site_config.filename
if config_file == '<builtin>':
config_prefix = os.path.join(
os.getenv('HOME'), '.reframe/topology'
)
else:
config_prefix = os.path.join(os.path.dirname(config_file), '_meta')

topo_prefix = os.path.join(os.getenv('HOME'), '.reframe/topology')
for part in rt.system.partitions:
getlogger().debug(f'detecting topology info for {part.fullname}')
found_procinfo = False
Expand All @@ -184,10 +177,10 @@ def detect_topology():
continue

topo_file = os.path.join(
config_prefix, f'{rt.system.name}-{part.name}', 'processor.json'
topo_prefix, f'{rt.system.name}-{part.name}', 'processor.json'
)
dev_file = os.path.join(
config_prefix, f'{rt.system.name}-{part.name}', 'devices.json'
topo_prefix, f'{rt.system.name}-{part.name}', 'devices.json'
)
if not found_procinfo and os.path.exists(topo_file):
getlogger().debug(
Expand Down
12 changes: 5 additions & 7 deletions unittests/test_autodetect.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import json
import os
import pytest
import shutil


from reframe.core.runtime import runtime
Expand All @@ -15,13 +14,12 @@


@pytest.fixture
def exec_ctx(make_exec_ctx_g, tmp_path):
# Copy the default settings to the temp dir
config_file = tmp_path / 'conf.py'
shutil.copy('reframe/core/settings.py', config_file)
def exec_ctx(make_exec_ctx_g, tmp_path, monkeypatch):
# Monkey-patch HOME, since topology is always written there
monkeypatch.setenv('HOME', str(tmp_path))

# Create a devices file manually, since it is not auto-generated
meta_prefix = tmp_path / '_meta' / 'generic-default'
meta_prefix = tmp_path / '.reframe' / 'topology' / 'generic-default'
os.makedirs(meta_prefix)
with open(meta_prefix / 'devices.json', 'w') as fp:
json.dump([
Expand All @@ -32,7 +30,7 @@ def exec_ctx(make_exec_ctx_g, tmp_path):
}
], fp)

yield from make_exec_ctx_g(config_file)
yield from make_exec_ctx_g()


def test_autotect(exec_ctx):
Expand Down
10 changes: 2 additions & 8 deletions unittests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import os
import pytest
import re
import shutil
import sys

import reframe.core.environments as env
Expand Down Expand Up @@ -54,13 +53,7 @@ def perflogdir(tmp_path):


@pytest.fixture
def rm_config_meta():
yield
shutil.rmtree('unittests/resources/_meta', ignore_errors=True)


@pytest.fixture
def run_reframe(tmp_path, perflogdir, rm_config_meta):
def run_reframe(tmp_path, perflogdir, monkeypatch):
def _run_reframe(system='generic:default',
checkpath=['unittests/resources/checks/hellocheck.py'],
environs=['builtin'],
Expand Down Expand Up @@ -113,6 +106,7 @@ def _run_reframe(system='generic:default',

return run_command_inline(argv, cli.main)

monkeypatch.setenv('HOME', str(tmp_path))
return _run_reframe


Expand Down