Skip to content

Commit 8146c21

Browse files
authored
Merge pull request #51 from mathworks/startupopts
Initial startup-options support
2 parents b9702d4 + 1a9897a commit 8146c21

File tree

5 files changed

+33
-3
lines changed

5 files changed

+33
-3
lines changed

.circleci/test-deploy.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ jobs:
137137
# Integ tests for matlab/run-tests
138138
- matlab/run-tests:
139139
source-folder: src
140+
startup-options: -logfile console.log
140141
- matlab/run-tests:
141142
test-results-junit: test-results/matlab/results.xml
142143
code-coverage-cobertura: code-coverage/coverage.xml
@@ -152,6 +153,15 @@ jobs:
152153
test-results-junit: test-results/matlab/filterdtagresult.xml
153154
select-by-tag: FILTERED
154155

156+
- run:
157+
name: Verify tests ran with startup options
158+
command: |
159+
set -e
160+
grep mytest console.log
161+
grep TaggedTest console.log
162+
grep filtertest console.log
163+
rm console.log
164+
shell: bash
155165
- run:
156166
name: Verify test results file was created
157167
command: |
@@ -364,16 +374,22 @@ jobs:
364374
rm buildlog.txt
365375
shell: bash
366376
# run build with default tasks
367-
- matlab/run-build
377+
- matlab/run-build:
378+
startup-options: -logfile console.log
368379
- run:
369380
name: Verify that correct tasks appear in buildlog.txt
370381
command: |
371382
set -e
372383
grep "building" buildlog.txt
384+
grep "build" console.log
373385
grep "testing" buildlog.txt
386+
grep "test" console.log
374387
! grep "deploying" buildlog.txt
388+
! grep "deploy" console.log
375389
! grep "checking" buildlog.txt
390+
! grep "check" console.log
376391
rm buildlog.txt
392+
rm console.log
377393
shell: bash
378394

379395
workflows:

src/commands/run-build.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ parameters:
1010
in the plan returned by buildfile.m as well as all the tasks on which they depend.
1111
type: string
1212
default: ""
13+
startup-options:
14+
description: >
15+
MATLAB startup options. If you specify more than one option, use a space to
16+
separate the options.
17+
type: string
18+
default: ""
1319
no-output-timeout:
1420
description: >
1521
Elapsed time the command can run without output. The string is a decimal with unit suffix,
@@ -23,6 +29,7 @@ steps:
2329
name: Run MATLAB build
2430
environment:
2531
PARAM_TASKS: <<parameters.tasks>>
32+
PARAM_ARGS: <<parameters.startup-options>>
2633
command: <<include(scripts/run-build.sh)>>
2734
shell: bash
2835
no_output_timeout: <<parameters.no-output-timeout>>

src/commands/run-tests.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ parameters:
9696
Maximum verbosity level for logged diagnostics included for the test run, specified as 'None', 'Terse', 'Concise', 'Detailed', or 'Verbose'.
9797
type: string
9898
default: ''
99+
startup-options:
100+
description: >
101+
MATLAB startup options. If you specify more than one option, use a space to
102+
separate the options.
103+
type: string
104+
default: ""
99105

100106
steps:
101107
- run:
@@ -116,6 +122,7 @@ steps:
116122
PARAM_USE_PARALLEL: <<parameters.use-parallel>>
117123
PARAM_OUTPUT_DETAIL: <<parameters.output-detail>>
118124
PARAM_LOGGING_LEVEL: <<parameters.logging-level>>
125+
PARAM_ARGS: <<parameters.startup-options>>
119126
command: <<include(scripts/run-tests.sh)>>
120127
shell: bash
121128
no_output_timeout: <<parameters.no-output-timeout>>

src/scripts/run-build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ $buildCommand
3636
EOF
3737

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

src/scripts/run-tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ fi
4747
disp('Running MATLAB script with contents:');\
4848
disp(testScript.Contents);\
4949
fprintf('__________\n\n');\
50-
run(testScript);"
50+
run(testScript);" $PARAM_ARGS

0 commit comments

Comments
 (0)