Skip to content

Commit 1728064

Browse files
grasci-armbrondani
andauthored
[projmgr] Reduce severity of missing dbgconf from error to warning (#1359) (#2289)
Co-authored-by: Daniel Brondani <[email protected]>
1 parent 8e15927 commit 1728064

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

tools/projmgr/src/ProjMgrWorker.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2268,8 +2268,14 @@ bool ProjMgrWorker::CheckConfigPLMFiles(ContextItem& context) {
22682268
// get absolute path to file instance
22692269
const string file = fs::path(context.cproject->directory).append(fi.second->GetInstanceName()).generic_string();
22702270
if (!RteFsUtils::Exists(file)) {
2271-
error = true;
2272-
ProjMgrLogger::Get().Error("file '" + file + "' not found; use --update-rte", context.name);
2271+
const auto& msg = "file '" + file + "' not found; use --update-rte";
2272+
if (fi.second->HasAttribute("configfile")) {
2273+
// missing dbgconf file is just a warning
2274+
ProjMgrLogger::Get().Warn(msg, context.name);
2275+
} else {
2276+
ProjMgrLogger::Get().Error(msg, context.name);
2277+
error = true;
2278+
}
22732279
context.plmStatus[file] = PLM_STATUS_MISSING_FILE;
22742280
continue;
22752281
}

tools/projmgr/test/src/ProjMgrUnitTests.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6805,6 +6805,28 @@ TEST_F(ProjMgrUnitTests, TestNoDbgconf) {
68056805
EXPECT_FALSE(cbuildrun["cbuild-run"]["debugger"]["dbgconf"].IsDefined());
68066806
}
68076807

6808+
TEST_F(ProjMgrUnitTests, MissingDbgconf) {
6809+
const string csolutionFile = testinput_folder + "/TestSolution/test.csolution.yml";
6810+
const string dbgconf = testinput_folder + "/TestSolution/.cmsis/test+CM0.dbgconf";
6811+
char* argv[6];
6812+
argv[1] = (char*)"convert";
6813+
argv[2] = (char*)csolutionFile.c_str();
6814+
argv[3] = (char*)"-a";
6815+
argv[4] = (char*)"CM0";
6816+
EXPECT_EQ(0, RunProjMgr(5, argv, m_envp));
6817+
6818+
// remove dbgconf file and convert again but with --no-update-rte
6819+
// the missing dbgconf is just a warning, the convert must succeed
6820+
StdStreamRedirect streamRedirect;
6821+
EXPECT_TRUE(RteFsUtils::RemoveFile(dbgconf));
6822+
EXPECT_FALSE(RteFsUtils::Exists(dbgconf));
6823+
argv[5] = (char*)"--no-update-rte";
6824+
EXPECT_EQ(0, RunProjMgr(6, argv, m_envp));
6825+
auto errStr = streamRedirect.GetErrorString();
6826+
auto expected = "warning csolution: file '" + dbgconf + "' not found; use --update-rte";
6827+
EXPECT_TRUE(errStr.find(expected) != string::npos);
6828+
}
6829+
68086830
TEST_F(ProjMgrUnitTests, TestRunDebugMulticore) {
68096831
char* argv[7];
68106832
const string& csolution = testinput_folder + "/TestRunDebug/run-debug.csolution.yml";

0 commit comments

Comments
 (0)