|
4 | 4 | */ |
5 | 5 |
|
6 | 6 | public class MatlabBuilderConstants { |
7 | | - static final double BASE_MATLAB_VERSION_RUNTESTS_SUPPORT = 8.1; |
8 | | - static final double BASE_MATLAB_VERSION_NO_APP_ICON_SUPPORT = 8.6; |
9 | | - static final double BASE_MATLAB_VERSION_BATCH_SUPPORT = 9.5; |
10 | | - static final double BASE_MATLAB_VERSION_COBERTURA_SUPPORT = 9.3; |
11 | | - static final double BASE_MATLAB_VERSION_MODELCOVERAGE_SUPPORT = 9.5; |
12 | | - static final double BASE_MATLAB_VERSION_EXPORTSTMRESULTS_SUPPORT = 9.6; |
| 7 | + public static final double BASE_MATLAB_VERSION_RUNTESTS_SUPPORT = 8.1; |
| 8 | + public static final double BASE_MATLAB_VERSION_NO_APP_ICON_SUPPORT = 8.6; |
| 9 | + public static final double BASE_MATLAB_VERSION_BATCH_SUPPORT = 9.5; |
| 10 | + public static final double BASE_MATLAB_VERSION_COBERTURA_SUPPORT = 9.3; |
| 11 | + public static final double BASE_MATLAB_VERSION_MODELCOVERAGE_SUPPORT = 9.5; |
| 12 | + public static final double BASE_MATLAB_VERSION_EXPORTSTMRESULTS_SUPPORT = 9.6; |
13 | 13 |
|
14 | | - static final String MATLAB_RUNNER_TARGET_FILE = "Builder.matlab.runner.target.file.name"; |
15 | | - static final String MATLAB_TESTS_RUNNER_TARGET_FILE = "runMatlabTests.m"; |
16 | | - static final String MATLAB_RUNNER_RESOURCE = "com/mathworks/ci/MatlabBuilder/runMatlabTests.m"; |
17 | | - static final String AUTOMATIC_OPTION = "RunTestsAutomaticallyOption"; |
| 14 | + public static final String MATLAB_RUNNER_TARGET_FILE = "Builder.matlab.runner.target.file.name"; |
| 15 | + public static final String MATLAB_TESTS_RUNNER_TARGET_FILE = "runMatlabTests.m"; |
| 16 | + public static final String MATLAB_RUNNER_RESOURCE = "com/mathworks/ci/MatlabBuilder/runMatlabTests.m"; |
| 17 | + public static final String AUTOMATIC_OPTION = "RunTestsAutomaticallyOption"; |
18 | 18 |
|
19 | 19 | // Input parameter names (Passed to runMatlabTests.m as name-value pair arguments) |
20 | | - static final String PDF_REPORT = "'PDFReport'"; |
21 | | - static final String TAP_RESULTS = "'TAPResults'"; |
22 | | - static final String JUNIT_RESULTS = "'JUnitResults'"; |
23 | | - static final String STM_RESULTS = "'SimulinkTestResults'"; |
24 | | - static final String COBERTURA_CODE_COVERAGE = "'CoberturaCodeCoverage'"; |
25 | | - static final String COBERTURA_MODEL_COVERAGE = "'CoberturaModelCoverage'"; |
| 20 | + public static final String PDF_REPORT = "'PDFReport'"; |
| 21 | + public static final String TAP_RESULTS = "'TAPResults'"; |
| 22 | + public static final String JUNIT_RESULTS = "'JUnitResults'"; |
| 23 | + public static final String STM_RESULTS = "'SimulinkTestResults'"; |
| 24 | + public static final String COBERTURA_CODE_COVERAGE = "'CoberturaCodeCoverage'"; |
| 25 | + public static final String COBERTURA_MODEL_COVERAGE = "'CoberturaModelCoverage'"; |
26 | 26 |
|
27 | 27 | //Matlab Script generator package |
28 | | - static final String MATLAB_SCRIPT_GENERATOR = "matlab-script-generator.zip"; |
| 28 | + public static final String MATLAB_SCRIPT_GENERATOR = "matlab-script-generator.zip"; |
29 | 29 |
|
30 | 30 | //Test runner file prefix |
31 | | - static final String MATLAB_TEST_RUNNER_FILE_PREFIX = "runner_"; |
| 31 | + public static final String MATLAB_TEST_RUNNER_FILE_PREFIX = "runner_"; |
32 | 32 |
|
33 | 33 | //Temporary MATLAB folder name in workspace |
34 | | - static final String TEMP_MATLAB_FOLDER_NAME = ".matlab"; |
| 34 | + public static final String TEMP_MATLAB_FOLDER_NAME = ".matlab"; |
35 | 35 |
|
36 | | - static final String NEW_LINE = System.getProperty("line.separator"); |
| 36 | + public static final String NEW_LINE = System.getProperty("line.separator"); |
37 | 37 |
|
38 | 38 | //MATLAB Runner Script |
39 | | - static final String TEST_RUNNER_SCRIPT = String.join(NEW_LINE, |
40 | | - "tmpDir=tempname;", |
41 | | - "mkdir(tmpDir);", |
42 | | - "addpath(tmpDir);", |
43 | | - "zipURL='${ZIP_FILE}';", |
44 | | - "unzip(zipURL,tmpDir);", |
| 39 | + public static final String TEST_RUNNER_SCRIPT = String.join(NEW_LINE, |
| 40 | + "addpath('${TEMP_FOLDER}');", |
45 | 41 | "testScript = genscript(${PARAMS});", |
46 | 42 | "disp('Running MATLAB script with content:');", |
47 | 43 | "disp(testScript.Contents);", |
48 | | - "testScript.writeToFile(fullfile(tmpDir,'runnerScript.m'));", |
49 | | - "fprintf('___________________________________\\n\\n');"); |
| 44 | + "fprintf('___________________________________\\n\\n');", |
| 45 | + "run(testScript);"); |
50 | 46 | } |
0 commit comments