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
4 changes: 3 additions & 1 deletion easybuild/tools/systemtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,9 @@ def get_glibc_version():

if os_type == LINUX:
glibc_ver_str = get_tool_version('ldd')
glibc_ver_regex = re.compile(r"^ldd \([^)]*\) (\d[\d.]*).*$")
# note: get_tool_version replaces newlines with ';',
# hence the use of ';' below after the expected glibc version
glibc_ver_regex = re.compile(r"^ldd \(.+\) (\d[\d.]+);")
res = glibc_ver_regex.search(glibc_ver_str)

if res is not None:
Expand Down
9 changes: 8 additions & 1 deletion test/framework/systemtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def mocked_run_cmd(cmd, **kwargs):
"""Mocked version of run_cmd, with specified output for known commands."""
known_cmds = {
"gcc --version": "gcc (GCC) 5.1.1 20150618 (Red Hat 5.1.1-4)",
"ldd --version": "ldd (GNU libc) 2.12",
"ldd --version": "ldd (GNU libc) 2.12; ",
"sysctl -n hw.cpufrequency_max": "2400000000",
"sysctl -n hw.ncpu": '10',
"sysctl -n hw.memsize": '8589934592',
Expand Down Expand Up @@ -791,6 +791,13 @@ def test_glibc_version_linux(self):
st.run_cmd = mocked_run_cmd
self.assertEqual(get_glibc_version(), '2.12')

def test_glibc_version_linux_gentoo(self):
"""Test getting glibc version (mocked for Linux)."""
st.get_os_type = lambda: st.LINUX
ldd_version_out = "ldd (Gentoo 2.37-r3 (patchset 5)) 2.37; Copyright (C) 2023 Free Software Foundation, Inc."
st.get_tool_version = lambda _: ldd_version_out
self.assertEqual(get_glibc_version(), '2.37')

def test_glibc_version_linux_musl_libc(self):
"""Test getting glibc version (mocked for Linux)."""
st.get_os_type = lambda: st.LINUX
Expand Down