Skip to content
Snippets Groups Projects
Commit 39a16bf0 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

TEST: actually run all of the tests

parent f59affa2
No related branches found
No related tags found
1 merge request!46Mnt/update fsl package
#!/usr/bin/env bash #!/usr/bin/env bash
fslpython ./test_create_remove_wrapper.py ${FSLDIR} set -e
\ No newline at end of file
fslpython ./test_create_remove_wrapper.py ${FSLDIR}
fslpython ./test_make_install.py
fslpython ./test_create_remove_wrapper.py
fslpython ./test_update_fsl_package.py
...@@ -314,8 +314,9 @@ if __name__ == '__main__': ...@@ -314,8 +314,9 @@ if __name__ == '__main__':
REMOVE_WRAPPER = op.join(SBIN_DIR, 'removeFSLWrapper') REMOVE_WRAPPER = op.join(SBIN_DIR, 'removeFSLWrapper')
thismod = sys.modules[__name__] thismod = sys.modules[__name__]
for test in dir(thismod): for testname in dir(thismod):
if test.startswith('test_'): if testname.startswith('test_'):
test = getattr(thismod, test) test = getattr(thismod, testname)
if callable(test): if callable(test):
print(f'Running test {testname}')
test() test()
...@@ -3,12 +3,31 @@ ...@@ -3,12 +3,31 @@
import os import os
import sys import sys
import shlex
import os.path as op import os.path as op
import subprocess as sp import subprocess as sp
import tempfile import tempfile
def test_make_install(): def test_make_install():
basedir = op.join(op.dirname(__file__), '..')
env = os.environ.copy() env = os.environ.copy()
with tempfile.TemporaryDirectory() as td: with tempfile.TemporaryDirectory() as td:
env['FSLDEVDIR'] = td env['FSLDEVDIR'] = td
sp.run(('make', 'install'), env=env, check=True) cmd = f'make -C "{basedir}" install'
print(f'running FSLDEVDIR={td} {cmd}')
sp.run(shlex.split(cmd), env=env, check=True)
for dirpath, dirnames, filenames in os.walk(td):
dirpath = dirpath.replace(td, '${FSLDEVDIR}')
print(dirpath)
for filename in filenames:
print(' ', filename)
if __name__ == '__main__':
test_make_install()
...@@ -3,18 +3,32 @@ ...@@ -3,18 +3,32 @@
import os import os
import os.path as op import os.path as op
import tempfile import shlex
import subprocess as sp import subprocess as sp
import sys
import tempfile
def sprun(cmd):
print(f'Running: {cmd}')
sp.run(shlex.split(cmd), check=True)
def test_update_fsl_package(prefix):
cmd = op.join(prefix, 'share', 'fsl', 'sbin', 'update_fsl_package')
sprun(f'{cmd} -y -a -d -e --verbose --dry_run')
sprun(f'{cmd} -y -a -d --verbose --dry_run')
sprun(f'{cmd} -y -a -e --verbose --dry_run')
sprun(f'{cmd} -y -a --verbose --dry_run')
sprun(f'{cmd} -y -d --verbose --dry_run fsleyes')
sprun(f'{cmd} -y -d --verbose --dry_run fsl-base')
sprun(f'{cmd} -y --verbose --dry_run fsleyes')
sprun(f'{cmd} -y --verbose --dry_run fsl-base')
def test_update_fsl_package(): if __name__ == '__main__':
fsldir = os.environ['FSLDIR'] if len(sys.argv) > 1:
cmd = op.join(fsldir, 'share', 'fsl', 'sbin', 'update_fsl_package') prefix = sys.argv[1]
sp.run(f'{cmd} -y -a -d -e --verbose --dry_run', check=True) else:
sp.run(f'{cmd} -y -a -d --verbose --dry_run', check=True) prefix = op.join(op.dirname(__file__), '..')
sp.run(f'{cmd} -y -a -e --verbose --dry_run', check=True) test_update_fsl_package(prefix)
sp.run(f'{cmd} -y -a --verbose --dry_run', check=True)
sp.run(f'{cmd} -y -d --verbose --dry_run fsleyes', check=True)
sp.run(f'{cmd} -y -d --verbose --dry_run fsl-base', check=True)
sp.run(f'{cmd} -y --verbose --dry_run fsleyes', check=True)
sp.run(f'{cmd} -y --verbose --dry_run fsl-base', check=True)
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