Skip to content

Commit 4eaf5f7

Browse files
authored
Merge pull request #48 from mathworks/addargs
Add the ability to pass startup options through to MATLAB when runnin…
2 parents 54eda10 + 18c1215 commit 4eaf5f7

File tree

3 files changed

+24
-11
lines changed

3 files changed

+24
-11
lines changed

.circleci/test-deploy.yml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ jobs:
102102
shell: bash
103103
- matlab/run-command:
104104
command: assert(myvar==123, 'myvar was not set as expected by startup.m')
105+
- matlab/run-command:
106+
command: disp("Hello world!")
107+
startup-options: -logfile mylog.log
108+
- matlab/run-command:
109+
command: assert(isfile("mylog.log"), 'logfile was not created as expected')
105110

106111
integration-test-run-tests:
107112
parameters:
@@ -202,16 +207,17 @@ jobs:
202207
grep -q "runner.addPlugin(FailOnWarningsPlugin())" console.log
203208
rm console.log
204209
shell: bash
205-
- matlab/run-tests:
206-
use-parallel: true
207-
source-folder: src
208-
- run:
209-
name: Verify tests ran in parallel
210-
command: |
211-
set -e
212-
grep -q "parallel pool" console.log
213-
rm console.log
214-
shell: bash
210+
# Running test in parallel is currently unsupported
211+
# - matlab/run-tests:
212+
# use-parallel: true
213+
# source-folder: src
214+
# - run:
215+
# name: Verify tests ran in parallel
216+
# command: |
217+
# set -e
218+
# grep -q "parallel pool" console.log
219+
# rm console.log
220+
# shell: bash
215221
- matlab/run-tests:
216222
output-detail: Detailed
217223
source-folder: src

src/commands/run-command.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ parameters:
1212
script or function, do not specify the file extension. If you specify more than one MATLAB
1313
command, use a comma or semicolon to separate the commands.
1414
type: string
15+
startup-options:
16+
description: >
17+
MATLAB startup options. If you specify more than one option, use a space to
18+
separate the options.
19+
type: string
20+
default: ""
1521
no-output-timeout:
1622
description: >
1723
Elapsed time the command can run without output. The string is a decimal with unit suffix,
@@ -25,6 +31,7 @@ steps:
2531
name: Run MATLAB command
2632
environment:
2733
PARAM_COMMAND: <<parameters.command>>
34+
PARAM_ARGS: <<parameters.startup-options>>
2835
command: <<include(scripts/run-command.sh)>>
2936
shell: bash
3037
no_output_timeout: <<parameters.no-output-timeout>>

src/scripts/run-command.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ ${PARAM_COMMAND}
3333
EOF
3434

3535
# run MATLAB command
36-
"${tmpdir}/bin/run-matlab-command$binext" "cd('${scriptdir//\'/\'\'}');$script"
36+
"${tmpdir}/bin/run-matlab-command$binext" "cd('${scriptdir//\'/\'\'}');$script" $PARAM_ARGS

0 commit comments

Comments
 (0)