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
fslpython ./test_create_remove_wrapper.py ${FSLDIR}
\ No newline at end of file
set -e
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__':
REMOVE_WRAPPER = op.join(SBIN_DIR, 'removeFSLWrapper')
thismod = sys.modules[__name__]
for test in dir(thismod):
if test.startswith('test_'):
test = getattr(thismod, test)
for testname in dir(thismod):
if testname.startswith('test_'):
test = getattr(thismod, testname)
if callable(test):
print(f'Running test {testname}')
test()
......@@ -3,12 +3,31 @@
import os
import sys
import shlex
import os.path as op
import subprocess as sp
import tempfile
def test_make_install():
basedir = op.join(op.dirname(__file__), '..')
env = os.environ.copy()
with tempfile.TemporaryDirectory() as 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 @@
import os
import os.path as op
import tempfile
import shlex
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():
fsldir = os.environ['FSLDIR']
cmd = op.join(fsldir, 'share', 'fsl', 'sbin', 'update_fsl_package')
sp.run(f'{cmd} -y -a -d -e --verbose --dry_run', check=True)
sp.run(f'{cmd} -y -a -d --verbose --dry_run', check=True)
sp.run(f'{cmd} -y -a -e --verbose --dry_run', check=True)
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)
if __name__ == '__main__':
if len(sys.argv) > 1:
prefix = sys.argv[1]
else:
prefix = op.join(op.dirname(__file__), '..')
test_update_fsl_package(prefix)
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