@@ -325,7 +325,7 @@ def mocked_run_cmd(cmd, **kwargs):
325325 """Mocked version of run_cmd, with specified output for known commands."""
326326 known_cmds = {
327327 "gcc --version" : "gcc (GCC) 5.1.1 20150618 (Red Hat 5.1.1-4)" ,
328- "ldd --version" : "ldd (GNU libc) 2.12" ,
328+ "ldd --version" : "ldd (GNU libc) 2.12; " ,
329329 "sysctl -n hw.cpufrequency_max" : "2400000000" ,
330330 "sysctl -n hw.ncpu" : '10' ,
331331 "sysctl -n hw.memsize" : '8589934592' ,
@@ -791,6 +791,13 @@ def test_glibc_version_linux(self):
791791 st .run_cmd = mocked_run_cmd
792792 self .assertEqual (get_glibc_version (), '2.12' )
793793
794+ def test_glibc_version_linux_gentoo (self ):
795+ """Test getting glibc version (mocked for Linux)."""
796+ st .get_os_type = lambda : st .LINUX
797+ ldd_version_out = "ldd (Gentoo 2.37-r3 (patchset 5)) 2.37; Copyright (C) 2023 Free Software Foundation, Inc."
798+ st .get_tool_version = lambda _ : ldd_version_out
799+ self .assertEqual (get_glibc_version (), '2.37' )
800+
794801 def test_glibc_version_linux_musl_libc (self ):
795802 """Test getting glibc version (mocked for Linux)."""
796803 st .get_os_type = lambda : st .LINUX
0 commit comments