diff --git a/tests/feedsRun b/tests/feedsRun index 5cf41f88c633af15d19ce980ec429669d57d0f7b..6cf9bc4bf51696477e06963dfc201d246a00e0bf 100755 --- a/tests/feedsRun +++ b/tests/feedsRun @@ -1,3 +1,8 @@ #!/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 diff --git a/tests/test_create_remove_wrapper.py b/tests/test_create_remove_wrapper.py index 5ee92a74e649d07e77ca86e24835872d02a8fb98..b2abcce67909f821c1001aab885852158c79e403 100755 --- a/tests/test_create_remove_wrapper.py +++ b/tests/test_create_remove_wrapper.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() diff --git a/tests/test_make_install.py b/tests/test_make_install.py index 81dbeee51043e1468522bdd6eda57597f65c1a45..a82bf51d8e2fd50b1daa17b38f4a5121e7b1ffee 100644 --- a/tests/test_make_install.py +++ b/tests/test_make_install.py @@ -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() diff --git a/tests/test_update_fsl_package.py b/tests/test_update_fsl_package.py index d3818eb44f64158f88b3a51d38ca8d14215dab4a..65a8a6e937f708d9a1be6289afee9a23b785b7d5 100644 --- a/tests/test_update_fsl_package.py +++ b/tests/test_update_fsl_package.py @@ -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)