Skip to content
Snippets Groups Projects
Commit 94a159f5 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist: Committed by Matthew Webster
Browse files

TEST: MAke sure build env is activated

parent 0a057f31
No related branches found
No related tags found
1 merge request!57TEST: Test fslStartup logic
...@@ -6,20 +6,19 @@ import tempfile ...@@ -6,20 +6,19 @@ import tempfile
import subprocess as sp 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() env = os.environ.copy()
if not keepenv: blacklist = ['OMP', 'GOTO', 'BLAS', 'FSL']
blacklist = ['OMP', 'GOTO', 'BLAS', 'FSL']
for varname in list(env.keys()): for varname in list(env.keys()):
if any(b in varname for b in blacklist): if any(b in varname for b in blacklist):
env.pop(varname) env.pop(varname)
if ompthreads is not None: env['OMP_NUM_THREADS'] = str(ompthreads) if ompthreads is not None: env['OMP_NUM_THREADS'] = str(ompthreads)
if blasthreads is not None: env['BLAS_NUM_THREADS'] = str(blasthreads) if blasthreads is not None: env['BLAS_NUM_THREADS'] = str(blasthreads)
if fslskipglobal is not None: env['FSL_SKIP_GLOBAL'] = str(fslskipglobal) if fslskipglobal is not None: env['FSL_SKIP_GLOBAL'] = str(fslskipglobal)
result = sp.run(shlex.split(cmd), check=True, text=True, result = sp.run(shlex.split(cmd), check=True, text=True,
stdout=sp.PIPE, stderr=sp.STDOUT, env=env) stdout=sp.PIPE, stderr=sp.STDOUT, env=env)
...@@ -33,7 +32,10 @@ def run(cmd, ompthreads=None, blasthreads=None, fslskipglobal=None, keepenv=Fals ...@@ -33,7 +32,10 @@ def run(cmd, ompthreads=None, blasthreads=None, fslskipglobal=None, keepenv=Fals
def main(): 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. # Default behaviour should be: OMP multi-threaded, BLAS single threaded.
assert run('./test_fslStartup', 8, 8) == '8 1 8' assert run('./test_fslStartup', 8, 8) == '8 1 8'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment