Skip to content

Commit

Permalink
[projmgr] Check pack identifier case consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
spcaipers-arm authored Nov 29, 2024
1 parent 7b3c54e commit d0c0775
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libs/rtefsutils/src/RteFsUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,9 @@ 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)) {
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)) {
return;
}
for (auto entry : fs::directory_iterator(folder, ec)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 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::RteTest_DFP
- pack: Arm::RteTest_DFP

projects:
- project: pack_path.cproject.yml
11 changes: 11 additions & 0 deletions tools/projmgr/test/src/ProjMgrUnitTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6549,3 +6549,14 @@ TEST_F(ProjMgrUnitTests, GetToolboxVersion) {

RteFsUtils::RemoveDir(testdir);
}

TEST_F(ProjMgrUnitTests, PackCaseSensitive) {
char* argv[3];
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>());
}

0 comments on commit d0c0775

Please sign in to comment.