Skip to content
Snippets Groups Projects

TEST: Test fslStartup logic

Merged Paul McCarthy requested to merge test/fslstartup into master
@@ -6,20 +6,19 @@ import tempfile
import subprocess as sp
def run(cmd, ompthreads=None, blasthreads=None, fslskipglobal=None, keepenv=False):
def run(cmd, ompthreads=None, blasthreads=None, fslskipglobal=None):
env = os.environ.copy()
if not keepenv:
blacklist = ['OMP', 'GOTO', 'BLAS', 'FSL']
blacklist = ['OMP', 'GOTO', 'BLAS', 'FSL']
for varname in list(env.keys()):
if any(b in varname for b in blacklist):
env.pop(varname)
for varname in list(env.keys()):
if any(b in varname for b in blacklist):
env.pop(varname)
if ompthreads is not None: env['OMP_NUM_THREADS'] = str(ompthreads)
if blasthreads is not None: env['BLAS_NUM_THREADS'] = str(blasthreads)
if fslskipglobal is not None: env['FSL_SKIP_GLOBAL'] = str(fslskipglobal)
if ompthreads is not None: env['OMP_NUM_THREADS'] = str(ompthreads)
if blasthreads is not None: env['BLAS_NUM_THREADS'] = str(blasthreads)
if fslskipglobal is not None: env['FSL_SKIP_GLOBAL'] = str(fslskipglobal)
result = sp.run(shlex.split(cmd), check=True, text=True,
stdout=sp.PIPE, stderr=sp.STDOUT, env=env)
@@ -33,7 +32,10 @@ def run(cmd, ompthreads=None, blasthreads=None, fslskipglobal=None, keepenv=Fals
def main():
run('make', keepenv=True)
buildcmds = ['source $FSLDIR/bin/activate $FSLDIR',
'source $FSLDIR/etc/fslconf/fsl-devel.sh',
'make']
sp.run('; '.join(buildcmds), check=True, shell=True)
# Default behaviour should be: OMP multi-threaded, BLAS single threaded.
assert run('./test_fslStartup', 8, 8) == '8 1 8'
Loading