|
10 | 10 | cnomex = cnomex & ~HasTag("windows");
|
11 | 11 | end
|
12 | 12 |
|
| 13 | +reportDir = fullfile(plan.RootFolder, ".buildtool"); |
13 | 14 | pkg_root = fullfile(plan.RootFolder, "+stdlib");
|
14 | 15 | test_root = fullfile(plan.RootFolder, "test");
|
15 | 16 |
|
16 |
| -if isMATLABReleaseOlderThan('R2025a') |
17 |
| - mt_ok = false; |
18 |
| -else |
19 |
| - addons = matlab.addons.installedAddons; |
20 |
| - % license name obtained by |
21 |
| - % com.mathworks.product.util.ProductIdentifier.get("MATLAB Test").getFlexName |
22 |
| - mt_ok = any(ismember(addons.Name, "MATLAB Test")) && license('checkout', 'MATLAB_Test') == 1; |
23 |
| -end |
24 |
| - |
25 | 17 | if ~isMATLABReleaseOlderThan("R2023b")
|
26 | 18 | plan("clean") = matlab.buildtool.tasks.CleanTask;
|
27 | 19 | end
|
|
38 | 30 | plan("test_exe") = matlab.buildtool.tasks.TestTask(test_root, Tag="exe", Dependencies="exe");
|
39 | 31 |
|
40 | 32 | elseif isMATLABReleaseOlderThan("R2025a")
|
41 |
| - |
| 33 | + % Matlab == R2024b |
42 | 34 | plan("test:main") = matlab.buildtool.Task(Actions=@(context) test_main(context, cnomex));
|
43 | 35 |
|
44 | 36 | else
|
45 |
| - |
| 37 | + % Matlab >= R2025a |
46 | 38 | plan("test:main") = matlab.buildtool.tasks.TestTask(...
|
47 |
| - test_root, Description="Test non-MEX targets",... |
| 39 | + test_root, Description="Test non-MEX targets", ... |
48 | 40 | Selector=cnomex, ...
|
49 |
| - SourceFiles=pkg_root, RunOnlyImpactedTests=mt_ok,... |
50 |
| - TestResults="release/TestResults_nomex.xml", Strict=true); |
| 41 | + SourceFiles=pkg_root, ... |
| 42 | + RunOnlyImpactedTests=stdlib.checkout_license("MATLAB Test"), ... |
| 43 | + TestResults=reportDir + "/TestResults_nomex.xml", Strict=true); |
| 44 | + |
| 45 | + plan("test").Description = "Run all self-tests"; |
51 | 46 |
|
52 | 47 | end
|
53 | 48 |
|
|
58 | 53 |
|
59 | 54 | plan("test:python") = matlab.buildtool.tasks.TestTask(...
|
60 | 55 | test_root, Description="test Python targets", ...
|
61 |
| - Tag = "python", ... |
62 |
| - TestResults="release/TestResults_java.xml", Strict=true); |
| 56 | + Tag = "python", Strict=true); |
63 | 57 |
|
64 | 58 | plan("test:java") = matlab.buildtool.tasks.TestTask(...
|
65 | 59 | test_root, Description="test Java targets", ...
|
66 |
| - Tag = "java", ... |
67 |
| - TestResults="release/TestResults_java.xml", Strict=true); |
| 60 | + Tag = "java", Strict=true); |
68 | 61 |
|
69 | 62 | plan("test:java_exe") = matlab.buildtool.tasks.TestTask(...
|
70 | 63 | test_root, Description="test Java exe targets", ...
|
71 |
| - Tag = "java_exe", Dependencies="exe", ... |
72 |
| - TestResults="release/TestResults_java_exe.xml", Strict=true); |
| 64 | + Tag = "java_exe", Dependencies="exe", Strict=true); |
73 | 65 |
|
74 | 66 |
|
75 |
| - if mt_ok |
| 67 | + if ~isempty(license('inuse', 'MATLAB_Test')) |
76 | 68 | plan("coverage") = matlab.buildtool.tasks.TestTask(test_root, ...
|
77 |
| - Description="code coverage", ... |
| 69 | + Description="Run code coverage", ... |
78 | 70 | Dependencies="exe", ...
|
79 | 71 | SourceFiles=pkg_root, ...
|
80 | 72 | Strict=false).addCodeCoverage(...
|
81 |
| - matlabtest.plugins.codecoverage.StandaloneReport("release/coverage-report.html")); |
| 73 | + matlabtest.plugins.codecoverage.StandaloneReport(reportDir + "/coverage-report.html")); |
82 | 74 | end
|
83 | 75 |
|
84 | 76 | end
|
|
99 | 91 | if ~isMATLABReleaseOlderThan("R2024a")
|
100 | 92 | plan("check") = matlab.buildtool.tasks.CodeIssuesTask(plan.RootFolder, ...
|
101 | 93 | IncludeSubfolders=true, ...
|
102 |
| - WarningThreshold=0, Results="release/CodeIssues.sarif"); |
| 94 | + WarningThreshold=0, Results=reportDir + "/CodeIssues.sarif"); |
103 | 95 | end
|
104 | 96 |
|
105 | 97 | end
|
|
0 commit comments