From 4bc8e86586ef3ceee2ff40e319203a7480ea02f3 Mon Sep 17 00:00:00 2001 From: Vahila Kayithi Date: Wed, 10 Sep 2025 12:05:19 +0530 Subject: [PATCH 01/39] Add SeectByName parameter --- integ-test-promote-template.yml | 14 +++++++++++++- tasks/run-matlab-tests/v1/main.ts | 1 + tasks/run-matlab-tests/v1/scriptgen.ts | 13 +++++++++++++ tasks/run-matlab-tests/v1/task.json | 9 +++++++++ tasks/run-matlab-tests/v1/test/scriptgen.test.ts | 8 ++++++-- 5 files changed, 42 insertions(+), 3 deletions(-) diff --git a/integ-test-promote-template.yml b/integ-test-promote-template.yml index cf50b902..bb663ea7 100644 --- a/integ-test-promote-template.yml +++ b/integ-test-promote-template.yml @@ -217,10 +217,15 @@ jobs: testResultsJUnit: test-results/matlab/selectbyfolder.xml selectByFolder: tests/filteredTest - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABTests.RunMATLABTests@${{ version }} - displayName: Run MATLAB tests filter by folder + displayName: Run MATLAB tests filter by tag inputs: testResultsJUnit: test-results/matlab/selectbytag.xml selectByTag: FILTERED + - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABTests.RunMATLABTests@${{ version }} + displayName: Run MATLAB tests filter by name + inputs: + testResultsJUnit: test-results/matlab/selectbyname.xml + selectByName: "filtertest/* mytest/StartupTest" - bash: | set -e grep -q FirstTest test-results/matlab/results.xml @@ -240,6 +245,13 @@ jobs: grep -v FirstTest test-results/matlab/selectbytag.xml grep -v simpleTest test-results/matlab/selectbytag.xml displayName: Verify test filtered by tag name + # Will uncomment this once Genscript changes are released + # - bash: | + # set -e + # grep -q StartupTest test-results/matlab/selectbyname.xml + # grep -v simpleTest test-results/matlab/selectbyname.xml + # ! grep -q FirstTest test-results/matlab/selectbytag.xml + # displayName: Verify test filtered by name - bash: | echo 'diary console.log' >> startup.m displayName: Set up diary for logging diff --git a/tasks/run-matlab-tests/v1/main.ts b/tasks/run-matlab-tests/v1/main.ts index ed0bdb0f..1f155327 100644 --- a/tasks/run-matlab-tests/v1/main.ts +++ b/tasks/run-matlab-tests/v1/main.ts @@ -14,6 +14,7 @@ async function run() { SourceFolder: taskLib.getInput("sourceFolder"), SelectByFolder: taskLib.getInput("selectByFolder"), SelectByTag: taskLib.getInput("selectByTag"), + SelectByName: taskLib.getInput("SelectByName"), CoberturaModelCoverage: taskLib.getInput("modelCoverageCobertura"), SimulinkTestResults: taskLib.getInput("testResultsSimulinkTest"), PDFTestReport: taskLib.getInput("testResultsPDF"), diff --git a/tasks/run-matlab-tests/v1/scriptgen.ts b/tasks/run-matlab-tests/v1/scriptgen.ts index 68d6e3c8..e2c3d1af 100644 --- a/tasks/run-matlab-tests/v1/scriptgen.ts +++ b/tasks/run-matlab-tests/v1/scriptgen.ts @@ -11,12 +11,24 @@ export interface IRunTestsOptions { CoberturaModelCoverage?: string; SelectByTag?: string; SelectByFolder?: string; + SelectByName?: string; Strict?: boolean; UseParallel?: boolean; OutputDetail?: string; LoggingLevel?: string; } +// Function to convert space separated names to cell array of character vectors +export function getSelectByNameAsCellArray(input?: string): string { + if (!input) { + return ""; + } + // Split by whitespace, filter out empty, wrap each in single quotes + const items = input.split(/\s+/).filter(Boolean).map((s) => `'${s}'`); + // Join with commas, wrap in {} + return `{${items.join(", ")}}`; +} + export function generateCommand(options: IRunTestsOptions): string { return `addpath('${path.join(__dirname, "scriptgen")}');` + `testScript = genscript('Test',` + @@ -28,6 +40,7 @@ export function generateCommand(options: IRunTestsOptions): string { `'CoberturaModelCoverage','${options.CoberturaModelCoverage || ""}',` + `'SelectByTag','${options.SelectByTag || ""}',` + `'SelectByFolder','${options.SelectByFolder || ""}',` + + `'SelectByName','${getSelectByNameAsCellArray(options.SelectByName) || ""}',` + `'Strict',${options.Strict || false},` + `'UseParallel',${options.UseParallel || false},` + `'OutputDetail','${options.OutputDetail || ""}',` + diff --git a/tasks/run-matlab-tests/v1/task.json b/tasks/run-matlab-tests/v1/task.json index ef9cc098..8f51b809 100644 --- a/tasks/run-matlab-tests/v1/task.json +++ b/tasks/run-matlab-tests/v1/task.json @@ -57,6 +57,15 @@ "required": false, "helpMarkDown": "Test tag used to select test suite elements. To create a test suite, the task uses only the test elements with the specified tag." }, + { + "name": "selectByName", + "type": "string", + "label": "By name", + "defaultValue": "", + "groupName": "filterTests", + "required": false, + "helpMarkDown": "Test name used to select test suite elements. To create a test suite, the task uses only the test elements with the specified name." + }, { "name": "strict", "type": "boolean", diff --git a/tasks/run-matlab-tests/v1/test/scriptgen.test.ts b/tasks/run-matlab-tests/v1/test/scriptgen.test.ts index d89e4921..e92e7c8b 100644 --- a/tasks/run-matlab-tests/v1/test/scriptgen.test.ts +++ b/tasks/run-matlab-tests/v1/test/scriptgen.test.ts @@ -15,6 +15,7 @@ export default function suite() { CoberturaModelCoverage: "", SelectByTag: "", SelectByFolder: "", + SelectByName: "", Strict: false, UseParallel: false, OutputDetail: "", @@ -32,6 +33,7 @@ export default function suite() { assert(actual.includes("'CoberturaModelCoverage',''")); assert(actual.includes("'SelectByTag',''")); assert(actual.includes("'SelectByFolder',''")); + assert(actual.includes("'SelectByName',''")); assert(actual.includes("'Strict',false")); assert(actual.includes("'UseParallel',false")); assert(actual.includes("'OutputDetail',''")); @@ -39,7 +41,7 @@ export default function suite() { const expected = `genscript('Test', 'JUnitTestResults','', 'CoberturaCodeCoverage','', 'SourceFolder','', 'PDFTestReport','', 'SimulinkTestResults','', - 'CoberturaModelCoverage','', 'SelectByTag','', 'SelectByFolder','', + 'CoberturaModelCoverage','', 'SelectByTag','', 'SelectByFolder','', 'SelectByName','', 'Strict',false, 'UseParallel',false, 'OutputDetail','', 'LoggingLevel','')` .replace(/\s+/g, ""); assert(actual.replace(/\s+/g, "").includes(expected)); @@ -55,6 +57,7 @@ export default function suite() { CoberturaModelCoverage: "test-results/modelcoverage.xml", SelectByTag: "FeatureA", SelectByFolder: "test/tools;test/toolbox", + SelectByName: "tTestA/* tTestB/*", Strict: true, UseParallel: true, OutputDetail: "Detailed", @@ -72,6 +75,7 @@ export default function suite() { assert(actual.includes("'CoberturaModelCoverage','test-results/modelcoverage.xml'")); assert(actual.includes("'SelectByTag','FeatureA'")); assert(actual.includes("'SelectByFolder','test/tools;test/toolbox'")); + assert(actual.includes("'SelectByName','{'tTestA/*', 'tTestB/*'}'")); assert(actual.includes("'Strict',true")); assert(actual.includes("'UseParallel',true")); assert(actual.includes("'OutputDetail','Detailed'")); @@ -81,7 +85,7 @@ export default function suite() { 'CoberturaCodeCoverage','code-coverage/coverage.xml', 'SourceFolder','source', 'PDFTestReport','test-results/pdf-results.pdf', 'SimulinkTestResults','test-results/simulinkTest.mldatx', 'CoberturaModelCoverage','test-results/modelcoverage.xml', 'SelectByTag','FeatureA', - 'SelectByFolder','test/tools;test/toolbox', 'Strict',true, 'UseParallel',true, 'OutputDetail','Detailed', + 'SelectByFolder','test/tools;test/toolbox', 'SelectByName','{'tTestA/*', 'tTestB/*'}', 'Strict',true, 'UseParallel',true, 'OutputDetail','Detailed', 'LoggingLevel','Detailed' )` .replace(/\s+/g, ""); assert(actual.replace(/\s+/g, "").includes(expected)); From 9413f22d849b16ee7af54ea83acf26fdd971a25c Mon Sep 17 00:00:00 2001 From: Vahila Kayithi Date: Wed, 10 Sep 2025 15:43:32 +0530 Subject: [PATCH 02/39] Remove comment --- integ-test-promote-template.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/integ-test-promote-template.yml b/integ-test-promote-template.yml index bb663ea7..d171b28c 100644 --- a/integ-test-promote-template.yml +++ b/integ-test-promote-template.yml @@ -245,7 +245,6 @@ jobs: grep -v FirstTest test-results/matlab/selectbytag.xml grep -v simpleTest test-results/matlab/selectbytag.xml displayName: Verify test filtered by tag name - # Will uncomment this once Genscript changes are released # - bash: | # set -e # grep -q StartupTest test-results/matlab/selectbyname.xml From f444f1d9c054a19e1dc1a50097221255c9efc515 Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Wed, 24 Sep 2025 10:33:58 +0530 Subject: [PATCH 03/39] Update the test --- integ-test-promote-template.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/integ-test-promote-template.yml b/integ-test-promote-template.yml index d171b28c..3a5d39d4 100644 --- a/integ-test-promote-template.yml +++ b/integ-test-promote-template.yml @@ -245,12 +245,12 @@ jobs: grep -v FirstTest test-results/matlab/selectbytag.xml grep -v simpleTest test-results/matlab/selectbytag.xml displayName: Verify test filtered by tag name - # - bash: | - # set -e - # grep -q StartupTest test-results/matlab/selectbyname.xml - # grep -v simpleTest test-results/matlab/selectbyname.xml - # ! grep -q FirstTest test-results/matlab/selectbytag.xml - # displayName: Verify test filtered by name + - bash: | + set -e + grep -q StartupTest test-results/matlab/selectbyname.xml + grep -v simpleTest test-results/matlab/selectbyname.xml + ! grep -q FirstTest test-results/matlab/selectbytag.xml + displayName: Verify test filtered by name - bash: | echo 'diary console.log' >> startup.m displayName: Set up diary for logging From e4f4ac689fe7312d50277704d341e97bab514619 Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Wed, 24 Sep 2025 10:57:57 +0530 Subject: [PATCH 04/39] Update the version --- build-test-publish.pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-test-publish.pipeline.yml b/build-test-publish.pipeline.yml index a33ff971..f6cb0c23 100644 --- a/build-test-publish.pipeline.yml +++ b/build-test-publish.pipeline.yml @@ -1,4 +1,4 @@ -name: 1.13$(Rev:.r) +name: 1.14$(Rev:.r) trigger: - master From 9425747355d9bbe21fe07734ea35e77465fe5807 Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Fri, 10 Oct 2025 20:21:26 +0530 Subject: [PATCH 05/39] Send {} when empty selectByName value --- tasks/run-matlab-tests/v1/scriptgen.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tasks/run-matlab-tests/v1/scriptgen.ts b/tasks/run-matlab-tests/v1/scriptgen.ts index e2c3d1af..107d1f64 100644 --- a/tasks/run-matlab-tests/v1/scriptgen.ts +++ b/tasks/run-matlab-tests/v1/scriptgen.ts @@ -20,12 +20,10 @@ export interface IRunTestsOptions { // Function to convert space separated names to cell array of character vectors export function getSelectByNameAsCellArray(input?: string): string { - if (!input) { - return ""; + if (!input || !input.trim()) { + return '{}'; } - // Split by whitespace, filter out empty, wrap each in single quotes const items = input.split(/\s+/).filter(Boolean).map((s) => `'${s}'`); - // Join with commas, wrap in {} return `{${items.join(", ")}}`; } @@ -40,7 +38,7 @@ export function generateCommand(options: IRunTestsOptions): string { `'CoberturaModelCoverage','${options.CoberturaModelCoverage || ""}',` + `'SelectByTag','${options.SelectByTag || ""}',` + `'SelectByFolder','${options.SelectByFolder || ""}',` + - `'SelectByName','${getSelectByNameAsCellArray(options.SelectByName) || ""}',` + + `'SelectByName','${getSelectByNameAsCellArray(options.SelectByName)}',` + `'Strict',${options.Strict || false},` + `'UseParallel',${options.UseParallel || false},` + `'OutputDetail','${options.OutputDetail || ""}',` + From 2ed76cc422632176d779334ee73ba2f3dae41a7d Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Fri, 10 Oct 2025 20:40:12 +0530 Subject: [PATCH 06/39] Update scriptgen.ts --- tasks/run-matlab-tests/v1/scriptgen.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/run-matlab-tests/v1/scriptgen.ts b/tasks/run-matlab-tests/v1/scriptgen.ts index 107d1f64..3367996f 100644 --- a/tasks/run-matlab-tests/v1/scriptgen.ts +++ b/tasks/run-matlab-tests/v1/scriptgen.ts @@ -21,7 +21,7 @@ export interface IRunTestsOptions { // Function to convert space separated names to cell array of character vectors export function getSelectByNameAsCellArray(input?: string): string { if (!input || !input.trim()) { - return '{}'; + return "{}"; } const items = input.split(/\s+/).filter(Boolean).map((s) => `'${s}'`); return `{${items.join(", ")}}`; From 116be18998400a1be767aeeef07066f1d9d1811b Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Fri, 10 Oct 2025 20:45:41 +0530 Subject: [PATCH 07/39] Update failing test --- tasks/run-matlab-tests/v1/test/scriptgen.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/run-matlab-tests/v1/test/scriptgen.test.ts b/tasks/run-matlab-tests/v1/test/scriptgen.test.ts index e92e7c8b..4c902373 100644 --- a/tasks/run-matlab-tests/v1/test/scriptgen.test.ts +++ b/tasks/run-matlab-tests/v1/test/scriptgen.test.ts @@ -33,7 +33,7 @@ export default function suite() { assert(actual.includes("'CoberturaModelCoverage',''")); assert(actual.includes("'SelectByTag',''")); assert(actual.includes("'SelectByFolder',''")); - assert(actual.includes("'SelectByName',''")); + assert(actual.includes("'SelectByName',{}")); assert(actual.includes("'Strict',false")); assert(actual.includes("'UseParallel',false")); assert(actual.includes("'OutputDetail',''")); @@ -41,7 +41,7 @@ export default function suite() { const expected = `genscript('Test', 'JUnitTestResults','', 'CoberturaCodeCoverage','', 'SourceFolder','', 'PDFTestReport','', 'SimulinkTestResults','', - 'CoberturaModelCoverage','', 'SelectByTag','', 'SelectByFolder','', 'SelectByName','', + 'CoberturaModelCoverage','', 'SelectByTag','', 'SelectByFolder','', 'SelectByName',{}, 'Strict',false, 'UseParallel',false, 'OutputDetail','', 'LoggingLevel','')` .replace(/\s+/g, ""); assert(actual.replace(/\s+/g, "").includes(expected)); From e16adf7721cf99cb02157451fcb968152501fd75 Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Fri, 10 Oct 2025 20:54:59 +0530 Subject: [PATCH 08/39] Update failing test --- tasks/run-matlab-tests/v1/test/scriptgen.test.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tasks/run-matlab-tests/v1/test/scriptgen.test.ts b/tasks/run-matlab-tests/v1/test/scriptgen.test.ts index 4c902373..18c7540c 100644 --- a/tasks/run-matlab-tests/v1/test/scriptgen.test.ts +++ b/tasks/run-matlab-tests/v1/test/scriptgen.test.ts @@ -24,6 +24,8 @@ export default function suite() { const actual = scriptgen.generateCommand(options); + console.log(actual); + assert(actual.includes("genscript('Test'")); assert(actual.includes("'JUnitTestResults',''")); assert(actual.includes("'CoberturaCodeCoverage',''")); @@ -66,6 +68,8 @@ export default function suite() { const actual = scriptgen.generateCommand(options); + console.log(actual); + assert(actual.includes("genscript('Test'")); assert(actual.includes("'JUnitTestResults','test-results/results.xml'")); assert(actual.includes("'CoberturaCodeCoverage','code-coverage/coverage.xml'")); From 9ec180ef32062fbe47fcd4a01632a7243d02b121 Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Fri, 10 Oct 2025 20:57:04 +0530 Subject: [PATCH 09/39] Update failing test --- tasks/run-matlab-tests/v1/test/scriptgen.test.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/tasks/run-matlab-tests/v1/test/scriptgen.test.ts b/tasks/run-matlab-tests/v1/test/scriptgen.test.ts index 18c7540c..c10cc258 100644 --- a/tasks/run-matlab-tests/v1/test/scriptgen.test.ts +++ b/tasks/run-matlab-tests/v1/test/scriptgen.test.ts @@ -25,7 +25,6 @@ export default function suite() { const actual = scriptgen.generateCommand(options); console.log(actual); - assert(actual.includes("genscript('Test'")); assert(actual.includes("'JUnitTestResults',''")); assert(actual.includes("'CoberturaCodeCoverage',''")); @@ -69,7 +68,6 @@ export default function suite() { const actual = scriptgen.generateCommand(options); console.log(actual); - assert(actual.includes("genscript('Test'")); assert(actual.includes("'JUnitTestResults','test-results/results.xml'")); assert(actual.includes("'CoberturaCodeCoverage','code-coverage/coverage.xml'")); From 2ae052ab4b5c3027f5d02ae6072542bdddc8ce0d Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Fri, 10 Oct 2025 21:09:41 +0530 Subject: [PATCH 10/39] test fix --- tasks/run-matlab-tests/v1/scriptgen.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/run-matlab-tests/v1/scriptgen.ts b/tasks/run-matlab-tests/v1/scriptgen.ts index 3367996f..6a578deb 100644 --- a/tasks/run-matlab-tests/v1/scriptgen.ts +++ b/tasks/run-matlab-tests/v1/scriptgen.ts @@ -38,7 +38,7 @@ export function generateCommand(options: IRunTestsOptions): string { `'CoberturaModelCoverage','${options.CoberturaModelCoverage || ""}',` + `'SelectByTag','${options.SelectByTag || ""}',` + `'SelectByFolder','${options.SelectByFolder || ""}',` + - `'SelectByName','${getSelectByNameAsCellArray(options.SelectByName)}',` + + `'SelectByName',${getSelectByNameAsCellArray(options.SelectByName)},` + `'Strict',${options.Strict || false},` + `'UseParallel',${options.UseParallel || false},` + `'OutputDetail','${options.OutputDetail || ""}',` + From 37a6828968060611f2c245b282ec2921ab020236 Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Fri, 10 Oct 2025 21:14:01 +0530 Subject: [PATCH 11/39] Update test --- tasks/run-matlab-tests/v1/test/scriptgen.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/run-matlab-tests/v1/test/scriptgen.test.ts b/tasks/run-matlab-tests/v1/test/scriptgen.test.ts index c10cc258..86bf15b3 100644 --- a/tasks/run-matlab-tests/v1/test/scriptgen.test.ts +++ b/tasks/run-matlab-tests/v1/test/scriptgen.test.ts @@ -77,7 +77,7 @@ export default function suite() { assert(actual.includes("'CoberturaModelCoverage','test-results/modelcoverage.xml'")); assert(actual.includes("'SelectByTag','FeatureA'")); assert(actual.includes("'SelectByFolder','test/tools;test/toolbox'")); - assert(actual.includes("'SelectByName','{'tTestA/*', 'tTestB/*'}'")); + assert(actual.includes("'SelectByName',{'tTestA/*', 'tTestB/*'}")); assert(actual.includes("'Strict',true")); assert(actual.includes("'UseParallel',true")); assert(actual.includes("'OutputDetail','Detailed'")); From 24c8e78a050e075d70c1e6e9977a1509afe40a4e Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Fri, 10 Oct 2025 21:17:40 +0530 Subject: [PATCH 12/39] Update test --- tasks/run-matlab-tests/v1/test/scriptgen.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/run-matlab-tests/v1/test/scriptgen.test.ts b/tasks/run-matlab-tests/v1/test/scriptgen.test.ts index 86bf15b3..882e15a7 100644 --- a/tasks/run-matlab-tests/v1/test/scriptgen.test.ts +++ b/tasks/run-matlab-tests/v1/test/scriptgen.test.ts @@ -87,7 +87,7 @@ export default function suite() { 'CoberturaCodeCoverage','code-coverage/coverage.xml', 'SourceFolder','source', 'PDFTestReport','test-results/pdf-results.pdf', 'SimulinkTestResults','test-results/simulinkTest.mldatx', 'CoberturaModelCoverage','test-results/modelcoverage.xml', 'SelectByTag','FeatureA', - 'SelectByFolder','test/tools;test/toolbox', 'SelectByName','{'tTestA/*', 'tTestB/*'}', 'Strict',true, 'UseParallel',true, 'OutputDetail','Detailed', + 'SelectByFolder','test/tools;test/toolbox', 'SelectByName',{'tTestA/*', 'tTestB/*'}, 'Strict',true, 'UseParallel',true, 'OutputDetail','Detailed', 'LoggingLevel','Detailed' )` .replace(/\s+/g, ""); assert(actual.replace(/\s+/g, "").includes(expected)); From f32317ef8210cbb2438191adc70f419490223cd7 Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Fri, 10 Oct 2025 21:50:53 +0530 Subject: [PATCH 13/39] Update file --- integ-test-promote-template.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/integ-test-promote-template.yml b/integ-test-promote-template.yml index 3a5d39d4..221d589d 100644 --- a/integ-test-promote-template.yml +++ b/integ-test-promote-template.yml @@ -226,6 +226,7 @@ jobs: inputs: testResultsJUnit: test-results/matlab/selectbyname.xml selectByName: "filtertest/* mytest/StartupTest" + sourceFolder: src - bash: | set -e grep -q FirstTest test-results/matlab/results.xml @@ -247,6 +248,7 @@ jobs: displayName: Verify test filtered by tag name - bash: | set -e + cat test-results/matlab/selectbyname.xml grep -q StartupTest test-results/matlab/selectbyname.xml grep -v simpleTest test-results/matlab/selectbyname.xml ! grep -q FirstTest test-results/matlab/selectbytag.xml From 4c322bf771d37aeafe94db8fafac6b5af767fb8e Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Fri, 10 Oct 2025 22:28:48 +0530 Subject: [PATCH 14/39] Update file --- integ-test-promote-template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integ-test-promote-template.yml b/integ-test-promote-template.yml index 221d589d..4ca78e90 100644 --- a/integ-test-promote-template.yml +++ b/integ-test-promote-template.yml @@ -251,7 +251,7 @@ jobs: cat test-results/matlab/selectbyname.xml grep -q StartupTest test-results/matlab/selectbyname.xml grep -v simpleTest test-results/matlab/selectbyname.xml - ! grep -q FirstTest test-results/matlab/selectbytag.xml + ! grep -q FirstTest test-results/matlab/selectbyname.xml displayName: Verify test filtered by name - bash: | echo 'diary console.log' >> startup.m From 35dae19fd513be8a271e3a39b4dd29a111b296de Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Sat, 11 Oct 2025 00:08:13 +0530 Subject: [PATCH 15/39] Update file --- integ-test-promote-template.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/integ-test-promote-template.yml b/integ-test-promote-template.yml index 4ca78e90..bfd9108e 100644 --- a/integ-test-promote-template.yml +++ b/integ-test-promote-template.yml @@ -248,10 +248,8 @@ jobs: displayName: Verify test filtered by tag name - bash: | set -e - cat test-results/matlab/selectbyname.xml grep -q StartupTest test-results/matlab/selectbyname.xml grep -v simpleTest test-results/matlab/selectbyname.xml - ! grep -q FirstTest test-results/matlab/selectbyname.xml displayName: Verify test filtered by name - bash: | echo 'diary console.log' >> startup.m From cc27322b9832098be5dca6216e7cbd1960a6d3a2 Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Sat, 11 Oct 2025 00:45:03 +0530 Subject: [PATCH 16/39] Update file --- tasks/run-matlab-tests/v1/test/scriptgen.test.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/tasks/run-matlab-tests/v1/test/scriptgen.test.ts b/tasks/run-matlab-tests/v1/test/scriptgen.test.ts index 882e15a7..da98e949 100644 --- a/tasks/run-matlab-tests/v1/test/scriptgen.test.ts +++ b/tasks/run-matlab-tests/v1/test/scriptgen.test.ts @@ -24,7 +24,6 @@ export default function suite() { const actual = scriptgen.generateCommand(options); - console.log(actual); assert(actual.includes("genscript('Test'")); assert(actual.includes("'JUnitTestResults',''")); assert(actual.includes("'CoberturaCodeCoverage',''")); @@ -67,7 +66,6 @@ export default function suite() { const actual = scriptgen.generateCommand(options); - console.log(actual); assert(actual.includes("genscript('Test'")); assert(actual.includes("'JUnitTestResults','test-results/results.xml'")); assert(actual.includes("'CoberturaCodeCoverage','code-coverage/coverage.xml'")); From 608db0edcf0b449b618d9b3e01ab0618cafffc8a Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Tue, 14 Oct 2025 12:02:32 +0530 Subject: [PATCH 17/39] Update failing test --- integ-test-promote-template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integ-test-promote-template.yml b/integ-test-promote-template.yml index bfd9108e..3c409ba8 100644 --- a/integ-test-promote-template.yml +++ b/integ-test-promote-template.yml @@ -294,7 +294,7 @@ jobs: sourceFolder: src - bash: | set -e - grep -q "TestRunner.withTextOutput('LoggingLevel', 3)" console.log + grep -q " testrunner('LoggingLevel', 3)" console.log rm console.log displayName: Verify tests ran with detailed verbosity level for logged diagnostics - bash: | From b859f7e5a170426dba4fb94a1f36db6710dae39d Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Tue, 14 Oct 2025 12:03:50 +0530 Subject: [PATCH 18/39] Update failing test --- integ-test-promote-template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integ-test-promote-template.yml b/integ-test-promote-template.yml index 3c409ba8..9b7db6a3 100644 --- a/integ-test-promote-template.yml +++ b/integ-test-promote-template.yml @@ -284,7 +284,7 @@ jobs: sourceFolder: src - bash: | set -e - grep -q "TestRunner.withTextOutput('OutputDetail', 3)" console.log + grep -q "testrunner('OutputDetail', 3)" console.log rm console.log displayName: Verify tests ran with detailed display level for event details - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABTests.RunMATLABTests@${{ version }} From 4a571d70c6e56fb5b5f982d396ccb5516a883074 Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Wed, 15 Oct 2025 17:42:25 +0530 Subject: [PATCH 19/39] Updated file --- integ-test-promote-template.yml | 68 +++++++++++++++++++++++++++------ 1 file changed, 57 insertions(+), 11 deletions(-) diff --git a/integ-test-promote-template.yml b/integ-test-promote-template.yml index 9b7db6a3..d1d9bbc9 100644 --- a/integ-test-promote-template.yml +++ b/integ-test-promote-template.yml @@ -221,12 +221,6 @@ jobs: inputs: testResultsJUnit: test-results/matlab/selectbytag.xml selectByTag: FILTERED - - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABTests.RunMATLABTests@${{ version }} - displayName: Run MATLAB tests filter by name - inputs: - testResultsJUnit: test-results/matlab/selectbyname.xml - selectByName: "filtertest/* mytest/StartupTest" - sourceFolder: src - bash: | set -e grep -q FirstTest test-results/matlab/results.xml @@ -246,11 +240,6 @@ jobs: grep -v FirstTest test-results/matlab/selectbytag.xml grep -v simpleTest test-results/matlab/selectbytag.xml displayName: Verify test filtered by tag name - - bash: | - set -e - grep -q StartupTest test-results/matlab/selectbyname.xml - grep -v simpleTest test-results/matlab/selectbyname.xml - displayName: Verify test filtered by name - bash: | echo 'diary console.log' >> startup.m displayName: Set up diary for logging @@ -488,3 +477,60 @@ jobs: rm buildlog.txt displayName: Verify that correct tasks appear in buildlog.txt condition: not(eq(${{ version }}, '0')) + +-job: test_run_tests_for_v1 +strategy: + matrix: + microsoft_hosted_linux: + poolName: Azure Pipelines + vmImage: ubuntu-22.04 +pool: + name: $(poolName) + vmImage: $(vmImage) +workspace: + clean: all + steps: + - checkout: none + - task: MathWorks.matlab-azure-devops-extension-dev.InstallMATLAB.InstallMATLAB@${{ version }} + displayName: Install MATLAB on Microsoft-hosted agents + condition: eq(${{ version }}, '0') + - task: MathWorks.matlab-azure-devops-extension-dev.InstallMATLAB.InstallMATLAB@${{ version }} + inputs: + products: Simulink Simulink_Test Simulink_Coverage Parallel_Computing_Toolbox + displayName: Install MATLAB on Microsoft-hosted agents + condition: eq(${{ version }}, '1') + - bash: | + echo 'myvar = 123' > startup.m + mkdir src + echo 'function c=add(a,b);c=a+b;' > src/add.m + mkdir tests + echo "%% StartupTest" > tests/mytest.m + echo "evalin('base','assert(myvar==123)')" >> tests/mytest.m + echo "%% FirstTest" >> tests/mytest.m + echo "assert(add(1,2)==3)" >> tests/mytest.m + mkdir tests/filteredTest + echo "%% simpleTest" >> tests/filteredTest/filtertest.m + echo "assert(2==2)" >> tests/filteredTest/filtertest.m + echo "%% FilterByTag" >> tests/filteredTest/TaggedTest.m + cat << EOF > tests/filteredTest/TaggedTest.m + classdef (TestTags = {'FILTERED'}) TaggedTest < matlab.unittest.TestCase + methods(Test) + function testTag(testCase) + assert(2==2); + end + end + end + EOF + displayName: Make MATLAB tests + - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABTests.RunMATLABTests@${{ version }} + displayName: Run MATLAB tests filter by name + inputs: + testResultsJUnit: test-results/matlab/selectbyname.xml + selectByName: "filtertest/* mytest/StartupTest" + sourceFolder: src + - bash: | + set -e + grep -q StartupTest test-results/matlab/selectbyname.xml + grep -v simpleTest test-results/matlab/selectbyname.xml + displayName: Verify test filtered by name + \ No newline at end of file From ebe8b20a7724bba46f54d3c0faaa60d55bb52780 Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Wed, 15 Oct 2025 18:31:05 +0530 Subject: [PATCH 20/39] Update file --- integ-test-promote-template.yml | 38 ++++++++++++++++----------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/integ-test-promote-template.yml b/integ-test-promote-template.yml index d1d9bbc9..fcac38f8 100644 --- a/integ-test-promote-template.yml +++ b/integ-test-promote-template.yml @@ -478,18 +478,18 @@ jobs: displayName: Verify that correct tasks appear in buildlog.txt condition: not(eq(${{ version }}, '0')) --job: test_run_tests_for_v1 -strategy: - matrix: - microsoft_hosted_linux: - poolName: Azure Pipelines - vmImage: ubuntu-22.04 -pool: - name: $(poolName) - vmImage: $(vmImage) -workspace: - clean: all - steps: + - job: test_run_tests_for_v1 + strategy: + matrix: + microsoft_hosted_linux: + poolName: Azure Pipelines + vmImage: ubuntu-22.04 + pool: + name: $(poolName)git commit --amend -m "Updated file" + vmImage: $(vmImage) + workspace: + clean: all + steps: - checkout: none - task: MathWorks.matlab-azure-devops-extension-dev.InstallMATLAB.InstallMATLAB@${{ version }} displayName: Install MATLAB on Microsoft-hosted agents @@ -525,12 +525,12 @@ workspace: - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABTests.RunMATLABTests@${{ version }} displayName: Run MATLAB tests filter by name inputs: - testResultsJUnit: test-results/matlab/selectbyname.xml - selectByName: "filtertest/* mytest/StartupTest" - sourceFolder: src + testResultsJUnit: test-results/matlab/selectbyname.xml + selectByName: "filtertest/* mytest/StartupTest" + sourceFolder: src - bash: | - set -e - grep -q StartupTest test-results/matlab/selectbyname.xml - grep -v simpleTest test-results/matlab/selectbyname.xml + set -e + grep -q StartupTest test-results/matlab/selectbyname.xml + grep -v simpleTest test-results/matlab/selectbyname.xml displayName: Verify test filtered by name - \ No newline at end of file + \ No newline at end of file From f43cd5c6b37690f5292cb53ba917ecf63b742454 Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Wed, 15 Oct 2025 18:43:38 +0530 Subject: [PATCH 21/39] Update file --- integ-test-promote-template.yml | 71 +++++++-------------------------- 1 file changed, 14 insertions(+), 57 deletions(-) diff --git a/integ-test-promote-template.yml b/integ-test-promote-template.yml index fcac38f8..1e3f1ab5 100644 --- a/integ-test-promote-template.yml +++ b/integ-test-promote-template.yml @@ -221,6 +221,13 @@ jobs: inputs: testResultsJUnit: test-results/matlab/selectbytag.xml selectByTag: FILTERED + - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABTests.RunMATLABTests@${{ version }} + displayName: Run MATLAB tests filter by name + inputs: + testResultsJUnit: test-results/matlab/selectbyname.xml + selectByName: "filtertest/* mytest/StartupTest" + sourceFolder: src + condition: eq(${{ version }}, '1') - bash: | set -e grep -q FirstTest test-results/matlab/results.xml @@ -240,6 +247,13 @@ jobs: grep -v FirstTest test-results/matlab/selectbytag.xml grep -v simpleTest test-results/matlab/selectbytag.xml displayName: Verify test filtered by tag name + - bash: | + set -e + grep -q StartupTest test-results/matlab/selectbyname.xml + grep -v simpleTest test-results/matlab/selectbyname.xml + ! grep -q FirstTest test-results/matlab/selectbytag.xml + displayName: Verify test filtered by name + condition: eq(${{ version }}, '1') - bash: | echo 'diary console.log' >> startup.m displayName: Set up diary for logging @@ -477,60 +491,3 @@ jobs: rm buildlog.txt displayName: Verify that correct tasks appear in buildlog.txt condition: not(eq(${{ version }}, '0')) - - - job: test_run_tests_for_v1 - strategy: - matrix: - microsoft_hosted_linux: - poolName: Azure Pipelines - vmImage: ubuntu-22.04 - pool: - name: $(poolName)git commit --amend -m "Updated file" - vmImage: $(vmImage) - workspace: - clean: all - steps: - - checkout: none - - task: MathWorks.matlab-azure-devops-extension-dev.InstallMATLAB.InstallMATLAB@${{ version }} - displayName: Install MATLAB on Microsoft-hosted agents - condition: eq(${{ version }}, '0') - - task: MathWorks.matlab-azure-devops-extension-dev.InstallMATLAB.InstallMATLAB@${{ version }} - inputs: - products: Simulink Simulink_Test Simulink_Coverage Parallel_Computing_Toolbox - displayName: Install MATLAB on Microsoft-hosted agents - condition: eq(${{ version }}, '1') - - bash: | - echo 'myvar = 123' > startup.m - mkdir src - echo 'function c=add(a,b);c=a+b;' > src/add.m - mkdir tests - echo "%% StartupTest" > tests/mytest.m - echo "evalin('base','assert(myvar==123)')" >> tests/mytest.m - echo "%% FirstTest" >> tests/mytest.m - echo "assert(add(1,2)==3)" >> tests/mytest.m - mkdir tests/filteredTest - echo "%% simpleTest" >> tests/filteredTest/filtertest.m - echo "assert(2==2)" >> tests/filteredTest/filtertest.m - echo "%% FilterByTag" >> tests/filteredTest/TaggedTest.m - cat << EOF > tests/filteredTest/TaggedTest.m - classdef (TestTags = {'FILTERED'}) TaggedTest < matlab.unittest.TestCase - methods(Test) - function testTag(testCase) - assert(2==2); - end - end - end - EOF - displayName: Make MATLAB tests - - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABTests.RunMATLABTests@${{ version }} - displayName: Run MATLAB tests filter by name - inputs: - testResultsJUnit: test-results/matlab/selectbyname.xml - selectByName: "filtertest/* mytest/StartupTest" - sourceFolder: src - - bash: | - set -e - grep -q StartupTest test-results/matlab/selectbyname.xml - grep -v simpleTest test-results/matlab/selectbyname.xml - displayName: Verify test filtered by name - \ No newline at end of file From 9f54ca61acd9c4019de94fc347e107a4ea76ad99 Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Wed, 15 Oct 2025 20:03:27 +0530 Subject: [PATCH 22/39] Update file --- integ-test-promote-template.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/integ-test-promote-template.yml b/integ-test-promote-template.yml index 1e3f1ab5..b6ab9cd9 100644 --- a/integ-test-promote-template.yml +++ b/integ-test-promote-template.yml @@ -227,7 +227,7 @@ jobs: testResultsJUnit: test-results/matlab/selectbyname.xml selectByName: "filtertest/* mytest/StartupTest" sourceFolder: src - condition: eq(${{ version }}, '1') + condition: not(eq(${{ version }}, '0')) - bash: | set -e grep -q FirstTest test-results/matlab/results.xml @@ -253,7 +253,7 @@ jobs: grep -v simpleTest test-results/matlab/selectbyname.xml ! grep -q FirstTest test-results/matlab/selectbytag.xml displayName: Verify test filtered by name - condition: eq(${{ version }}, '1') + condition: not(eq(${{ version }}, '0')) - bash: | echo 'diary console.log' >> startup.m displayName: Set up diary for logging @@ -287,7 +287,7 @@ jobs: sourceFolder: src - bash: | set -e - grep -q "testrunner('OutputDetail', 3)" console.log + grep -q "('OutputDetail', 3)" console.log rm console.log displayName: Verify tests ran with detailed display level for event details - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABTests.RunMATLABTests@${{ version }} @@ -297,7 +297,7 @@ jobs: sourceFolder: src - bash: | set -e - grep -q " testrunner('LoggingLevel', 3)" console.log + grep -q " ('LoggingLevel', 3)" console.log rm console.log displayName: Verify tests ran with detailed verbosity level for logged diagnostics - bash: | From bb81c48bedaac8b0ad8f7f45abc07c5cdd6dd259 Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Wed, 15 Oct 2025 20:55:38 +0530 Subject: [PATCH 23/39] Update file --- integ-test-promote-template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integ-test-promote-template.yml b/integ-test-promote-template.yml index b6ab9cd9..6574bba9 100644 --- a/integ-test-promote-template.yml +++ b/integ-test-promote-template.yml @@ -297,7 +297,7 @@ jobs: sourceFolder: src - bash: | set -e - grep -q " ('LoggingLevel', 3)" console.log + grep -q "('LoggingLevel', 3)" console.log rm console.log displayName: Verify tests ran with detailed verbosity level for logged diagnostics - bash: | From 7220fb2f260f47aef0563b6d1e40d5e0428dc584 Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Thu, 16 Oct 2025 10:10:58 +0530 Subject: [PATCH 24/39] Update file --- integ-test-promote-template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integ-test-promote-template.yml b/integ-test-promote-template.yml index 6574bba9..e36b5724 100644 --- a/integ-test-promote-template.yml +++ b/integ-test-promote-template.yml @@ -225,7 +225,7 @@ jobs: displayName: Run MATLAB tests filter by name inputs: testResultsJUnit: test-results/matlab/selectbyname.xml - selectByName: "filtertest/* mytest/StartupTest" + selectByName: "filtertest/*, mytest/StartupTest" sourceFolder: src condition: not(eq(${{ version }}, '0')) - bash: | From 5706504ed4f7db8fc4c213145268b52b3c803f0a Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Thu, 16 Oct 2025 12:30:21 +0530 Subject: [PATCH 25/39] Update file --- integ-test-promote-template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integ-test-promote-template.yml b/integ-test-promote-template.yml index e36b5724..fb6cec1b 100644 --- a/integ-test-promote-template.yml +++ b/integ-test-promote-template.yml @@ -250,7 +250,7 @@ jobs: - bash: | set -e grep -q StartupTest test-results/matlab/selectbyname.xml - grep -v simpleTest test-results/matlab/selectbyname.xml + grep -q simpleTest test-results/matlab/selectbyname.xml ! grep -q FirstTest test-results/matlab/selectbytag.xml displayName: Verify test filtered by name condition: not(eq(${{ version }}, '0')) From d8491e41c25a4d380b970e6cfe4045709a89cbea Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Thu, 16 Oct 2025 14:10:28 +0530 Subject: [PATCH 26/39] Update file --- integ-test-promote-template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integ-test-promote-template.yml b/integ-test-promote-template.yml index fb6cec1b..bfc14dac 100644 --- a/integ-test-promote-template.yml +++ b/integ-test-promote-template.yml @@ -225,7 +225,7 @@ jobs: displayName: Run MATLAB tests filter by name inputs: testResultsJUnit: test-results/matlab/selectbyname.xml - selectByName: "filtertest/*, mytest/StartupTest" + selectByName: "filtertest/* mytest/StartupTest" sourceFolder: src condition: not(eq(${{ version }}, '0')) - bash: | From 16fd3e028968801d3fa2e91cd34f6405e9c6ed8e Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Mon, 27 Oct 2025 19:41:11 +0530 Subject: [PATCH 27/39] Update file --- integ-test-promote-template.yml | 16 +++++++++++++++- tasks/run-matlab-tests/v1/main.ts | 2 +- tasks/run-matlab-tests/v1/scriptgen.ts | 4 ++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/integ-test-promote-template.yml b/integ-test-promote-template.yml index bfc14dac..d613246f 100644 --- a/integ-test-promote-template.yml +++ b/integ-test-promote-template.yml @@ -228,6 +228,13 @@ jobs: selectByName: "filtertest/* mytest/StartupTest" sourceFolder: src condition: not(eq(${{ version }}, '0')) + - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABTests.RunMATLABTests@${{ version }} + displayName: Run MATLAB tests filter by name with multiple spaces + inputs: + testResultsJUnit: test-results/matlab/selectbynamewithmultiplespaces.xml + selectByName: "filtertest/* mytest/StartupTest" + sourceFolder: src + condition: not(eq(${{ version }}, '0')) - bash: | set -e grep -q FirstTest test-results/matlab/results.xml @@ -251,9 +258,16 @@ jobs: set -e grep -q StartupTest test-results/matlab/selectbyname.xml grep -q simpleTest test-results/matlab/selectbyname.xml - ! grep -q FirstTest test-results/matlab/selectbytag.xml + ! grep -q FirstTest test-results/matlab/selectbyname.xml displayName: Verify test filtered by name condition: not(eq(${{ version }}, '0')) + - bash: | + set -e + grep -q StartupTest test-results/matlab/selectbynamewithmultiplespaces.xml + grep -q simpleTest test-results/matlab/selselectbynamewithmultiplespacesectbyname.xml + ! grep -q FirstTest test-results/matlab/selectbynamewithmultiplespaces.xml + displayName: Verify test filtered by name with multiple spaces + condition: not(eq(${{ version }}, '0')) - bash: | echo 'diary console.log' >> startup.m displayName: Set up diary for logging diff --git a/tasks/run-matlab-tests/v1/main.ts b/tasks/run-matlab-tests/v1/main.ts index 1f155327..c83db0d1 100644 --- a/tasks/run-matlab-tests/v1/main.ts +++ b/tasks/run-matlab-tests/v1/main.ts @@ -14,7 +14,7 @@ async function run() { SourceFolder: taskLib.getInput("sourceFolder"), SelectByFolder: taskLib.getInput("selectByFolder"), SelectByTag: taskLib.getInput("selectByTag"), - SelectByName: taskLib.getInput("SelectByName"), + SelectByName: taskLib.getInput("selectByName"), CoberturaModelCoverage: taskLib.getInput("modelCoverageCobertura"), SimulinkTestResults: taskLib.getInput("testResultsSimulinkTest"), PDFTestReport: taskLib.getInput("testResultsPDF"), diff --git a/tasks/run-matlab-tests/v1/scriptgen.ts b/tasks/run-matlab-tests/v1/scriptgen.ts index 6a578deb..3a1c6c6b 100644 --- a/tasks/run-matlab-tests/v1/scriptgen.ts +++ b/tasks/run-matlab-tests/v1/scriptgen.ts @@ -23,8 +23,8 @@ export function getSelectByNameAsCellArray(input?: string): string { if (!input || !input.trim()) { return "{}"; } - const items = input.split(/\s+/).filter(Boolean).map((s) => `'${s}'`); - return `{${items.join(", ")}}`; + const items = input.split(/\s+/).filter(Boolean).map((s) => `\'${s}\'`); + return `\{${items.join(", ")}\}`; } export function generateCommand(options: IRunTestsOptions): string { From bdbfd264a6fe65e704f4513328c84699c89ccda8 Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Mon, 27 Oct 2025 22:03:55 +0530 Subject: [PATCH 28/39] Update file --- integ-test-promote-template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integ-test-promote-template.yml b/integ-test-promote-template.yml index b7bdc8d6..a6bcf850 100644 --- a/integ-test-promote-template.yml +++ b/integ-test-promote-template.yml @@ -278,7 +278,7 @@ jobs: - bash: | set -e grep -q StartupTest test-results/matlab/selectbynamewithmultiplespaces.xml - grep -q simpleTest test-results/matlab/selselectbynamewithmultiplespacesectbyname.xml + grep -q simpleTest test-results/matlab/selectbynamewithmultiplespacesectbyname.xml ! grep -q FirstTest test-results/matlab/selectbynamewithmultiplespaces.xml displayName: Verify test filtered by name with multiple spaces condition: not(eq(${{ version }}, '0')) From 0928d98c0c53094453892997c21673b3fd56333b Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Mon, 27 Oct 2025 22:32:20 +0530 Subject: [PATCH 29/39] Update file --- integ-test-promote-template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integ-test-promote-template.yml b/integ-test-promote-template.yml index a6bcf850..0d6f19be 100644 --- a/integ-test-promote-template.yml +++ b/integ-test-promote-template.yml @@ -278,7 +278,7 @@ jobs: - bash: | set -e grep -q StartupTest test-results/matlab/selectbynamewithmultiplespaces.xml - grep -q simpleTest test-results/matlab/selectbynamewithmultiplespacesectbyname.xml + grep -q simpleTest test-results/matlab/selectbynamewithmultiplespaces.xml ! grep -q FirstTest test-results/matlab/selectbynamewithmultiplespaces.xml displayName: Verify test filtered by name with multiple spaces condition: not(eq(${{ version }}, '0')) From df19b454ffb5411ba940cbe8d8192cffca970aab Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Wed, 29 Oct 2025 14:47:49 +0530 Subject: [PATCH 30/39] Update file --- tasks/run-matlab-tests/v1/task.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/run-matlab-tests/v1/task.json b/tasks/run-matlab-tests/v1/task.json index 010b97ef..448c898e 100644 --- a/tasks/run-matlab-tests/v1/task.json +++ b/tasks/run-matlab-tests/v1/task.json @@ -64,7 +64,7 @@ "defaultValue": "", "groupName": "filterTests", "required": false, - "helpMarkDown": "Test name used to select test suite elements. To create a test suite, the task uses only the test elements with the specified name." + "helpMarkDown": "Test name used to select test suite elements. To create a test suite, the task uses only the test elements that match the specified name." }, { "name": "strict", From 77d92987d4f75450d47298b807687f2d554003f2 Mon Sep 17 00:00:00 2001 From: mw-hrastega <48831250+mw-hrastega@users.noreply.github.com> Date: Fri, 31 Oct 2025 09:48:47 -0400 Subject: [PATCH 31/39] Document the `selectByName` input --- overview.md | 1 + 1 file changed, 1 insertion(+) diff --git a/overview.md b/overview.md index 7ddeb020..99661383 100644 --- a/overview.md +++ b/overview.md @@ -228,6 +228,7 @@ Input | Description ------------------------- | --------------- `sourceFolder` |

(Optional) Location of the folder containing source code, specified as a path relative to the project root folder. The specified folder and its subfolders are added to the top of the MATLAB search path. If you specify `sourceFolder` and then generate a coverage report, the task uses only the source code in the specified folder and its subfolders to generate the report. You can specify multiple folders using a colon-separated or semicolon-separated list.

**Example:** `sourceFolder: source`
**Example:** `sourceFolder: source/folderA; source/folderB`

`selectByFolder` |

(Optional) Location of the folder used to select test suite elements, specified as a path relative to the project root folder. To create a test suite, the task uses only the tests in the specified folder and its subfolders. You can specify multiple folders using a colon-separated or semicolon-separated list.

**Example:** `selectByFolder: test`
**Example:** `selectByFolder: test/folderA; test/folderB`

+`selectBynName` |

(Optional) Names of the tests to run, specified as a list of test names separated by spaces. If you specify this input, the task runs only the tests with the specified names. You can use the wildcard character (`*`) to match any number of characters and the question mark character (`?`) to match a single character. For example, specify `selectByName: ExampleTest/*` to select all the tests whose name starts with `ExampleTest/`.

For a given test file, the name of a test uniquely identifies the smallest runnable portion of the test content. The test name includes the namespace name, filename (excluding the extension), procedure name, and information about parameterization.

**Example:** `selectByName: ExampleTest/testA`
**Example:** `selectByName: ExampleTest/testA ExampleTest/testB(array=3x3_double)`

`selectByTag` |

(Optional) Test tag used to select test suite elements. To create a test suite, the task uses only the test elements with the specified tag.

**Example:** `selectByTag: Unit`

`strict` |

(Optional) Option to apply strict checks when running tests, specified as `false` or `true`. By default, the value is `false`. If you specify a value of `true`, the task generates a qualification failure whenever a test issues a warning.

**Example:** `strict: true`

`useParallel` |

(Optional) Option to run tests in parallel, specified as `false` or `true`. By default, the value is `false` and tests run in serial. If the test runner configuration is suited for parallelization, you can specify a value of `true` to run tests in parallel. This input requires a Parallel Computing Toolbox license.

**Example:** `useParallel: true`

From 20616204a28ee72ac8d3c2225b7f7a5af18e4862 Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Fri, 5 Dec 2025 11:42:50 +0530 Subject: [PATCH 32/39] use new changes --- tasks/run-matlab-tests/v1/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/run-matlab-tests/v1/package.json b/tasks/run-matlab-tests/v1/package.json index 9fb7e814..ebba75bc 100644 --- a/tasks/run-matlab-tests/v1/package.json +++ b/tasks/run-matlab-tests/v1/package.json @@ -5,7 +5,7 @@ "scripts": { "postinstall": "npm run getBinDep && npm run getScriptgenDep", "getBinDep": "../../../scripts/setupdeps.sh v2", - "getScriptgenDep": "wget -q https://ssd.mathworks.com/supportfiles/ci/matlab-script-generator/v0/matlab-script-generator.zip -O scriptgen.zip; unzip -qod scriptgen scriptgen.zip; rm scriptgen.zip" + "getScriptgenDep": "wget -q https://github.com/Vahila/artifact-zip/releases/download/v1/matlab-script-generator-0.14.0-SNAPSHOT.zip -O scriptgen.zip; unzip -qod scriptgen scriptgen.zip; rm scriptgen.zip" }, "dependencies": { "@types/node": "^22.7.5", From 9b84a3fa81aac958620dcd17230444f5b8aa6aaa Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Fri, 5 Dec 2025 12:23:43 +0530 Subject: [PATCH 33/39] Try new changes --- integ-test-promote-template.yml | 490 ++++++------------------- tasks/run-matlab-tests/v1/scriptgen.ts | 2 +- 2 files changed, 112 insertions(+), 380 deletions(-) diff --git a/integ-test-promote-template.yml b/integ-test-promote-template.yml index 0d6f19be..cd5cd429 100644 --- a/integ-test-promote-template.yml +++ b/integ-test-promote-template.yml @@ -1,161 +1,6 @@ jobs: - ${{ each version in parameters.TASK_VERSION }}: - - job: test_install_v${{ version }} - strategy: - matrix: - microsoft_hosted_linux: - poolName: Azure Pipelines - vmImage: ubuntu-22.04 - microsoft_hosted_macos: - poolName: Azure Pipelines - vmImage: macOS-latest - microsoft_hosted_windows: - poolName: Azure Pipelines - vmImage: windows-latest - pool: - name: $(poolName) - vmImage: $(vmImage) - steps: - - checkout: none - - task: MathWorks.matlab-azure-devops-extension-dev.InstallMATLAB.InstallMATLAB@${{ version }} - displayName: Install MATLAB - - bash: | - set -e - os=$(uname) - if [[ $os = CYGWIN* || $os = MINGW* || $os = MSYS* ]]; then - mex.bat -h - else - mex -h - fi - displayName: Check mex - - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABCommand.RunMATLABCommand@${{ version }} - displayName: Check matlab installation - inputs: - command: version - - - - job: test_install_release_v${{ version }} - strategy: - matrix: - microsoft_hosted_linux: - poolName: Azure Pipelines - vmImage: ubuntu-22.04 - microsoft_hosted_macos: - poolName: Azure Pipelines - vmImage: macOS-latest - microsoft_hosted_windows: - poolName: Azure Pipelines - vmImage: windows-latest - pool: - name: $(poolName) - vmImage: $(vmImage) - steps: - - checkout: none - - task: MathWorks.matlab-azure-devops-extension-dev.InstallMATLAB.InstallMATLAB@${{ version }} - displayName: Install MATLAB - inputs: - release: R2023a - - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABCommand.RunMATLABCommand@${{ version }} - displayName: Check matlab release - inputs: - command: assert(strcmp(version('-release'),'2023a')) - - - job: test_install_latest_including_prerelease_v${{ version }} - condition: not(eq(${{ version }}, '0')) - strategy: - matrix: - microsoft_hosted_linux: - poolName: Azure Pipelines - vmImage: ubuntu-22.04 - pool: - name: $(poolName) - vmImage: $(vmImage) - steps: - - checkout: none - - task: MathWorks.matlab-azure-devops-extension-dev.InstallMATLAB.InstallMATLAB@${{ version }} - displayName: Install MATLAB - inputs: - release: latest-including-prerelease - - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABCommand.RunMATLABCommand@${{ version }} - displayName: Print MATLAB version - inputs: - command: version - - - job: test_run_command_v${{ version }} - strategy: - matrix: - microsoft_hosted_linux: - poolName: Azure Pipelines - vmImage: ubuntu-22.04 - microsoft_hosted_macos: - poolName: Azure Pipelines - vmImage: macOS-latest - microsoft_hosted_windows: - poolName: Azure Pipelines - vmImage: windows-latest - pool: - name: $(poolName) - vmImage: $(vmImage) - steps: - - checkout: none - - task: MathWorks.matlab-azure-devops-extension-dev.InstallMATLAB.InstallMATLAB@${{ version }} - displayName: Install MATLAB on Microsoft-hosted agents - - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABCommand.RunMATLABCommand@${{ version }} - displayName: Run MATLAB statement - inputs: - command: f = fopen('myscript.m', 'w'); fwrite(f, 'assert(true)'); fclose(f); - - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABCommand.RunMATLABCommand@${{ version }} - displayName: Run MATLAB script - inputs: - command: myscript - - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABCommand.RunMATLABCommand@${{ version }} - displayName: Run MATLAB statement with quotes 1 - inputs: - command: 'eval("a = 1+2"); assert(a == 3); eval(''b = 3+4''); assert(b == 7);' - - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABCommand.RunMATLABCommand@${{ version }} - displayName: Run MATLAB statement with quotes 2 - inputs: - command: "eval(\"a = 1+2\"); assert(a == 3); eval('b = 3+4'); assert(b == 7);" - - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABCommand.RunMATLABCommand@${{ version }} - displayName: Run MATLAB statement with quotes 3 - inputs: - command: a = """hello world"""; b = '"hello world"'; assert(strcmp(a,b)); - - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABCommand.RunMATLABCommand@${{ version }} - displayName: Run MATLAB statement with symbols - inputs: - command: a = " !""#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; b = char([32:126]); assert(strcmp(a, b), a+b); - - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABCommand.RunMATLABCommand@${{ version }} - displayName: Run MATLAB statement in working directory - inputs: - command: exp = getenv('SYSTEM_DEFAULTWORKINGDIRECTORY'); act = pwd; assert(strcmp(act, exp), strjoin({act exp}, '\n')); - - bash: | - echo 'myvar = 123' > startup.m - displayName: Create startup.m - - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABCommand.RunMATLABCommand@${{ version }} - displayName: MATLAB runs startup.m automatically - inputs: - command: assert(myvar==123, 'myvar was not set as expected by startup.m') - - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABCommand.RunMATLABCommand@${{ version }} - displayName: Run MATLAB statement with startup options - inputs: - command: disp("Hello world!") - startupOptions: -logfile mylog.log - - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABCommand.RunMATLABCommand@${{ version }} - displayName: Run MATLAB statement with startup options - inputs: - command: assert(isfile("mylog.log"), 'mylog.log was not created as expected') - - bash: | - mkdir subdir - echo 'onetyone = 11' > subdir/startup.m - displayName: Create subdir/startup.m - - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABCommand.RunMATLABCommand@${{ version }} - displayName: Run MATLAB statement with subdir/startup - inputs: - command: > - assert(onetyone==11, 'onetyone was not set as expected by subdir/startup.m'); - [~, folder] = fileparts(pwd()); - assert(strcmp(folder, 'subdir')); - startupOptions: -sd subdir + - job: test_run_tests_v${{ version }} strategy: @@ -201,23 +46,23 @@ jobs: end EOF displayName: Make MATLAB tests - - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABTests.RunMATLABTests@${{ version }} - displayName: Run MATLAB tests with defaults - inputs: - sourceFolder: src - - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABTests.RunMATLABTests@${{ version }} - displayName: Run MATLAB tests producing artifacts - inputs: - testResultsJUnit: test-results/matlab/results.xml - testResultsHTML: test-results/matlab/resultsHTML - codeCoverageCobertura: code-coverage/coverage.xml - codeCoverageHTML: code-coverage/coverageHTML - sourceFolder: src - - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABTests.RunMATLABTests@${{ version }} - displayName: Run MATLAB tests filter by folder - inputs: - testResultsJUnit: test-results/matlab/selectbyfolder.xml - selectByFolder: tests/filteredTest + # - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABTests.RunMATLABTests@${{ version }} + # displayName: Run MATLAB tests with defaults + # inputs: + # sourceFolder: src + # - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABTests.RunMATLABTests@${{ version }} + # displayName: Run MATLAB tests producing artifacts + # inputs: + # testResultsJUnit: test-results/matlab/results.xml + # testResultsHTML: test-results/matlab/resultsHTML + # codeCoverageCobertura: code-coverage/coverage.xml + # codeCoverageHTML: code-coverage/coverageHTML + # sourceFolder: src + # - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABTests.RunMATLABTests@${{ version }} + # displayName: Run MATLAB tests filter by folder + # inputs: + # testResultsJUnit: test-results/matlab/selectbyfolder.xml + # selectByFolder: tests/filteredTest - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABTests.RunMATLABTests@${{ version }} displayName: Run MATLAB tests filter by tag inputs: @@ -237,31 +82,31 @@ jobs: selectByName: "filtertest/* mytest/StartupTest" sourceFolder: src condition: not(eq(${{ version }}, '0')) - - bash: | - set -e - grep -q FirstTest test-results/matlab/results.xml - displayName: Verify test results file was created - - bash: | - set -e - test -d test-results/matlab/resultsHTML - test -f test-results/matlab/resultsHTML/*.html - displayName: Verify HTML test results folder and HTML file was created - condition: not(eq(${{ version }}, '0')) - - bash: | - set -e - grep -q add code-coverage/coverage.xml - displayName: Verify code coverage file was created - - bash: | - set -e - test -d code-coverage/coverageHTML - test -f code-coverage/coverageHTML/*.html - displayName: Verify HTML code coverage folder and HTML file was created - condition: not(eq(${{ version }}, '0')) - - bash: | - set -e - grep -q simpleTest test-results/matlab/selectbyfolder.xml - grep -v FirstTest test-results/matlab/selectbyfolder.xml - displayName: Verify test filtered by folder + # - bash: | + # set -e + # grep -q FirstTest test-results/matlab/results.xml + # displayName: Verify test results file was created + # - bash: | + # set -e + # test -d test-results/matlab/resultsHTML + # test -f test-results/matlab/resultsHTML/*.html + # displayName: Verify HTML test results folder and HTML file was created + # condition: not(eq(${{ version }}, '0')) + # - bash: | + # set -e + # grep -q add code-coverage/coverage.xml + # displayName: Verify code coverage file was created + # - bash: | + # set -e + # test -d code-coverage/coverageHTML + # test -f code-coverage/coverageHTML/*.html + # displayName: Verify HTML code coverage folder and HTML file was created + # condition: not(eq(${{ version }}, '0')) + # - bash: | + # set -e + # grep -q simpleTest test-results/matlab/selectbyfolder.xml + # grep -v FirstTest test-results/matlab/selectbyfolder.xml + # displayName: Verify test filtered by folder - bash: | set -e grep -q TaggedTest test-results/matlab/selectbytag.xml @@ -282,19 +127,19 @@ jobs: ! grep -q FirstTest test-results/matlab/selectbynamewithmultiplespaces.xml displayName: Verify test filtered by name with multiple spaces condition: not(eq(${{ version }}, '0')) - - bash: | - echo 'diary console.log' >> startup.m - displayName: Set up diary for logging - - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABTests.RunMATLABTests@${{ version }} - displayName: Run MATLAB tests with strict checks - inputs: - strict: true - sourceFolder: src - - bash: | - set -e - grep -q "runner.addPlugin(FailOnWarningsPlugin())" console.log - rm console.log - displayName: Verify tests ran with strict checks + # - bash: | + # echo 'diary console.log' >> startup.m + # displayName: Set up diary for logging + # - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABTests.RunMATLABTests@${{ version }} + # displayName: Run MATLAB tests with strict checks + # inputs: + # strict: true + # sourceFolder: src + # - bash: | + # set -e + # grep -q "runner.addPlugin(FailOnWarningsPlugin())" console.log + # rm console.log + # displayName: Verify tests ran with strict checks # Disable parallel tests until PCT bug is fixed g3416906 # - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABTests.RunMATLABTests@${{ version }} # displayName: Run MATLAB tests in parallel @@ -308,26 +153,26 @@ jobs: # rm console.log # displayName: Verify tests ran in parallel # condition: not(eq(${{ version }}, '0')) - - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABTests.RunMATLABTests@${{ version }} - displayName: Run MATLAB tests with detailed display level for event details - inputs: - outputDetail: Detailed - sourceFolder: src - - bash: | - set -e - grep -q "('OutputDetail', 3)" console.log - rm console.log - displayName: Verify tests ran with detailed display level for event details - - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABTests.RunMATLABTests@${{ version }} - displayName: Run MATLAB tests with detailed verbosity level for logged diagnostics - inputs: - loggingLevel: Detailed - sourceFolder: src - - bash: | - set -e - grep -q "('LoggingLevel', 3)" console.log - rm console.log - displayName: Verify tests ran with detailed verbosity level for logged diagnostics + # - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABTests.RunMATLABTests@${{ version }} + # displayName: Run MATLAB tests with detailed display level for event details + # inputs: + # outputDetail: Detailed + # sourceFolder: src + # - bash: | + # set -e + # grep -q "('OutputDetail', 3)" console.log + # rm console.log + # displayName: Verify tests ran with detailed display level for event details + # - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABTests.RunMATLABTests@${{ version }} + # displayName: Run MATLAB tests with detailed verbosity level for logged diagnostics + # inputs: + # loggingLevel: Detailed + # sourceFolder: src + # - bash: | + # set -e + # grep -q "('LoggingLevel', 3)" console.log + # rm console.log + # displayName: Verify tests ran with detailed verbosity level for logged diagnostics - bash: | mkdir simtests cat << EOF > simtests/createModel.m @@ -378,151 +223,38 @@ jobs: EOF displayName: Create model file and Simulink test. condition: eq(variables['Agent.OS'], 'Linux') - - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABCommand.RunMATLABCommand@${{ version }} - displayName: Run model creator and test Simulink test generator - inputs: - command: "cd simtests;createModel" - condition: eq(variables['Agent.OS'], 'Linux') - - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABTests.RunMATLABTests@${{ version }} - displayName: Run MATLAB tests and generate Simulink test artifacts - inputs: - selectByFolder: "simtests" - modelCoverageCobertura: test-results/matlab/modelcoverage.xml - modelCoverageHTML: test-results/matlab/modelcoverageHTML - testResultsSimulinkTest: test-results/matlab/stmResult.mldatx - testResultsPDF: test-results/matlab/results.pdf - condition: eq(variables['Agent.OS'], 'Linux') - - bash: | - set -e - grep -q new_temp_model test-results/matlab/modelcoverage.xml - displayName: Verify Model coverage was created - condition: eq(variables['Agent.OS'], 'Linux') - - bash: | - set -e - test -d test-results/matlab/modelcoverageHTML - test -f test-results/matlab/modelcoverageHTML/*.html - displayName: Verify HTML Model coverage folder and HTML file was created - condition: not(eq(${{ version }}, '0')) - - bash: | - set -e - test -f test-results/matlab/stmResult.mldatx - displayName: Verify STM report was created - condition: eq(variables['Agent.OS'], 'Linux') - - bash: | - set -e - test -f test-results/matlab/results.pdf - displayName: Verify PDF report was created - condition: eq(variables['Agent.OS'], 'Linux') - - - job: test_run_build_v${{ version }} - strategy: - matrix: - microsoft_hosted_linux: - poolName: Azure Pipelines - vmImage: ubuntu-22.04 - setupTask: MathWorks.matlab-azure-devops-extension-dev.InstallMATLAB.InstallMATLAB@${{ version }} - microsoft_hosted_macos: - poolName: Azure Pipelines - vmImage: macOS-latest - setupTask: MathWorks.matlab-azure-devops-extension-dev.InstallMATLAB.InstallMATLAB@${{ version }} - microsoft_hosted_windows: - poolName: Azure Pipelines - vmImage: windows-latest - setupTask: MathWorks.matlab-azure-devops-extension-dev.InstallMATLAB.InstallMATLAB@${{ version }} - pool: - name: $(poolName) - vmImage: $(vmImage) - steps: - - checkout: none - - task: MathWorks.matlab-azure-devops-extension-dev.InstallMATLAB.InstallMATLAB@${{ version }} - displayName: Install MATLAB on Microsoft-hosted agents - condition: not(startsWith(variables['Agent.Name'], 'vmss')) - - bash: | - cat << EOF > buildfile.m - function plan = buildfile - plan = buildplan(localfunctions); - plan("test").Dependencies = "build"; - plan("deploy").Dependencies = "test"; - plan.DefaultTasks = "test"; - - function buildTask(~) - f = fopen('buildlog.txt', 'a+'); fprintf(f, 'building\n'); fclose(f); - - function testTask(~) - f = fopen('buildlog.txt', 'a+'); fprintf(f, 'testing\n'); fclose(f); - - function deployTask(~) - f = fopen('buildlog.txt', 'a+'); fprintf(f, 'deploying\n'); fclose(f); - - function checkTask(~) - f = fopen('buildlog.txt', 'a+'); fprintf(f, 'checking\n'); fclose(f); - - function errorTask(~) - f = fopen('buildlog.txt', 'a+'); fprintf(f, 'erroring\n'); fclose(f); - error('Error occured in errorTask'); - EOF - displayName: Create buildfile.m in project root - - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABBuild.RunMATLABBuild@${{ version }} - displayName: Run build with default tasks - - bash: | - set -e - grep "building" buildlog.txt - grep "testing" buildlog.txt - ! grep "deploying" buildlog.txt - ! grep "checking" buildlog.txt - rm buildlog.txt - displayName: Verify that correct tasks appear in buildlog.txt - - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABBuild.RunMATLABBuild@${{ version }} - displayName: Run build with specified task - inputs: - tasks: deploy - - bash: | - set -e - grep "building" buildlog.txt - grep "testing" buildlog.txt - grep "deploying" buildlog.txt - ! grep "checking" buildlog.txt - rm buildlog.txt - displayName: Verify that correct tasks appear in buildlog.txt - - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABBuild.RunMATLABBuild@${{ version }} - displayName: Run build with multiple specified tasks - inputs: - tasks: deploy check - - bash: | - set -e - grep "building" buildlog.txt - grep "testing" buildlog.txt - grep "deploying" buildlog.txt - grep "checking" buildlog.txt - rm buildlog.txt - displayName: Verify that correct tasks appear in buildlog.txt - - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABBuild.RunMATLABBuild@${{ version }} - displayName: Run build with task skipping - inputs: - tasks: deploy - buildOptions: -skip test - condition: not(eq(${{ version }}, '0')) - - bash: | - set -e - grep "building" buildlog.txt - ! grep "testing" buildlog.txt - grep "deploying" buildlog.txt - rm buildlog.txt - displayName: Verify that correct tasks appear in buildlog.txt - condition: not(eq(${{ version }}, '0')) - - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABBuild.RunMATLABBuild@${{ version }} - displayName: Run build with continue on failure - continueOnError: true - inputs: - tasks: error deploy - buildOptions: -continueOnFailure - condition: not(eq(${{ version }}, '0')) - - bash: | - set -e - grep "erroring" buildlog.txt - grep "building" buildlog.txt - grep "testing" buildlog.txt - grep "deploying" buildlog.txt - rm buildlog.txt - displayName: Verify that correct tasks appear in buildlog.txt - condition: not(eq(${{ version }}, '0')) + # - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABCommand.RunMATLABCommand@${{ version }} + # displayName: Run model creator and test Simulink test generator + # inputs: + # command: "cd simtests;createModel" + # condition: eq(variables['Agent.OS'], 'Linux') + # - task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABTests.RunMATLABTests@${{ version }} + # displayName: Run MATLAB tests and generate Simulink test artifacts + # inputs: + # selectByFolder: "simtests" + # modelCoverageCobertura: test-results/matlab/modelcoverage.xml + # modelCoverageHTML: test-results/matlab/modelcoverageHTML + # testResultsSimulinkTest: test-results/matlab/stmResult.mldatx + # testResultsPDF: test-results/matlab/results.pdf + # condition: eq(variables['Agent.OS'], 'Linux') + # - bash: | + # set -e + # grep -q new_temp_model test-results/matlab/modelcoverage.xml + # displayName: Verify Model coverage was created + # condition: eq(variables['Agent.OS'], 'Linux') + # - bash: | + # set -e + # test -d test-results/matlab/modelcoverageHTML + # test -f test-results/matlab/modelcoverageHTML/*.html + # displayName: Verify HTML Model coverage folder and HTML file was created + # condition: not(eq(${{ version }}, '0')) + # - bash: | + # set -e + # test -f test-results/matlab/stmResult.mldatx + # displayName: Verify STM report was created + # condition: eq(variables['Agent.OS'], 'Linux') + # - bash: | + # set -e + # test -f test-results/matlab/results.pdf + # displayName: Verify PDF report was created + # condition: eq(variables['Agent.OS'], 'Linux') diff --git a/tasks/run-matlab-tests/v1/scriptgen.ts b/tasks/run-matlab-tests/v1/scriptgen.ts index a945f580..ca782a17 100644 --- a/tasks/run-matlab-tests/v1/scriptgen.ts +++ b/tasks/run-matlab-tests/v1/scriptgen.ts @@ -44,7 +44,7 @@ export function generateCommand(options: IRunTestsOptions): string { `'HTMLModelCoverage','${options.HTMLModelCoverage || ""}',` + `'SelectByTag','${options.SelectByTag || ""}',` + `'SelectByFolder','${options.SelectByFolder || ""}',` + - `'SelectByName',${getSelectByNameAsCellArray(options.SelectByName)},` + + `'SelectByName',${options.SelectByName || ""},` + `'Strict',${options.Strict || false},` + `'UseParallel',${options.UseParallel || false},` + `'OutputDetail','${options.OutputDetail || ""}',` + From c299acd91fdf8d421054d2862977d22bac01ca01 Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Fri, 5 Dec 2025 12:34:40 +0530 Subject: [PATCH 34/39] Update test --- tasks/run-matlab-tests/v1/test/scriptgen.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/run-matlab-tests/v1/test/scriptgen.test.ts b/tasks/run-matlab-tests/v1/test/scriptgen.test.ts index 34907634..64392e0c 100644 --- a/tasks/run-matlab-tests/v1/test/scriptgen.test.ts +++ b/tasks/run-matlab-tests/v1/test/scriptgen.test.ts @@ -97,7 +97,7 @@ export default function suite() { 'CoberturaCodeCoverage','code-coverage/coverage.xml','HTMLCodeCoverage','code-coverage/coverageHTML', 'SourceFolder','source', 'PDFTestReport','test-results/pdf-results.pdf', 'HTMLTestReport','test-results/html-resultsHTML', 'SimulinkTestResults','test-results/simulinkTest.mldatx', 'CoberturaModelCoverage','test-results/modelcoverage.xml', 'HTMLModelCoverage','test-results/modelcoverageHTML', 'SelectByTag','FeatureA', - 'SelectByFolder','test/tools;test/toolbox', 'SelectByName',{'tTestA/*', 'tTestB/*'}, 'Strict',true, 'UseParallel',true, 'OutputDetail','Detailed', + 'SelectByFolder','test/tools;test/toolbox', 'SelectByName','tTestA/*', tTestB/*', 'Strict',true, 'UseParallel',true, 'OutputDetail','Detailed', 'LoggingLevel','Detailed' )` .replace(/\s+/g, ""); assert(actual.replace(/\s+/g, "").includes(expected)); From c6ca1c0e9e19428124dce71aecf03a865d56b676 Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Fri, 5 Dec 2025 12:40:08 +0530 Subject: [PATCH 35/39] Update test --- tasks/run-matlab-tests/v1/test/scriptgen.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tasks/run-matlab-tests/v1/test/scriptgen.test.ts b/tasks/run-matlab-tests/v1/test/scriptgen.test.ts index 64392e0c..e59656c8 100644 --- a/tasks/run-matlab-tests/v1/test/scriptgen.test.ts +++ b/tasks/run-matlab-tests/v1/test/scriptgen.test.ts @@ -47,7 +47,7 @@ export default function suite() { const expected = `genscript('Test', 'JUnitTestResults','', 'CoberturaCodeCoverage','','HTMLCodeCoverage','', 'SourceFolder','', 'PDFTestReport','', 'HTMLTestReport','', 'SimulinkTestResults','', - 'CoberturaModelCoverage','', 'HTMLModelCoverage','', 'SelectByTag','', 'SelectByFolder','', 'SelectByName',{}, + 'CoberturaModelCoverage','', 'HTMLModelCoverage','', 'SelectByTag','', 'SelectByFolder','', 'SelectByName','', 'Strict',false, 'UseParallel',false, 'OutputDetail','', 'LoggingLevel','')` .replace(/\s+/g, ""); assert(actual.replace(/\s+/g, "").includes(expected)); @@ -87,7 +87,7 @@ export default function suite() { assert(actual.includes("'HTMLModelCoverage','test-results/modelcoverageHTML'")); assert(actual.includes("'SelectByTag','FeatureA'")); assert(actual.includes("'SelectByFolder','test/tools;test/toolbox'")); - assert(actual.includes("'SelectByName',{'tTestA/*', 'tTestB/*'}")); + assert(actual.includes("'SelectByName','tTestA/* tTestB/*'")); assert(actual.includes("'Strict',true")); assert(actual.includes("'UseParallel',true")); assert(actual.includes("'OutputDetail','Detailed'")); @@ -97,7 +97,7 @@ export default function suite() { 'CoberturaCodeCoverage','code-coverage/coverage.xml','HTMLCodeCoverage','code-coverage/coverageHTML', 'SourceFolder','source', 'PDFTestReport','test-results/pdf-results.pdf', 'HTMLTestReport','test-results/html-resultsHTML', 'SimulinkTestResults','test-results/simulinkTest.mldatx', 'CoberturaModelCoverage','test-results/modelcoverage.xml', 'HTMLModelCoverage','test-results/modelcoverageHTML', 'SelectByTag','FeatureA', - 'SelectByFolder','test/tools;test/toolbox', 'SelectByName','tTestA/*', tTestB/*', 'Strict',true, 'UseParallel',true, 'OutputDetail','Detailed', + 'SelectByFolder','test/tools;test/toolbox', 'SelectByName','tTestA/* tTestB/*', 'Strict',true, 'UseParallel',true, 'OutputDetail','Detailed', 'LoggingLevel','Detailed' )` .replace(/\s+/g, ""); assert(actual.replace(/\s+/g, "").includes(expected)); From 458ae3a6249c29cfad447abdebb4291082a07c3d Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Fri, 5 Dec 2025 12:44:35 +0530 Subject: [PATCH 36/39] Update test --- tasks/run-matlab-tests/v1/test/scriptgen.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tasks/run-matlab-tests/v1/test/scriptgen.test.ts b/tasks/run-matlab-tests/v1/test/scriptgen.test.ts index e59656c8..2ef41bc5 100644 --- a/tasks/run-matlab-tests/v1/test/scriptgen.test.ts +++ b/tasks/run-matlab-tests/v1/test/scriptgen.test.ts @@ -26,7 +26,7 @@ export default function suite() { }; const actual = scriptgen.generateCommand(options); - + console.log('Generated command:', actual); assert(actual.includes("genscript('Test'")); assert(actual.includes("'JUnitTestResults',''")); assert(actual.includes("'CoberturaCodeCoverage',''")); @@ -39,7 +39,7 @@ export default function suite() { assert(actual.includes("'HTMLModelCoverage',''")); assert(actual.includes("'SelectByTag',''")); assert(actual.includes("'SelectByFolder',''")); - assert(actual.includes("'SelectByName',{}")); + assert(actual.includes("'SelectByName',''")); assert(actual.includes("'Strict',false")); assert(actual.includes("'UseParallel',false")); assert(actual.includes("'OutputDetail',''")); @@ -74,7 +74,7 @@ export default function suite() { }; const actual = scriptgen.generateCommand(options); - + console.log('Generated command:', actual); assert(actual.includes("genscript('Test'")); assert(actual.includes("'JUnitTestResults','test-results/results.xml'")); assert(actual.includes("'CoberturaCodeCoverage','code-coverage/coverage.xml'")); From 5e68a6de183a174e6bc35f01e50096e108e654d5 Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Fri, 5 Dec 2025 12:50:08 +0530 Subject: [PATCH 37/39] Update test --- tasks/run-matlab-tests/v1/test/scriptgen.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/run-matlab-tests/v1/test/scriptgen.test.ts b/tasks/run-matlab-tests/v1/test/scriptgen.test.ts index 2ef41bc5..ddcf254e 100644 --- a/tasks/run-matlab-tests/v1/test/scriptgen.test.ts +++ b/tasks/run-matlab-tests/v1/test/scriptgen.test.ts @@ -26,7 +26,7 @@ export default function suite() { }; const actual = scriptgen.generateCommand(options); - console.log('Generated command:', actual); + console.log("Generated command:", actual); assert(actual.includes("genscript('Test'")); assert(actual.includes("'JUnitTestResults',''")); assert(actual.includes("'CoberturaCodeCoverage',''")); @@ -74,7 +74,7 @@ export default function suite() { }; const actual = scriptgen.generateCommand(options); - console.log('Generated command:', actual); + console.log("Generated command:", actual); assert(actual.includes("genscript('Test'")); assert(actual.includes("'JUnitTestResults','test-results/results.xml'")); assert(actual.includes("'CoberturaCodeCoverage','code-coverage/coverage.xml'")); From c99c37d93c1a5aca6695c96dc47fcc5dbac48788 Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Fri, 5 Dec 2025 12:56:42 +0530 Subject: [PATCH 38/39] Update test --- tasks/run-matlab-tests/v1/scriptgen.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/run-matlab-tests/v1/scriptgen.ts b/tasks/run-matlab-tests/v1/scriptgen.ts index ca782a17..37a84598 100644 --- a/tasks/run-matlab-tests/v1/scriptgen.ts +++ b/tasks/run-matlab-tests/v1/scriptgen.ts @@ -44,7 +44,7 @@ export function generateCommand(options: IRunTestsOptions): string { `'HTMLModelCoverage','${options.HTMLModelCoverage || ""}',` + `'SelectByTag','${options.SelectByTag || ""}',` + `'SelectByFolder','${options.SelectByFolder || ""}',` + - `'SelectByName',${options.SelectByName || ""},` + + `'SelectByName','${options.SelectByName || ""}',` + `'Strict',${options.Strict || false},` + `'UseParallel',${options.UseParallel || false},` + `'OutputDetail','${options.OutputDetail || ""}',` + From d0114e0f1dd9f5ea2038deaf79bf55a3e9bb5b2f Mon Sep 17 00:00:00 2001 From: Vahila <70003902+Vahila@users.noreply.github.com> Date: Fri, 5 Dec 2025 13:29:16 +0530 Subject: [PATCH 39/39] add version --- build-test-publish.pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-test-publish.pipeline.yml b/build-test-publish.pipeline.yml index f6cb0c23..94c2dd34 100644 --- a/build-test-publish.pipeline.yml +++ b/build-test-publish.pipeline.yml @@ -1,4 +1,4 @@ -name: 1.14$(Rev:.r) +name: 1.15$(Rev:.r) trigger: - master