-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[projmgr] Check
created-for:
with version number
- Loading branch information
1 parent
d989870
commit 17b2ab1
Showing
8 changed files
with
86 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tools/projmgr/test/data/TestSolution/Executes/error.csolution.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tools/projmgr/test/data/TestSolution/Executes/solution.csolution.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
tools/projmgr/test/data/TestSolution/created-for.csolution.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/Open-CMSIS-Pack/devtools/main/tools/projmgr/schemas/csolution.schema.json | ||
|
||
solution: | ||
created-for: [email protected] | ||
|
||
target-types: | ||
- type: CM0 | ||
device: RteTest_ARMCM0 | ||
|
||
packs: | ||
- pack: ARM::[email protected] | ||
|
||
projects: | ||
- project: ./TestProject1/test1.cproject.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5763,3 +5763,38 @@ TEST_F(ProjMgrUnitTests, TestRestrictedContextsWithContextSet_Pass) { | |
|
||
EXPECT_EQ(0, RunProjMgr(10, argv, m_envp)); | ||
} | ||
|
||
TEST_F(ProjMgrUnitTests, ValidateCreatedFor) { | ||
const vector<tuple<string, string, bool>> testData = { | ||
{ "[email protected]", "error" , false }, | ||
{ "[email protected]", "warning", true }, | ||
{ "[email protected]", "" , true }, | ||
{ "" , "" , true }, | ||
{ "Unknown" , "warning", true }, | ||
}; | ||
StdStreamRedirect streamRedirect; | ||
for (const auto& [createdFor, expectedMsg, expectedReturn] : testData) { | ||
streamRedirect.ClearStringStreams(); | ||
EXPECT_EQ(expectedReturn, ValidateCreatedFor(createdFor)); | ||
auto errMsg = streamRedirect.GetErrorString(); | ||
if (expectedMsg.empty()) { | ||
EXPECT_EQ(RteUtils::EMPTY_STRING, errMsg); | ||
} else { | ||
EXPECT_NE(string::npos, errMsg.find(expectedMsg)); | ||
} | ||
} | ||
} | ||
|
||
TEST_F(ProjMgrUnitTests, FailCreatedFor) { | ||
char* argv[5]; | ||
StdStreamRedirect streamRedirect; | ||
const string& csolution = testinput_folder + "/TestSolution/created-for.csolution.yml"; | ||
const string& expectedErrMsg = "error csolution: solution requires newer CMSIS-Toolbox version 9.9.9"; | ||
argv[1] = (char*)"convert"; | ||
argv[2] = (char*)csolution.c_str(); | ||
argv[3] = (char*)"--output"; | ||
argv[4] = (char*)testoutput_folder.c_str(); | ||
EXPECT_EQ(1, RunProjMgr(5, argv, 0)); | ||
auto errMsg = streamRedirect.GetErrorString(); | ||
EXPECT_NE(string::npos, errMsg.find(expectedErrMsg)); | ||
} |