Skip to content

Commit 02434d9

Browse files
committed
Don't try to run flexiblas command in unit-testing mode
1 parent 02a2183 commit 02434d9

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

easybuild/toolchains/linalg/flexiblas.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
from easybuild.tools.toolchain.linalg import LinAlg
3636

37+
from easybuild.tools.options import build_option
3738
from easybuild.tools.run import run_shell_cmd
3839
from easybuild.tools.systemtools import get_shared_lib_ext
3940

@@ -48,18 +49,20 @@ def det_flexiblas_backend_libs():
4849
# System-wide (config directory):
4950
# OPENBLAS
5051
# library = libflexiblas_openblas.so
51-
res = run_shell_cmd("flexiblas list", hidden=True)
52-
53-
shlib_ext = get_shared_lib_ext()
54-
flexiblas_lib_regex = re.compile(r'library = (?P<lib>lib.*\.%s)' % shlib_ext, re.M)
55-
flexiblas_libs = flexiblas_lib_regex.findall(res.output)
56-
5752
backend_libs = []
58-
for flexiblas_lib in flexiblas_libs:
59-
# assumption here is that the name of FlexiBLAS library (like 'libflexiblas_openblas.so')
60-
# maps directly to name of the backend library ('libopenblas.so')
61-
backend_lib = 'lib' + flexiblas_lib.replace('libflexiblas_', '')
62-
backend_libs.append(backend_lib)
53+
# in a unittest context the flexiblas command does not exist, but in a normal context it always does
54+
if not build_option('unit_testing_mode'):
55+
res = run_shell_cmd("flexiblas list", hidden=True)
56+
57+
shlib_ext = get_shared_lib_ext()
58+
flexiblas_lib_regex = re.compile(r'library = (?P<lib>lib.*\.%s)' % shlib_ext, re.M)
59+
flexiblas_libs = flexiblas_lib_regex.findall(res.output)
60+
61+
for flexiblas_lib in flexiblas_libs:
62+
# assumption here is that the name of FlexiBLAS library (like 'libflexiblas_openblas.so')
63+
# maps directly to name of the backend library ('libopenblas.so')
64+
backend_lib = 'lib' + flexiblas_lib.replace('libflexiblas_', '')
65+
backend_libs.append(backend_lib)
6366

6467
return backend_libs
6568

0 commit comments

Comments
 (0)