-
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 - update-rte If cbuild-pack.yml needs to be created or updated, then --frozen-pack will treat this as an error and fail the command. Contributed by STMicroelectronics Signed-off-by: Torbjörn SVENSSON <[email protected]>
- Loading branch information
1 parent
590e3e1
commit 0f761bc
Showing
13 changed files
with
152 additions
and
23 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: CM3 | ||
device: RteTest_ARMCM3 | ||
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 |
5 changes: 5 additions & 0 deletions
5
tools/projmgr/test/data/TestSolution/PackLocking/ref/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::[email protected] |
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,91 @@ TEST_F(ProjMgrUnitTests, RunProjMgrSolution_LockPackNoPackList) { | |
ProjMgrTestEnv::CompareFile(expectedCbuildPack, cbuildPack); | ||
} | ||
|
||
TEST_F(ProjMgrUnitTests, RunProjMgrSolution_LockPackFrozen) { | ||
char* argv[7]; | ||
StdStreamRedirect streamRedirect; | ||
|
||
// 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 expectedCbuildPackRef = testinput_folder + "/TestSolution/PackLocking/ref/cbuild_pack_frozen.cbuild-pack.yml"; | ||
const string rtePath = testinput_folder + "/TestSolution/PackLocking/RTE/"; | ||
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"; | ||
|
||
// Ensure clean state when starting test | ||
ASSERT_TRUE(RteFsUtils::RemoveDir(rtePath)); | ||
|
||
// 1st run to verify that the cbuild-pack.yml content is stable | ||
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); | ||
EXPECT_FALSE(RteFsUtils::Exists(rtePath)); | ||
|
||
// 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); | ||
EXPECT_FALSE(RteFsUtils::Exists(rtePath)); | ||
|
||
// 3rd run without --frozen-packs to verify that the list can be updated | ||
streamRedirect.ClearStringStreams(); | ||
EXPECT_EQ(0, RunProjMgr(6, argv, 0)); | ||
EXPECT_NE(streamRedirect.GetOutString().find(cbuildPack + " - info csolution: file generated successfully"), string::npos); | ||
ProjMgrTestEnv::CompareFile(expectedCbuildPackRef, cbuildPack); | ||
EXPECT_TRUE(RteFsUtils::Exists(rtePath)); | ||
|
||
EXPECT_TRUE(RteFsUtils::Exists(testinput_folder + "/TestSolution/PackLocking/RTE/_CM3/RTE_Components.h")); | ||
EXPECT_TRUE(RteFsUtils::Exists(testinput_folder + "/TestSolution/PackLocking/RTE/Device/RteTest_ARMCM3/gcc_arm.ld")); | ||
EXPECT_FALSE(RteFsUtils::Exists(testinput_folder + "/TestSolution/PackLocking/RTE/Device/RteTest_ARMCM3/[email protected]")); // From Arm::[email protected] | ||
EXPECT_TRUE(RteFsUtils::Exists(testinput_folder + "/TestSolution/PackLocking/RTE/Device/RteTest_ARMCM3/[email protected]")); | ||
EXPECT_TRUE(RteFsUtils::Exists(testinput_folder + "/TestSolution/PackLocking/RTE/Device/RteTest_ARMCM3/startup_ARMCM3.c")); | ||
EXPECT_TRUE(RteFsUtils::Exists(testinput_folder + "/TestSolution/PackLocking/RTE/Device/RteTest_ARMCM3/[email protected]")); | ||
EXPECT_TRUE(RteFsUtils::Exists(testinput_folder + "/TestSolution/PackLocking/RTE/Device/RteTest_ARMCM3/system_ARMCM3.c")); | ||
EXPECT_FALSE(RteFsUtils::Exists(testinput_folder + "/TestSolution/PackLocking/RTE/Device/RteTest_ARMCM3/[email protected]")); // From Arm::[email protected] | ||
EXPECT_TRUE(RteFsUtils::Exists(testinput_folder + "/TestSolution/PackLocking/RTE/Device/RteTest_ARMCM3/[email protected]")); | ||
|
||
// 4th run with --frozen-packs to verify that RTE directory can be generated | ||
ASSERT_TRUE(RteFsUtils::RemoveDir(rtePath)); | ||
streamRedirect.ClearStringStreams(); | ||
EXPECT_EQ(0, RunProjMgr(7, argv, 0)); | ||
EXPECT_NE(streamRedirect.GetOutString().find(cbuildPack + " - info csolution: file is already up-to-date"), string::npos); | ||
ProjMgrTestEnv::CompareFile(expectedCbuildPackRef, cbuildPack); | ||
|
||
EXPECT_TRUE(RteFsUtils::Exists(testinput_folder + "/TestSolution/PackLocking/RTE/_CM3/RTE_Components.h")); | ||
EXPECT_TRUE(RteFsUtils::Exists(testinput_folder + "/TestSolution/PackLocking/RTE/Device/RteTest_ARMCM3/gcc_arm.ld")); | ||
EXPECT_TRUE(RteFsUtils::Exists(testinput_folder + "/TestSolution/PackLocking/RTE/Device/RteTest_ARMCM3/[email protected]")); | ||
EXPECT_TRUE(RteFsUtils::Exists(testinput_folder + "/TestSolution/PackLocking/RTE/Device/RteTest_ARMCM3/startup_ARMCM3.c")); | ||
EXPECT_TRUE(RteFsUtils::Exists(testinput_folder + "/TestSolution/PackLocking/RTE/Device/RteTest_ARMCM3/[email protected]")); | ||
EXPECT_TRUE(RteFsUtils::Exists(testinput_folder + "/TestSolution/PackLocking/RTE/Device/RteTest_ARMCM3/system_ARMCM3.c")); | ||
EXPECT_TRUE(RteFsUtils::Exists(testinput_folder + "/TestSolution/PackLocking/RTE/Device/RteTest_ARMCM3/[email protected]")); | ||
|
||
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 +2158,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 +2182,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 +2207,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 +2224,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 +3624,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"; | ||
|