Skip to content

Commit

Permalink
[projmgr] Decrease pack letter case inconsistency severity
Browse files Browse the repository at this point in the history
  • Loading branch information
spcaipers-arm authored Jan 24, 2025
1 parent fb51ddc commit a523e67
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
4 changes: 1 addition & 3 deletions libs/rtefsutils/src/RteFsUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -641,9 +641,7 @@ string RteFsUtils::FindFirstFileWithExt(const std::string &folder, const char *e
void RteFsUtils::GetFilesSorted(const string &folder, set<string, VersionCmp::Greater> &files) {
error_code ec;
// Path does not exist, nothing to do
if ((folder.empty() || !fs::exists(folder, ec) || !fs::is_directory(folder, ec)) ||
// Check case consistency
(fs::canonical(folder, ec).generic_string().find(fs::path(folder).lexically_normal().generic_string()) == string::npos)) {
if (folder.empty() || !fs::exists(folder, ec) || !fs::is_directory(folder, ec)) {
return;
}
for (auto entry : fs::directory_iterator(folder, ec)) {
Expand Down
9 changes: 6 additions & 3 deletions libs/rtemodel/src/RteModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,12 @@ bool RteModel::Validate()
for (auto duplicate : m_packageDuplicates) {
RtePackage* orig = GetPackage(duplicate->GetID());

string msg = duplicate->GetPackageFileName();
msg += ": warning #500: pack '" + duplicate->GetID() + "' is already defined in file " + orig->GetPackageFileName();
msg += " - duplicate is ignored";
string msg = "warning #500: pack '" + duplicate->GetID() + "' is duplicated";
if (RteUtils::EqualNoCase(duplicate->GetPackageFileName(), orig->GetPackageFileName())) {
msg += ", letter case is inconsistent";
}
msg += ":\n " + orig->GetPackageFileName() +
"\n " + duplicate->GetPackageFileName() + " - ignored";
m_errors.push_back(msg);
}

Expand Down
17 changes: 13 additions & 4 deletions tools/projmgr/test/src/ProjMgrUnitTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6558,10 +6558,19 @@ TEST_F(ProjMgrUnitTests, PackCaseSensitive) {
const string& csolution = testinput_folder + "/TestSolution/pack_case_sensitive.csolution.yml";
argv[1] = (char*)"convert";
argv[2] = (char*)csolution.c_str();
EXPECT_EQ(1, RunProjMgr(3, argv, 0));
const YAML::Node& cbuild = YAML::LoadFile(testinput_folder + "/TestSolution/pack_case_sensitive.cbuild-idx.yml");
EXPECT_EQ("required pack: Arm::RteTest_DFP not installed",
cbuild["build-idx"]["cbuilds"][0]["messages"]["errors"][0].as<string>());
if (CrossPlatformUtils::GetHostType() == "linux") {
EXPECT_EQ(1, RunProjMgr(3, argv, 0));
} else {
EXPECT_EQ(0, RunProjMgr(3, argv, 0));
const YAML::Node& cbuild = YAML::LoadFile(testinput_folder + "/TestSolution/pack_case_sensitive.cbuild-idx.yml");
const string& expected = "\
RTE Model reports:\n\
warning #500: pack 'ARM::[email protected]' is duplicated, letter case is inconsistent:\n\
.*/ARM/RteTest_DFP/0.2.0/ARM.RteTest_DFP.pdsc\n\
.*/Arm/RteTest_DFP/0.2.0/Arm.RteTest_DFP.pdsc - ignored\
";
EXPECT_TRUE(regex_search(cbuild["build-idx"]["cbuilds"][0]["messages"]["warnings"][0].as<string>(), regex(expected)));
}
}

TEST_F(ProjMgrUnitTests, InvalidContextSet) {
Expand Down

0 comments on commit a523e67

Please sign in to comment.