Skip to content

Commit b5e59ea

Browse files
committed
Merged manage_support_dev into manage_support_tests
2 parents 9c612f3 + 54edbb7 commit b5e59ea

19 files changed

Lines changed: 1869 additions & 1672 deletions

package.json

Lines changed: 136 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@
140140
"category": "VectorCAST Test Explorer",
141141
"title": "Clean Environment"
142142
},
143+
{
144+
"command": "vectorcastTestExplorer.deleteEnviroFromProject",
145+
"category": "VectorCAST Test Explorer",
146+
"title": "Delete Environment from Project"
147+
},
143148
{
144149
"command": "vectorcastTestExplorer.removeTestsuite",
145150
"category": "VectorCAST Test Explorer",
@@ -456,6 +461,10 @@
456461
"command": "vectorcastTestExplorer.cleanEnviro",
457462
"when": "never"
458463
},
464+
{
465+
"command": "vectorcastTestExplorer.deleteEnviroFromProject",
466+
"when": "never"
467+
},
459468
{
460469
"command": "vectorcastTestExplorer.removeTestsuite",
461470
"when": "never"
@@ -677,128 +686,133 @@
677686
"group": "vcast@3"
678687
}
679688
],
680-
"vectorcastTestExplorer.vcastsubmenu": [
681-
{
682-
"command": "vectorcastTestExplorer.openVCAST",
683-
"group": "vcastOpen@1",
684-
"when": "testId =~ /^vcast:.*$/ && testId in vectorcastTestExplorer.vcastEnviroList && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList"
685-
},
686-
{
687-
"command": "vectorcastTestExplorer.buildProjectEnviro",
688-
"group": "vcastBuild@1",
689-
"when": "testId =~ /^vcast:.*$/ && testId in vectorcastTestExplorer.vcastUnbuiltEnviroList"
690-
},
691-
{
692-
"command": "vectorcastTestExplorer.buildExecuteIncremental",
693-
"group": "vcastBuild@3",
694-
"when": "vectorcastTestExplorer.globalProjectIsOpenedChecker && ( testId =~ /\\.vcm$/ || testId in vectorcastTestExplorer.globalProjectCompilers || testId in vectorcastTestExplorer.globalProjectTestsuites || (testId =~ /^vcast:.*$/ && ( testId in vectorcastTestExplorer.vcastEnviroList || testId in vectorcastTestExplorer.vcastUnbuiltEnviroList)))"
695-
},
696-
{
697-
"command": "vectorcastTestExplorer.rebuildEnviro",
698-
"group": "vcast@2",
699-
"when": "testId =~ /^vcast:.*$/ && testId in vectorcastTestExplorer.vcastEnviroList && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList"
700-
},
701-
{
702-
"command": "vectorcastTestExplorer.addTestsuiteToCompiler",
703-
"group": "vcast@1",
704-
"when": "testId in vectorcastTestExplorer.globalProjectCompilers"
705-
},
706-
{
707-
"command": "vectorcastTestExplorer.addEnviroToProject",
708-
"group": "vcast@1",
709-
"when": "testId =~ /\\.vcm$/"
710-
},
711-
{
712-
"command": "vectorcastTestExplorer.updateProjectEnvironment",
713-
"group": "vcast@1",
714-
"when": "(testId =~ /^vcast:.*$/ && (testId in vectorcastTestExplorer.vcastUnbuiltEnviroList || testId in vectorcastTestExplorer.vcastEnviroList) && vectorcastTestExplorer.globalProjectIsOpenedChecker) && !config.vectorcastTestExplorer.automaticallyUpdateManageProject"
715-
},
716-
{
717-
"command": "vectorcastTestExplorer.addCompilerToProject",
718-
"group": "vcast@1",
719-
"when": "testId =~ /\\.vcm$/"
720-
},
721-
{
722-
"command": "vectorcastTestExplorer.openProjectInVectorCAST",
723-
"group": "vcast@1",
724-
"when": "testId =~ /\\.vcm$/ || testId in vectorcastTestExplorer.globalProjectCompilers || testId in vectorcastTestExplorer.globalProjectTestsuites"
725-
},
726-
{
727-
"command": "vectorcastTestExplorer.deleteTestsuite",
728-
"group": "vcast@1",
729-
"when": "testId in vectorcastTestExplorer.globalProjectTestsuites"
730-
},
731-
{
732-
"command": "vectorcastTestExplorer.deleteCompiler",
733-
"group": "vcast@1",
734-
"when": "testId in vectorcastTestExplorer.globalProjectCompilers"
735-
},
736-
{
737-
"command": "vectorcastTestExplorer.deleteEnviro",
738-
"group": "vcast@3",
739-
"when": "testId =~ /^vcast:.*$/ && testId in vectorcastTestExplorer.vcastEnviroList && !vectorcastTestExplorer.globalProjectIsOpenedChecker"
740-
},
741-
{
742-
"command": "vectorcastTestExplorer.cleanEnviro",
743-
"group": "vcast@3",
744-
"when": "testId =~ /^vcast:.*$/ && testId in vectorcastTestExplorer.vcastEnviroList && vectorcastTestExplorer.globalProjectIsOpenedChecker && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList"
745-
},
746-
{
747-
"command": "vectorcastTestExplorer.removeTestsuite",
748-
"group": "vcast@1",
749-
"when": "testId =~ /^vcast:.*$/ && (testId in vectorcastTestExplorer.vcastUnbuiltEnviroList || testId in vectorcastTestExplorer.vcastEnviroList) && vectorcastTestExplorer.globalProjectIsOpenedChecker"
750-
},
751-
{
752-
"command": "vectorcastTestExplorer.editTestScript",
753-
"group": "vcast@4",
754-
"when": "testId =~ /^vcast:.*$/ && !(testId =~ /.*coded_tests_driver.*/) && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList"
755-
},
756-
{
757-
"command": "vectorcastTestExplorer.createTestScript",
758-
"group": "vcast@5",
759-
"when": "testId =~ /^vcast:.*$/ && testId not in vectorcastTestExplorer.vcastEnviroList && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList && !(testId =~ /.*coded_tests_driver.*/)"
760-
},
761-
{
762-
"command": "vectorcastTestExplorer.addCodedTests",
763-
"group": "vcast@4",
764-
"when": "testId =~ /^vcast:.*$/ && testId =~ /.*coded_tests_driver$/ && testId not in vectorcastTestExplorer.vcastHasCodedTestsList"
765-
},
766-
{
767-
"command": "vectorcastTestExplorer.generateCodedTests",
768-
"group": "vcast@5",
769-
"when": "testId =~ /^vcast:.*$/ && testId =~ /.*coded_tests_driver$/ && testId not in vectorcastTestExplorer.vcastHasCodedTestsList"
770-
},
771-
{
772-
"command": "vectorcastTestExplorer.removeCodedTests",
773-
"group": "vcast@6",
774-
"when": "testId =~ /^vcast:.*$/ && testId =~ /.*coded_tests_driver$/ && testId in vectorcastTestExplorer.vcastHasCodedTestsList"
775-
},
776-
{
777-
"command": "vectorcastTestExplorer.editCodedTest",
778-
"group": "vcast@7",
779-
"when": "testId =~ /^vcast:.*$/ && testId not in vectorcastTestExplorer.vcastEnviroList && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList && testId =~ /.*coded_tests_driver.+/"
780-
},
781-
{
782-
"command": "vectorcastTestExplorer.insertBasisPathTests",
783-
"group": "vcast@6",
784-
"when": "testId =~ /^vcast:.*$/ && !(testId =~ /^.*<<COMPOUND>>.*$/) && !(testId =~ /^.*<<INIT>>.*$/) && !(testId =~ /.*coded_tests_driver.*/) && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList"
785-
},
786-
{
787-
"command": "vectorcastTestExplorer.insertATGTests",
788-
"group": "vcast@7",
789-
"when": "testId =~ /^vcast:.*$/ && vectorcastTestExplorer.atgAvailable && !(testId =~ /^.*<<COMPOUND>>.*$/) && !(testId =~ /^.*<<INIT>>.*$/) && !(testId =~ /.*coded_tests_driver.*/) && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList"
790-
},
791-
{
792-
"command": "vectorcastTestExplorer.deleteTest",
793-
"group": "vcast@8",
794-
"when": "testId =~ /^vcast:.*$/ && !(testId =~ /.*coded_tests_driver.*/) && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList"
795-
},
796-
{
797-
"command": "vectorcastTestExplorer.viewResults",
798-
"group": "vcast@9",
799-
"when": "testId =~ /^vcast:.*$/ && testId not in vectorcastTestExplorer.vcastEnviroList && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList"
800-
}
801-
]
689+
"vectorcastTestExplorer.vcastsubmenu": [
690+
{
691+
"command": "vectorcastTestExplorer.openProjectInVectorCAST",
692+
"group": "vcast.project",
693+
"when": "testId =~ /\\.vcm$/ || testId in vectorcastTestExplorer.globalProjectCompilers || testId in vectorcastTestExplorer.globalProjectTestsuites"
694+
},
695+
{
696+
"command": "vectorcastTestExplorer.addCompilerToProject",
697+
"group": "vcast.project",
698+
"when": "testId =~ /\\.vcm$/"
699+
},
700+
{
701+
"command": "vectorcastTestExplorer.addEnviroToProject",
702+
"group": "vcast.project",
703+
"when": "testId =~ /\\.vcm$/"
704+
},
705+
{
706+
"command": "vectorcastTestExplorer.addTestsuiteToCompiler",
707+
"group": "vcast.project",
708+
"when": "testId in vectorcastTestExplorer.globalProjectCompilers"
709+
},
710+
{
711+
"command": "vectorcastTestExplorer.updateProjectEnvironment",
712+
"group": "vcast.project",
713+
"when": "(testId =~ /^vcast:.*$/ && (testId in vectorcastTestExplorer.vcastUnbuiltEnviroList || testId in vectorcastTestExplorer.vcastEnviroList) && vectorcastTestExplorer.globalProjectIsOpenedChecker) && !config.vectorcastTestExplorer.automaticallyUpdateManageProject"
714+
},
715+
{
716+
"command": "vectorcastTestExplorer.buildProjectEnviro",
717+
"group": "vcast.build",
718+
"when": "testId =~ /^vcast:.*$/ && testId in vectorcastTestExplorer.vcastUnbuiltEnviroList"
719+
},
720+
{
721+
"command": "vectorcastTestExplorer.buildExecuteIncremental",
722+
"group": "vcast.build",
723+
"when": "vectorcastTestExplorer.globalProjectIsOpenedChecker && ( testId =~ /\\.vcm$/ || testId in vectorcastTestExplorer.globalProjectCompilers || testId in vectorcastTestExplorer.globalProjectTestsuites || (testId =~ /^vcast:.*$/ && ( testId in vectorcastTestExplorer.vcastEnviroList || testId in vectorcastTestExplorer.vcastUnbuiltEnviroList)))"
724+
},
725+
{
726+
"command": "vectorcastTestExplorer.rebuildEnviro",
727+
"group": "vcast.build",
728+
"when": "testId =~ /^vcast:.*$/ && testId in vectorcastTestExplorer.vcastEnviroList && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList"
729+
},
730+
{
731+
"command": "vectorcastTestExplorer.cleanEnviro",
732+
"group": "vcast.build",
733+
"when": "testId =~ /^vcast:.*$/ && testId in vectorcastTestExplorer.vcastEnviroList && vectorcastTestExplorer.globalProjectIsOpenedChecker && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList"
734+
},
735+
{
736+
"command": "vectorcastTestExplorer.openVCAST",
737+
"group": "vcast.enviroManagement",
738+
"when": "testId =~ /^vcast:.*$/ && testId in vectorcastTestExplorer.vcastEnviroList && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList"
739+
},
740+
{
741+
"command": "vectorcastTestExplorer.deleteEnviro",
742+
"group": "vcast.enviroManagement",
743+
"when": "testId =~ /^vcast:.*$/ && testId in vectorcastTestExplorer.vcastEnviroList && !vectorcastTestExplorer.globalProjectIsOpenedChecker"
744+
},
745+
{
746+
"command": "vectorcastTestExplorer.deleteEnviroFromProject",
747+
"group": "vcast.enviroManagement",
748+
"when": "testId =~ /^vcast:.*$/ && (testId in vectorcastTestExplorer.vcastUnbuiltEnviroList || testId in vectorcastTestExplorer.vcastEnviroList) && vectorcastTestExplorer.globalProjectIsOpenedChecker"
749+
},
750+
{
751+
"command": "vectorcastTestExplorer.removeTestsuite",
752+
"group": "vcast.enviroManagement",
753+
"when": "testId =~ /^vcast:.*$/ && (testId in vectorcastTestExplorer.vcastUnbuiltEnviroList || testId in vectorcastTestExplorer.vcastEnviroList) && vectorcastTestExplorer.globalProjectIsOpenedChecker"
754+
},
755+
{
756+
"command": "vectorcastTestExplorer.editTestScript",
757+
"group": "vcast.testScript",
758+
"when": "testId =~ /^vcast:.*$/ && !(testId =~ /.*coded_tests_driver.*/) && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList"
759+
},
760+
{
761+
"command": "vectorcastTestExplorer.createTestScript",
762+
"group": "vcast.testScript",
763+
"when": "testId =~ /^vcast:.*$/ && testId not in vectorcastTestExplorer.vcastEnviroList && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList && !(testId =~ /.*coded_tests_driver.*/ )"
764+
},
765+
{
766+
"command": "vectorcastTestExplorer.editCodedTest",
767+
"group": "vcast.testScript",
768+
"when": "testId =~ /^vcast:.*$/ && testId not in vectorcastTestExplorer.vcastEnviroList && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList && testId =~ /.*coded_tests_driver.+/"
769+
},
770+
{
771+
"command": "vectorcastTestExplorer.addCodedTests",
772+
"group": "vcast.testScript",
773+
"when": "testId =~ /^vcast:.*$/ && testId =~ /.*coded_tests_driver$/ && testId not in vectorcastTestExplorer.vcastHasCodedTestsList"
774+
},
775+
{
776+
"command": "vectorcastTestExplorer.generateCodedTests",
777+
"group": "vcast.testScript",
778+
"when": "testId =~ /^vcast:.*$/ && testId =~ /.*coded_tests_driver$/ && testId not in vectorcastTestExplorer.vcastHasCodedTestsList"
779+
},
780+
{
781+
"command": "vectorcastTestExplorer.removeCodedTests",
782+
"group": "vcast.testScript",
783+
"when": "testId =~ /^vcast:.*$/ && testId =~ /.*coded_tests_driver$/ && testId in vectorcastTestExplorer.vcastHasCodedTestsList"
784+
},
785+
{
786+
"command": "vectorcastTestExplorer.insertBasisPathTests",
787+
"group": "vcast.testGeneration",
788+
"when": "testId =~ /^vcast:.*$/ && !(testId =~ /^.*<<COMPOUND>>.*$/) && !(testId =~ /^.*<<INIT>>.*$/) && !(testId =~ /.*coded_tests_driver.*/) && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList"
789+
},
790+
{
791+
"command": "vectorcastTestExplorer.insertATGTests",
792+
"group": "vcast.testGeneration",
793+
"when": "testId =~ /^vcast:.*$/ && vectorcastTestExplorer.atgAvailable && !(testId =~ /^.*<<COMPOUND>>.*$/) && !(testId =~ /^.*<<INIT>>.*$/) && !(testId =~ /.*coded_tests_driver.*/) && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList"
794+
},
795+
{
796+
"command": "vectorcastTestExplorer.deleteTest",
797+
"group": "vcast.delete",
798+
"when": "testId =~ /^vcast:.*$/ && !(testId =~ /.*coded_tests_driver.*/) && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList"
799+
},
800+
{
801+
"command": "vectorcastTestExplorer.deleteTestsuite",
802+
"group": "vcast.delete",
803+
"when": "testId in vectorcastTestExplorer.globalProjectTestsuites"
804+
},
805+
{
806+
"command": "vectorcastTestExplorer.deleteCompiler",
807+
"group": "vcast.delete",
808+
"when": "testId in vectorcastTestExplorer.globalProjectCompilers"
809+
},
810+
{
811+
"command": "vectorcastTestExplorer.viewResults",
812+
"group": "vcast.results",
813+
"when": "testId =~ /^vcast:.*$/ && testId not in vectorcastTestExplorer.vcastEnviroList && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList"
814+
}
815+
]
802816
},
803817
"submenus": [
804818
{

src/callbacks.ts

Lines changed: 13 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -30,59 +30,11 @@ import {
3030
const fs = require("fs");
3131
const path = require("path");
3232

33-
export async function addEnvToProjectCallback(
34-
enviroPath: string,
35-
code: number
36-
) {
37-
// This function gets called after we add an environment to a project.
38-
// We check the return code, update Project Tree, and cleanup on failure
39-
40-
if (code == 0) {
41-
await refreshAllExtensionData();
42-
} else {
43-
try {
44-
// remove the environment directory, as well as the .vce file
45-
vectorMessage("Environment adding failed, removing artifacts ...");
46-
fs.rmSync(enviroPath, { recursive: true, force: true });
47-
fs.unlinkSync(enviroPath + ".vce");
48-
// Don't want to remove the .env, because leaving it allows the
49-
// user to edit and then right click to try a re-build
50-
} catch {
51-
// ignore errors
52-
}
53-
}
54-
}
55-
5633
/**
57-
* Callback function for executing buildEnvironmentIncremental command
58-
* @param enviroPathList List of env path
59-
* @param code Exit code
34+
* Callback function when we build a single (Project-) Environment
35+
* @param enviroPath Path to env
36+
* @param code Exit code of the process
6037
*/
61-
export async function buildEnvironmentIncrementalCallback(
62-
enviroPathList: string[],
63-
code: number
64-
) {
65-
// This function gets called after we build an environment
66-
// We check the return code, update the test pane, and cleanup on failure
67-
68-
for (let enviroPath of enviroPathList) {
69-
if (code == 0) {
70-
await updateDataForEnvironment(enviroPath);
71-
} else {
72-
try {
73-
// remove the environment directory, as well as the .vce file
74-
vectorMessage("Environment build failed, removing artifacts ...");
75-
fs.rmSync(enviroPath, { recursive: true, force: true });
76-
fs.unlinkSync(enviroPath + ".vce");
77-
// Don't want to remove the .env, because leaving it allows the
78-
// user to edit and then right click to try a re-build
79-
} catch {
80-
// ignore errors
81-
}
82-
}
83-
}
84-
}
85-
8638
export async function buildEnvironmentCallback(
8739
enviroPath: string,
8840
code: number
@@ -108,6 +60,11 @@ export async function buildEnvironmentCallback(
10860
}
10961
}
11062

63+
/**
64+
* Callback function when we re-build a single (Project-) Environment
65+
* @param enviroPath Path to env
66+
* @param code Exit code of the process
67+
*/
11168
export async function rebuildEnvironmentCallback(
11269
enviroPath: string,
11370
code: number
@@ -131,37 +88,11 @@ export async function rebuildEnvironmentCallback(
13188
}
13289
}
13390

134-
export async function cleanEnvironmentCallback(
135-
enviroNodeID: string,
136-
code: number
137-
) {
138-
// if the delete succeeded then we need to remove the environment from the test pane
139-
if (code == 0) {
140-
removeCBTfilesCacheForEnviro(enviroNodeID);
141-
let enviroPath = getEnviroPathFromID(enviroNodeID);
142-
if (!enviroPath) {
143-
// We check if it is present in the unbuilt list
144-
// If so, we take the id and split it after "vcast:" to get the path
145-
// In case that is not possible, we throw an error message
146-
if (vcastUnbuiltEnviroList.includes(enviroNodeID)) {
147-
const parts = enviroNodeID.split(":");
148-
enviroPath = parts.slice(1).join(":");
149-
} else {
150-
vscode.window.showErrorMessage(
151-
`Unable to determine environment path from node: ${enviroNodeID}`
152-
);
153-
return;
154-
}
155-
}
156-
157-
removeCoverageDataForEnviro(enviroPath);
158-
await refreshAllExtensionData();
159-
160-
// vcast does not delete the ENVIRO-NAME.* files so we clean those up here
161-
removeFilePattern(enviroPath, ".*");
162-
}
163-
}
164-
91+
/**
92+
* Callback function when we delete a single Environment
93+
* @param enviroPath Path to env
94+
* @param code Exit code of the process
95+
*/
16596
export async function deleteEnvironmentCallback(
16697
enviroNodeID: string,
16798
code: number

0 commit comments

Comments
 (0)