Skip to content

Commit

Permalink
New genscript changes (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
mw-kapilg authored Oct 10, 2022
1 parent 90da0ef commit 54eda10
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 1 deletion.
46 changes: 46 additions & 0 deletions .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,52 @@ jobs:
grep -v simpleTest test-results/matlab/filterdtagresult.xml
shell: bash

- run:
name: Set up diary for logging
command: |
echo 'diary console.log' >> startup.m
shell: bash
- matlab/run-tests:
strict: true
source-folder: src
- run:
name: Verify tests ran with strict checks
command: |
set -e
grep -q "runner.addPlugin(FailOnWarningsPlugin())" console.log
rm console.log
shell: bash
- matlab/run-tests:
use-parallel: true
source-folder: src
- run:
name: Verify tests ran in parallel
command: |
set -e
grep -q "parallel pool" console.log
rm console.log
shell: bash
- matlab/run-tests:
output-detail: Detailed
source-folder: src
- run:
name: Verify tests ran with detailed display level for event details
command: |
set -e
grep -q "TestRunner.withTextOutput('OutputDetail', 3)" console.log
rm console.log
shell: bash
- matlab/run-tests:
logging-level: Detailed
source-folder: src
- run:
name: Verify tests ran with detailed verbosity level for logged diagnostics
command: |
set -e
grep -q "TestRunner.withTextOutput('LoggingLevel', 3)" console.log
rm console.log
shell: bash

# Set up for model coverage artifact tests
- when:
condition:
Expand Down
27 changes: 27 additions & 0 deletions src/commands/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,29 @@ parameters:
maximum time a job is allowed to run.
type: string
default: 10m
strict:
description: >
Whether to apply strict checks when running the tests. For example, the command generates a
qualification failure if a test issues a warning.
type: boolean
default: false
use-parallel:
description: >
Whether to run tests in parallel (requires Parallel Computing Toolbox). This feature might
not be compatible with certain arguments, in which case, tests run in serial regardless of
the specified value.
type: boolean
default: false
output-detail:
description: >
Display level for event details produced by the test run, specified as 'None', 'Terse', 'Concise', 'Detailed', or 'Verbose'.
type: string
default: ''
logging-level:
description: >
Maximum verbosity level for logged diagnostics included for the test run, specified as 'None', 'Terse', 'Concise', 'Detailed', or 'Verbose'.
type: string
default: ''

steps:
- run:
Expand All @@ -89,6 +112,10 @@ steps:
PARAM_TEST_RESULTS_SIMULINK_TEST: <<parameters.test-results-simulink-test>>
PARAM_TEST_RESULTS_HTML: <<parameters.test-results-html>>
PARAM_TEST_RESULTS_PDF: <<parameters.test-results-pdf>>
PARAM_STRICT: <<parameters.strict>>
PARAM_USE_PARALLEL: <<parameters.use-parallel>>
PARAM_OUTPUT_DETAIL: <<parameters.output-detail>>
PARAM_LOGGING_LEVEL: <<parameters.logging-level>>
command: <<include(scripts/run-tests.sh)>>
shell: bash
no_output_timeout: <<parameters.no-output-timeout>>
6 changes: 5 additions & 1 deletion src/scripts/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ fi
'HTMLModelCoverage','${PARAM_MODEL_COVERAGE_HTML}',\
'SimulinkTestResults','${PARAM_TEST_RESULTS_SIMULINK_TEST}',\
'HTMLTestReport','${PARAM_TEST_RESULTS_HTML}',\
'PDFTestReport','${PARAM_TEST_RESULTS_PDF}');\
'PDFTestReport','${PARAM_TEST_RESULTS_PDF}',\
'Strict',${PARAM_STRICT},\
'UseParallel',${PARAM_USE_PARALLEL},\
'OutputDetail','${PARAM_OUTPUT_DETAIL}',\
'LoggingLevel','${PARAM_LOGGING_LEVEL}');\
disp('Running MATLAB script with contents:');\
disp(testScript.Contents);\
fprintf('__________\n\n');\
Expand Down

0 comments on commit 54eda10

Please sign in to comment.