Skip to content

Commit

Permalink
Merge pull request #51 from mathworks/startupopts
Browse files Browse the repository at this point in the history
Initial startup-options support
  • Loading branch information
sameagen-MW authored Jun 21, 2023
2 parents b9702d4 + 1a9897a commit 8146c21
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 3 deletions.
18 changes: 17 additions & 1 deletion .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ jobs:
# Integ tests for matlab/run-tests
- matlab/run-tests:
source-folder: src
startup-options: -logfile console.log
- matlab/run-tests:
test-results-junit: test-results/matlab/results.xml
code-coverage-cobertura: code-coverage/coverage.xml
Expand All @@ -152,6 +153,15 @@ jobs:
test-results-junit: test-results/matlab/filterdtagresult.xml
select-by-tag: FILTERED

- run:
name: Verify tests ran with startup options
command: |
set -e
grep mytest console.log
grep TaggedTest console.log
grep filtertest console.log
rm console.log
shell: bash
- run:
name: Verify test results file was created
command: |
Expand Down Expand Up @@ -364,16 +374,22 @@ jobs:
rm buildlog.txt
shell: bash
# run build with default tasks
- matlab/run-build
- matlab/run-build:
startup-options: -logfile console.log
- run:
name: Verify that correct tasks appear in buildlog.txt
command: |
set -e
grep "building" buildlog.txt
grep "build" console.log
grep "testing" buildlog.txt
grep "test" console.log
! grep "deploying" buildlog.txt
! grep "deploy" console.log
! grep "checking" buildlog.txt
! grep "check" console.log
rm buildlog.txt
rm console.log
shell: bash

workflows:
Expand Down
7 changes: 7 additions & 0 deletions src/commands/run-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ parameters:
in the plan returned by buildfile.m as well as all the tasks on which they depend.
type: string
default: ""
startup-options:
description: >
MATLAB startup options. If you specify more than one option, use a space to
separate the options.
type: string
default: ""
no-output-timeout:
description: >
Elapsed time the command can run without output. The string is a decimal with unit suffix,
Expand All @@ -23,6 +29,7 @@ steps:
name: Run MATLAB build
environment:
PARAM_TASKS: <<parameters.tasks>>
PARAM_ARGS: <<parameters.startup-options>>
command: <<include(scripts/run-build.sh)>>
shell: bash
no_output_timeout: <<parameters.no-output-timeout>>
7 changes: 7 additions & 0 deletions src/commands/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ parameters:
Maximum verbosity level for logged diagnostics included for the test run, specified as 'None', 'Terse', 'Concise', 'Detailed', or 'Verbose'.
type: string
default: ''
startup-options:
description: >
MATLAB startup options. If you specify more than one option, use a space to
separate the options.
type: string
default: ""

steps:
- run:
Expand All @@ -116,6 +122,7 @@ steps:
PARAM_USE_PARALLEL: <<parameters.use-parallel>>
PARAM_OUTPUT_DETAIL: <<parameters.output-detail>>
PARAM_LOGGING_LEVEL: <<parameters.logging-level>>
PARAM_ARGS: <<parameters.startup-options>>
command: <<include(scripts/run-tests.sh)>>
shell: bash
no_output_timeout: <<parameters.no-output-timeout>>
2 changes: 1 addition & 1 deletion src/scripts/run-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ $buildCommand
EOF

# run MATLAB command
"${tmpdir}/bin/run-matlab-command$binext" "cd('${scriptdir//\'/\'\'}');$script"
"${tmpdir}/bin/run-matlab-command$binext" "cd('${scriptdir//\'/\'\'}');$script" $PARAM_ARGS
2 changes: 1 addition & 1 deletion src/scripts/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ fi
disp('Running MATLAB script with contents:');\
disp(testScript.Contents);\
fprintf('__________\n\n');\
run(testScript);"
run(testScript);" $PARAM_ARGS

0 comments on commit 8146c21

Please sign in to comment.