diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2f1e5c004f98206199ccfc60a52b9f6cf8e6f883..29474c282a8b175af079a555d0576c2993bf5b36 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,17 +1,29 @@ include: -- file: .gitlab-ci.yml - project: fsl/fsl-ci-rules + - file: .gitlab-ci.yml + project: fsl/fsl-ci-rules + stages: -- test -- fsl-ci-pre -- fsl-ci-build -- fsl-ci-test -- fsl-ci-deploy -test: + - test + - fsl-ci-pre + - fsl-ci-build + - fsl-ci-test + - fsl-ci-deploy + +test:linux: image: python:3.7 script: - - pip install pytest - - pytest -v .ci + - pip install pytest + - pytest -v tests stage: test tags: - - docker + - docker + +test:macos: + image: python:3.7 + script: + - pip install pytest + - pytest -v tests + stage: test + tags: + - macOS + - shell \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 84a7c77a4d4cf0a3b4f34b292f55386c1aee9bf3..7902e512f47c7d60c089d29d86829075fe742242 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # FSL base project changelog + +## 2106.2 (Tuesday 22nd June 2021) + + - Fixed an issue with `createFSLWrapper` on macOS. + + ## 2106.1 (Friday 6th June 2021) - Updated the `supportedGencodes.sh` script to add JIT targets for CUDA diff --git a/share/fsl/sbin/createFSLWrapper b/share/fsl/sbin/createFSLWrapper index a2eb101da26a37866b4831131808cc6743fd6a2f..105efc8c4fd3955f6538f6276a57623575da9719 100755 --- a/share/fsl/sbin/createFSLWrapper +++ b/share/fsl/sbin/createFSLWrapper @@ -109,5 +109,10 @@ for script in $targets; do fi # Preserve file permissions - chmod --reference="$sourceScript" "$targetScript" + if [[ "$OSTYPE" == "darwin"* ]]; then + perms=$(stat -f "%A" "$sourceScript") + chmod ${perms} "$targetScript" + else + chmod --reference="$sourceScript" "$targetScript" + fi done diff --git a/tests/feedsRun b/tests/feedsRun new file mode 100755 index 0000000000000000000000000000000000000000..5cf41f88c633af15d19ce980ec429669d57d0f7b --- /dev/null +++ b/tests/feedsRun @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +fslpython ./test_create_remove_wrapper.py ${FSLDIR} \ No newline at end of file diff --git a/.ci/test_create_remove_wrapper.py b/tests/test_create_remove_wrapper.py similarity index 86% rename from .ci/test_create_remove_wrapper.py rename to tests/test_create_remove_wrapper.py index 0bf71052a58df2cf8eb87de01118caa336ba793c..859568ddcaf1eb16d3af36af8b13f081f07b119f 100755 --- a/.ci/test_create_remove_wrapper.py +++ b/tests/test_create_remove_wrapper.py @@ -1,12 +1,13 @@ #!/usr/bin/env python # # test_create_remove_wrapper.py - Test the createFSLWrapper.sh and -# removeFSLWrapper.sh scripts. Requires Python 3.7. +# removeFSLWrapper.sh scripts. Requires Python>=3.7. # # Author: Paul McCarthy <pauldmccarthy@gmail.com> # +import sys import os.path as op import subprocess as sp import textwrap as tw @@ -18,6 +19,11 @@ import contextlib from unittest import mock +# Paths to create/remove wrapper scripts, when +# running from an in-source version. These may +# be overwritten within the __main__ clause at +# the bottom, where BASE_DIR may be provided +# as a command-line argument. BASE_DIR = op.abspath(op.join(op.dirname(__file__), '..')) CREATE_WRAPPER = op.join(BASE_DIR, 'share', 'fsl', 'sbin', 'createFSLWrapper') REMOVE_WRAPPER = op.join(BASE_DIR, 'share', 'fsl', 'sbin', 'removeFSLWrapper') @@ -176,3 +182,19 @@ def test_create_remove_wrappers(): assert not op.exists(op.join(wrapperdir, 'test_script1')) assert not op.exists(op.join(wrapperdir, 'test_script2')) + + +if __name__ == '__main__': + # base dir can be speecified on command line + if len(sys.argv) > 1: + BASE_DIR = sys.argv[1] + SBIN_DIR = op.join(BASE_DIR, 'share', 'fsl', 'sbin') + CREATE_WRAPPER = op.join(SBIN_DIR, 'createFSLWrapper') + REMOVE_WRAPPER = op.join(SBIN_DIR, 'removeFSLWrapper') + + thismod = sys.modules[__name__] + for test in dir(thismod): + if test.startswith('test_'): + test = getattr(thismod, test) + if callable(test): + test()