Skip to content

Commit

Permalink
Create update@version only if base@version exists
Browse files Browse the repository at this point in the history
  • Loading branch information
grasci-arm authored Dec 9, 2022
1 parent acd0e16 commit e1c5e0f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion libs/rtemodel/src/RteProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ void RteProject::UpdateConfigFileBackups(RteFileInstance* fi, RteFile* f)
}
// copy current file if version differs
string updateFile = RteUtils::AppendFileUpdateVersion(absPath, updateVersion);
if (baseVersion != updateVersion) {
if (!baseFile.empty() && baseVersion != updateVersion) { // only copy update if base exists
RteFsUtils::CopyCheckFile(src, updateFile, false);
RteFsUtils::SetFileReadOnly(updateFile, true);
} else {
Expand Down
10 changes: 4 additions & 6 deletions libs/rtemodel/test/src/RteModelTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,9 @@ TEST_F(RteModelPrjTest, LoadCprj) {
EXPECT_EQ(boardName, "RteTest Test board");
// get layers
auto& allLayerDescriptors = rteKernel.GetGlobalModel()->GetLayerDescriptors();
EXPECT_EQ(allLayerDescriptors.size(), 2);
EXPECT_EQ(allLayerDescriptors.size(), 6);
auto& filteredLayerDescriptors = activeTarget->GetFilteredModel()->GetLayerDescriptors();
EXPECT_EQ(filteredLayerDescriptors.size(), 1);

EXPECT_EQ(filteredLayerDescriptors.size(), 4);

const string rteDir = RteUtils::ExtractFilePath(RteTestM3_cprj, true) + "RTE/";
const string CompConfig_0_Base_Version = rteDir + "RteTest/" + "ComponentLevelConfig_0.h.base@0.0.1";
Expand All @@ -227,16 +226,15 @@ TEST_F(RteModelPrjTest, LoadCprj) {
// check config file PLM: existence and permissions
const string deviceDir = rteDir + "Device/RteTest_ARMCM3/";
EXPECT_FALSE(RteFsUtils::Exists(deviceDir + "ARMCM3_ac6.sct.base@1.0.0"));
EXPECT_TRUE(RteFsUtils::Exists(deviceDir + "ARMCM3_ac6.sct.update@1.2.0"));
EXPECT_FALSE(RteFsUtils::Exists(deviceDir + "ARMCM3_ac6.sct.update@1.2.0"));

EXPECT_FALSE(RteFsUtils::Exists(deviceDir + "system_ARMCM3.c.base@1.0.1"));
EXPECT_FALSE(RteFsUtils::Exists(deviceDir + "system_ARMCM3.c.base@1.0.2"));

EXPECT_TRUE(RteFsUtils::Exists(deviceDir + "startup_ARMCM3.c.base@2.0.3"));
EXPECT_EQ((fs::status(deviceDir + "startup_ARMCM3.c.base@2.0.3", ec).permissions() & write_mask), fs::perms::none);

EXPECT_TRUE(RteFsUtils::Exists(deviceDir + "system_ARMCM3.c.update@1.2.2"));
EXPECT_EQ((fs::status(deviceDir + "system_ARMCM3.c.update@1.2.2", ec).permissions() & write_mask), fs::perms::none);
EXPECT_FALSE(RteFsUtils::Exists(deviceDir + "system_ARMCM3.c.update@1.2.2"));
}

TEST_F(RteModelPrjTest, LoadCprj_NoRTEFileCreation) {
Expand Down

0 comments on commit e1c5e0f

Please sign in to comment.