-
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] Add --frozen-packs argument to csolution
The --frozen-packs option is only applicable for the following commands: - convert - run - update-rte This current implementation will do the command and then check if it's supposed to be failed or not. This does support the CI use case, but the project will be modified regardless of the --frozen-packs flag. Contributed by STMicroelectronics Signed-off-by: Torbjörn SVENSSON <[email protected]>
- Loading branch information
1 parent
bb3d2f7
commit e5eced6
Showing
12 changed files
with
118 additions
and
24 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
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
5 changes: 5 additions & 0 deletions
5
tools/projmgr/test/data/TestSolution/PackLocking/cbuild_pack_frozen.cbuild-pack.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,5 @@ | ||
cbuild-pack: | ||
resolved-packs: | ||
- resolved-pack: ARM::[email protected] | ||
selected-by: | ||
- ARM::RteTest_DFP |
10 changes: 10 additions & 0 deletions
10
tools/projmgr/test/data/TestSolution/PackLocking/cbuild_pack_frozen.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,10 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/Open-CMSIS-Pack/devtools/main/tools/projmgr/schemas/csolution.schema.json | ||
|
||
solution: | ||
target-types: | ||
- type: CM0 | ||
device: RteTest_ARMCM0 | ||
packs: | ||
- pack: ARM::[email protected] | ||
projects: | ||
- project: ./project_with_dfp_components.cproject.yml |
10 changes: 10 additions & 0 deletions
10
.../projmgr/test/data/TestSolution/PackLocking/cbuild_pack_frozen_no_pack_file.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,10 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/Open-CMSIS-Pack/devtools/main/tools/projmgr/schemas/csolution.schema.json | ||
|
||
solution: | ||
target-types: | ||
- type: CM0 | ||
device: RteTest_ARMCM0 | ||
packs: | ||
- pack: ARM::[email protected] | ||
projects: | ||
- project: ./project_with_dfp_components.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 |
---|---|---|
|
@@ -849,7 +849,6 @@ TEST_F(ProjMgrUnitTests, RunProjMgrSolution_LockPackCleanup) { | |
|
||
TEST_F(ProjMgrUnitTests, RunProjMgrSolution_LockPackNoPackList) { | ||
char* argv[6]; | ||
string buf1, buf2; | ||
|
||
// convert --solution solution.yml | ||
const string csolution = testinput_folder + "/TestSolution/PackLocking/project_pack_lock_no_pack_list.csolution.yml"; | ||
|
@@ -871,6 +870,61 @@ TEST_F(ProjMgrUnitTests, RunProjMgrSolution_LockPackNoPackList) { | |
ProjMgrTestEnv::CompareFile(expectedCbuildPack, cbuildPack); | ||
} | ||
|
||
TEST_F(ProjMgrUnitTests, RunProjMgrSolution_LockPackFrozen) { | ||
char* argv[7]; | ||
StdStreamRedirect streamRedirect; | ||
string buf; | ||
|
||
// convert --solution solution.yml | ||
const string csolution = testinput_folder + "/TestSolution/PackLocking/cbuild_pack_frozen.csolution.yml"; | ||
const string cbuildPack = testinput_folder + "/TestSolution/PackLocking/cbuild_pack_frozen.cbuild-pack.yml"; | ||
const string expectedCbuildPack = RteFsUtils::BackupFile(cbuildPack); | ||
const string output = testoutput_folder + "/testpacklock"; | ||
argv[1] = (char*)"convert"; | ||
argv[2] = (char*)"--solution"; | ||
argv[3] = (char*)csolution.c_str(); | ||
argv[4] = (char*)"-o"; | ||
argv[5] = (char*)output.c_str(); | ||
argv[6] = (char*)"--frozen-packs"; | ||
|
||
EXPECT_NE(0, RunProjMgr(7, argv, 0)); | ||
EXPECT_NE(streamRedirect.GetErrorString().find(cbuildPack + " - error csolution: file not allowed to be updated"), string::npos); | ||
ProjMgrTestEnv::CompareFile(expectedCbuildPack, cbuildPack); | ||
|
||
// 2nd run to verify that the cbuild-pack.yml content is stable | ||
streamRedirect.ClearStringStreams(); | ||
EXPECT_NE(0, RunProjMgr(7, argv, 0)); | ||
EXPECT_NE(streamRedirect.GetErrorString().find(cbuildPack + " - error csolution: file not allowed to be updated"), string::npos); | ||
ProjMgrTestEnv::CompareFile(expectedCbuildPack, cbuildPack); | ||
|
||
// 3rd run without --frozen-packs to verify that the list can be updated | ||
streamRedirect.ClearStringStreams(); | ||
EXPECT_EQ(0, RunProjMgr(6, argv, 0)); | ||
EXPECT_EQ(streamRedirect.GetErrorString().find(cbuildPack + " - error csolution: file not allowed to be updated"), string::npos); | ||
EXPECT_TRUE(RteFsUtils::Exists(cbuildPack)); | ||
EXPECT_TRUE(RteFsUtils::ReadFile(cbuildPack, buf)); | ||
EXPECT_TRUE(buf.find("- resolved-pack: ARM::[email protected]") != string::npos); | ||
EXPECT_TRUE(buf.find("- ARM::[email protected]") != string::npos); | ||
|
||
RteFsUtils::RemoveFile(expectedCbuildPack); | ||
} | ||
|
||
TEST_F(ProjMgrUnitTests, RunProjMgrSolution_LockPackFrozenNoPackFile) { | ||
char* argv[7]; | ||
|
||
// convert --solution solution.yml | ||
const string csolution = testinput_folder + "/TestSolution/PackLocking/cbuild_pack_frozen_no_pack_file.csolution.yml"; | ||
const string output = testoutput_folder + "/testpacklock"; | ||
argv[1] = (char*)"convert"; | ||
argv[2] = (char*)"--solution"; | ||
argv[3] = (char*)csolution.c_str(); | ||
argv[4] = (char*)"-o"; | ||
argv[5] = (char*)output.c_str(); | ||
argv[6] = (char*)"--frozen-packs"; | ||
|
||
EXPECT_NE(0, RunProjMgr(7, argv, 0)); | ||
} | ||
|
||
TEST_F(ProjMgrUnitTests, RunProjMgrSolution_LockPackReselectSelectedBy) { | ||
char* argv[6]; | ||
|
||
|
@@ -2074,7 +2128,7 @@ TEST_F(ProjMgrUnitTests, RunListContexts) { | |
const string& dirInput = testinput_folder + "/TestSolution/"; | ||
const string& filenameInput = dirInput + "test.csolution.yml"; | ||
error_code ec; | ||
EXPECT_TRUE(m_parser.ParseCsolution(filenameInput, false)); | ||
EXPECT_TRUE(m_parser.ParseCsolution(filenameInput, false, false)); | ||
for (const auto& cproject : m_parser.GetCsolution().cprojects) { | ||
string const& cprojectFile = fs::canonical(dirInput + cproject, ec).generic_string(); | ||
EXPECT_TRUE(m_parser.ParseCproject(cprojectFile, false, false)); | ||
|
@@ -2098,7 +2152,7 @@ TEST_F(ProjMgrUnitTests, RunListContexts_Ordered) { | |
const string& dirInput = testinput_folder + "/TestSolution/"; | ||
const string& filenameInput = dirInput + "test_ordered.csolution.yml"; | ||
error_code ec; | ||
EXPECT_TRUE(m_parser.ParseCsolution(filenameInput, false)); | ||
EXPECT_TRUE(m_parser.ParseCsolution(filenameInput, false, false)); | ||
for (const auto& cproject : m_parser.GetCsolution().cprojects) { | ||
string const& cprojectFile = fs::canonical(dirInput + cproject, ec).generic_string(); | ||
EXPECT_TRUE(m_parser.ParseCproject(cprojectFile, false, false)); | ||
|
@@ -2123,7 +2177,7 @@ TEST_F(ProjMgrUnitTests, RunListContexts_Without_BuildTypes) { | |
const string& dirInput = testinput_folder + "/TestSolution/"; | ||
const string& filenameInput = dirInput + "test_no_buildtypes.csolution.yml"; | ||
error_code ec; | ||
EXPECT_TRUE(m_parser.ParseCsolution(filenameInput, false)); | ||
EXPECT_TRUE(m_parser.ParseCsolution(filenameInput, false, false)); | ||
for (const auto& cproject : m_parser.GetCsolution().cprojects) { | ||
string const& cprojectFile = fs::canonical(dirInput + cproject, ec).generic_string(); | ||
EXPECT_TRUE(m_parser.ParseCproject(cprojectFile, false, false)); | ||
|
@@ -2140,7 +2194,7 @@ TEST_F(ProjMgrUnitTests, RunListContexts_Without_BuildTypes) { | |
TEST_F(ProjMgrUnitTests, AddContextFailed) { | ||
ContextDesc descriptor; | ||
const string& filenameInput = testinput_folder + "/TestSolution/test_missing_project.csolution.yml"; | ||
EXPECT_FALSE(m_parser.ParseCsolution(filenameInput, false)); | ||
EXPECT_FALSE(m_parser.ParseCsolution(filenameInput, false, false)); | ||
EXPECT_FALSE(m_worker.AddContexts(m_parser, descriptor, filenameInput)); | ||
} | ||
|
||
|
@@ -3540,7 +3594,7 @@ TEST_F(ProjMgrUnitTests, RunProjMgr_PreInclude) { | |
|
||
TEST_F(ProjMgrUnitTests, RunCheckForContext) { | ||
const string& filenameInput = testinput_folder + "/TestSolution/contexts.csolution.yml"; | ||
EXPECT_TRUE(m_parser.ParseCsolution(filenameInput, false)); | ||
EXPECT_TRUE(m_parser.ParseCsolution(filenameInput, false, false)); | ||
const CsolutionItem csolutionItem = m_parser.GetCsolution(); | ||
const auto& contexts = csolutionItem.contexts; | ||
const string& cproject = "contexts.cproject.yml"; | ||
|