-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…#661) (#1074) * [csolution] Add list configs command to list configuration files #922 Co-authored-by: Evgueni Driouk <[email protected]>
- Loading branch information
1 parent
f7bb38a
commit cc0078c
Showing
10 changed files
with
191 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -322,7 +322,17 @@ TEST_F(RteModelPrjTest, LoadCprj) { | |
const string CompConfig_1_Base_Version = rteDir + "RteTest/" + "[email protected]"; | ||
EXPECT_TRUE(RteFsUtils::Exists(CompConfig_0_Base_Version)); | ||
EXPECT_TRUE(RteFsUtils::Exists(CompConfig_1_Base_Version)); | ||
RteFileInstance * fi = activeCprjProject->GetFileInstance("RTE/RteTest/ComponentLevelConfig_0.h"); | ||
ASSERT_NE(fi, nullptr); | ||
EXPECT_EQ(fi->GetInfoString(activeTarget->GetName()), | ||
"RTE/RteTest/[email protected] (up to date) from ARM::RteTest:[email protected]"); | ||
EXPECT_EQ(fi->GetInfoString(activeTarget->GetName(), prjsDir), | ||
"RteTestM3/RTE/RteTest/[email protected] (up to date) from ARM::RteTest:[email protected]"); | ||
|
||
ASSERT_NE(fi, nullptr); | ||
fi = activeCprjProject->GetFileInstance("RTE/RteTest/ComponentLevelConfig_1.h"); | ||
EXPECT_EQ(fi->GetInfoString(activeTarget->GetName()), | ||
"RTE/RteTest/[email protected] (up to date) from ARM::RteTest:[email protected]"); | ||
error_code ec; | ||
const fs::perms write_mask = fs::perms::owner_write | fs::perms::group_write | fs::perms::others_write; | ||
// check config file PLM: existence and permissions | ||
|
@@ -337,6 +347,10 @@ TEST_F(RteModelPrjTest, LoadCprj) { | |
EXPECT_EQ((fs::status(deviceDir + "[email protected]", ec).permissions() & write_mask), fs::perms::none); | ||
|
||
EXPECT_FALSE(RteFsUtils::Exists(deviceDir + "[email protected]")); | ||
fi = activeCprjProject->GetFileInstance("RTE/Device/RteTest_ARMCM3/system_ARMCM3.c"); | ||
ASSERT_NE(fi, nullptr); | ||
EXPECT_EQ(fi->GetInfoString(activeTarget->GetName()), | ||
"RTE/Device/RteTest_ARMCM3/[email protected] ([email protected]) from ARM::Device:Startup&RteTest [email protected]"); | ||
} | ||
|
||
TEST_F(RteModelPrjTest, LoadCprj_NoRTEFileCreation) { | ||
|
@@ -345,30 +359,40 @@ TEST_F(RteModelPrjTest, LoadCprj_NoRTEFileCreation) { | |
rteKernel.SetCmsisPackRoot(RteModelTestConfig::CMSIS_PACK_ROOT); | ||
RteCprjProject* loadedCprjProject = rteKernel.LoadCprj(RteTestM3_cprj, RteUtils::EMPTY_STRING, true, false); | ||
ASSERT_NE(loadedCprjProject, nullptr); | ||
RteTarget* activeTarget = loadedCprjProject->GetActiveTarget(); | ||
ASSERT_NE(activeTarget, nullptr); | ||
|
||
const string rteDir = RteUtils::ExtractFilePath(RteTestM3_cprj, true) + "RTE/"; | ||
const string CompConfig_0_Base_Version = rteDir + "RteTest/" + "[email protected]"; | ||
const string CompConfig_1_Base_Version = rteDir + "RteTest/" + "[email protected]"; | ||
EXPECT_FALSE(RteFsUtils::Exists(CompConfig_0_Base_Version)); | ||
EXPECT_FALSE(RteFsUtils::Exists(CompConfig_1_Base_Version)); | ||
RteFileInstance* fi = loadedCprjProject->GetFileInstance("RTE/RteTest/ComponentLevelConfig_0.h"); | ||
ASSERT_NE(fi, nullptr); | ||
EXPECT_EQ(fi->GetInfoString(activeTarget->GetName()), | ||
"RTE/RteTest/[email protected] (up to date) from ARM::RteTest:[email protected]"); | ||
|
||
const string deviceDir = rteDir + "Device/RteTest_ARMCM3/"; | ||
EXPECT_FALSE(RteFsUtils::Exists(deviceDir + "[email protected]")); | ||
EXPECT_FALSE(RteFsUtils::Exists(deviceDir + "[email protected]")); | ||
EXPECT_FALSE(RteFsUtils::Exists(deviceDir + "[email protected]")); | ||
|
||
fi = loadedCprjProject->GetFileInstance("RTE/Device/RteTest_ARMCM3/system_ARMCM3.c"); | ||
ASSERT_NE(fi, nullptr); | ||
EXPECT_EQ(fi->GetInfoString(activeTarget->GetName()), | ||
"RTE/Device/RteTest_ARMCM3/[email protected] ([email protected]) from ARM::Device:Startup&RteTest [email protected]"); | ||
RteFsUtils::RemoveFile(fi->GetAbsolutePath()); | ||
EXPECT_EQ(fi->GetInfoString(activeTarget->GetName()), | ||
"RTE/Device/RteTest_ARMCM3/[email protected] (not exist) from ARM::Device:Startup&RteTest [email protected]"); | ||
|
||
// additionally test support for RTE folder with spaces | ||
auto& fileInstances= loadedCprjProject->GetFileInstances(); | ||
// take existing file instance | ||
auto it = fileInstances.find("RTE/Device/RteTest_ARMCM3/startup_ARMCM3.c"); | ||
RteFileInstance* fi = it != fileInstances.end() ? it->second : nullptr; | ||
ASSERT_NE(fi, nullptr); | ||
// use its file to create path with another RTE directory | ||
RteFile* f = fi ? fi->GetFile(loadedCprjProject->GetActiveTargetName()) : nullptr ; | ||
ASSERT_NE(f, nullptr); | ||
const string& deviceName = loadedCprjProject->GetActiveTarget()->GetDeviceName(); | ||
string pathName = f->GetInstancePathName(deviceName, 0 , "RTE With Spaces"); | ||
EXPECT_EQ(pathName, "RTE With Spaces/Device/RteTest_ARMCM3/startup_ARMCM3.c"); | ||
EXPECT_EQ(pathName, "RTE With Spaces/Device/RteTest_ARMCM3/system_ARMCM3.c"); | ||
} | ||
|
||
TEST_F(RteModelPrjTest, LoadCprj_PackPath) { | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3264,16 +3264,17 @@ TEST_F(ProjMgrUnitTests, RunProjMgr_ContextMap) { | |
} | ||
|
||
TEST_F(ProjMgrUnitTests, RunProjMgr_UpdateRte) { | ||
char* argv[8]; | ||
const string rteDir = testinput_folder + "/TestSolution/TestProject1/RTE/"; | ||
const string configFile = rteDir + "Device/RteTest_ARMCM0/startup_ARMCM0.c"; | ||
const string baseFile = configFile + "[email protected]"; | ||
RteFsUtils::RemoveDir(rteDir); | ||
RteFsUtils::CreateFile(configFile, ""); | ||
RteFsUtils::CreateFile(baseFile, ""); | ||
RteFsUtils::CreateFile(configFile, "// config file"); | ||
RteFsUtils::CreateFile(baseFile, "// config file@base"); | ||
|
||
StdStreamRedirect streamRedirect; | ||
string csolutionFile = testinput_folder + "/TestSolution/test.csolution.yml"; | ||
char* argv[9]; | ||
argv[0] = (char*)""; | ||
argv[1] = (char*)"update-rte"; | ||
argv[2] = (char*)csolutionFile.c_str(); | ||
argv[3] = (char*)"-c"; | ||
|
@@ -3295,6 +3296,24 @@ info csolution: config files for each component:\n\ | |
|
||
auto outStr = streamRedirect.GetOutString(); | ||
EXPECT_TRUE(regex_match(outStr, regex(expected))); | ||
|
||
streamRedirect.ClearStringStreams(); | ||
argv[1] = (char*)"list"; | ||
argv[2] = (char*)"configs"; | ||
argv[3] = (char*)csolutionFile.c_str(); | ||
argv[4] = (char*)"-c"; | ||
argv[5] = (char*)"test1.Debug+CM0"; | ||
argv[6] = (char*)"-o"; | ||
argv[7] = (char*)testoutput_folder.c_str(); | ||
argv[8] = (char*)"-v"; | ||
EXPECT_EQ(0, RunProjMgr(9, argv, 0)); | ||
|
||
outStr = streamRedirect.GetOutString(); | ||
const string expected1 = | ||
"../TestProject1/RTE/Device/RteTest_ARMCM0/[email protected] (up to date) from ARM::Device:Startup&RteTest [email protected]\n"\ | ||
"../TestProject1/RTE/Device/RteTest_ARMCM0/[email protected] ([email protected]) from ARM::Device:Startup&RteTest [email protected]\n"\ | ||
"../TestProject1/RTE/Device/RteTest_ARMCM0/[email protected] (up to date) from ARM::Device:Startup&RteTest [email protected]\n"; | ||
EXPECT_EQ(outStr, expected1); | ||
} | ||
|
||
TEST_F(ProjMgrUnitTests, RunProjMgr_No_target_Types) { | ||
|