Skip to content

Commit

Permalink
mention CPU arch name in --show-system-info output, if archspec is av…
Browse files Browse the repository at this point in the history
…ailable
  • Loading branch information
boegel committed Mar 29, 2020
1 parent 8a1115f commit 1d571f0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
9 changes: 8 additions & 1 deletion easybuild/tools/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -1153,6 +1153,7 @@ def show_system_info(self):
"""Show system information."""
system_info = get_system_info()
cpu_features = get_cpu_features()
cpu_arch_name = system_info['cpu_arch_name']
lines = [
"System information (%s):" % system_info['hostname'],
'',
Expand All @@ -1166,6 +1167,11 @@ def show_system_info(self):
" -> vendor: %s" % system_info['cpu_vendor'],
" -> architecture: %s" % get_cpu_architecture(),
" -> family: %s" % get_cpu_family(),
]
if cpu_arch_name:
lines.append(" -> arch name: %s" % cpu_arch_name)

lines.extend([
" -> model: %s" % system_info['cpu_model'],
" -> speed: %s" % system_info['cpu_speed'],
" -> cores: %s" % system_info['core_count'],
Expand All @@ -1175,7 +1181,8 @@ def show_system_info(self):
" -> glibc version: %s" % system_info['glibc_version'],
" -> Python binary: %s" % sys.executable,
" -> Python version: %s" % sys.version.split(' ')[0],
]
])

return '\n'.join(lines)

def show_config(self):
Expand Down
5 changes: 5 additions & 0 deletions test/framework/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
from easybuild.tools.py2vs3 import URLError, reload, sort_looseversions
from easybuild.tools.toolchain.utilities import TC_CONST_PREFIX
from easybuild.tools.run import run_cmd
from easybuild.tools.systemtools import HAVE_ARCHSPEC
from easybuild.tools.version import VERSION
from test.framework.utilities import EnhancedTestCase, TestLoaderFiltered, init_config

Expand Down Expand Up @@ -4562,6 +4563,10 @@ def test_show_system_info(self):
"^ -> Python binary: .*/[pP]ython[0-9]?",
"^ -> Python version: [0-9.]+",
]

if HAVE_ARCHSPEC:
patterns.append(r"^ -> arch name: \w+")

for pattern in patterns:
regex = re.compile(pattern, re.M)
self.assertTrue(regex.search(txt), "Pattern '%s' found in: %s" % (regex.pattern, txt))
Expand Down

0 comments on commit 1d571f0

Please sign in to comment.