Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pyfeeds-tests
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FSL
pyfeeds-tests
Commits
4004ee9b
Commit
4004ee9b
authored
2 months ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
MNT: Adjust fslStartup test to support micromamba-based installations
parent
ee2d9375
No related branches found
Branches containing commit
Tags
2501.0
1 merge request
!71
MNT: Adjust `fslStartup` test to support micromamba-based installations
Pipeline
#26931
passed
2 months ago
Stage: fsl-ci-build
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
unit_tests/utils/feedsRun.fslStartup
+36
-13
36 additions, 13 deletions
unit_tests/utils/feedsRun.fslStartup
with
36 additions
and
13 deletions
unit_tests/utils/feedsRun.fslStartup
+
36
−
13
View file @
4004ee9b
#!/usr/bin/env fslpython
#Note this script requires a conda activate script to be on the PATH
# Note this script attempts to activate the $FSLDIR conda environment in
# order to compile the test_fslStartup.cc program. Therefore this script
# expects one of the following to be true:
#
# - A $FSLDIR/bin/activate script to be present
# - A $FSLDIR/bin/micromamba executable to be present
#
import os
import os.path as op
import shlex
import sys
import tempfile
...
...
@@ -35,22 +42,38 @@ def run(cmd, ompthreads=None, blasthreads=None, fslskipglobal=None):
return result.stdout.strip().split('\n')[-1]
def main():
env = os.environ.copy()
activatePath = Path(f'''{env['FSLDIR']}/bin/activate''')
if not activatePath.is_file():
activatePath='activate'
def genActivateCommand():
fsldir = os.environ['FSLDIR']
mmbin = f'{fsldir}/bin/micromamba'
activate = f'{fsldir}/bin/activate'
if op.exists(mmbin):
return '; '.join([
f'eval $({mmbin} shell hook --shell posix)',
f'micromamba activate {fsldir}'])
outdir = Path(sys.argv[1])
elif op.exists(activate):
return f'source {activate} {fsldir}'
buildcmds = [f'''source {activatePath} $FSLDIR''',
'source $FSLDIR/etc/fslconf/fsl-devel.sh',
f'''cp Makefile test_fslStartup.cc {outdir}''',
f'''cd {outdir}''',
'make']
# hope that there's an activate script/func available
else:
return f'source activate {fsldir}'
def main():
fsldir = os.environ['FSLDIR']
outdir = Path(sys.argv[1])
buildcmds = [
genActivateCommand(),
f'source {fsldir}/etc/fslconf/fsl-devel.sh',
f'cp Makefile test_fslStartup.cc {outdir}',
f'cd {outdir}',
'make']
sp.run('; '.join(buildcmds), check=True, shell=True)
os.chdir(outdir)
os.chdir(outdir)
# Default behaviour should be: OMP multi-threaded, BLAS single threaded.
assert run('./test_fslStartup', 8, 8) == '8 1 8'
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment