From fa644299baa8e108a1bda1c2b3f32acea5abdd7d Mon Sep 17 00:00:00 2001 From: Daniel Brondani Date: Wed, 3 Dec 2025 15:36:32 +0100 Subject: [PATCH] [projmgr] Reduce severity of missing `dbgconf` from error to warning (#1359) --- tools/projmgr/src/ProjMgrWorker.cpp | 10 ++++++++-- tools/projmgr/test/src/ProjMgrUnitTests.cpp | 22 +++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/tools/projmgr/src/ProjMgrWorker.cpp b/tools/projmgr/src/ProjMgrWorker.cpp index 04af697a6..2931556ce 100644 --- a/tools/projmgr/src/ProjMgrWorker.cpp +++ b/tools/projmgr/src/ProjMgrWorker.cpp @@ -2268,8 +2268,14 @@ bool ProjMgrWorker::CheckConfigPLMFiles(ContextItem& context) { // get absolute path to file instance const string file = fs::path(context.cproject->directory).append(fi.second->GetInstanceName()).generic_string(); if (!RteFsUtils::Exists(file)) { - error = true; - ProjMgrLogger::Get().Error("file '" + file + "' not found; use --update-rte", context.name); + const auto& msg = "file '" + file + "' not found; use --update-rte"; + if (fi.second->HasAttribute("configfile")) { + // missing dbgconf file is just a warning + ProjMgrLogger::Get().Warn(msg, context.name); + } else { + ProjMgrLogger::Get().Error(msg, context.name); + error = true; + } context.plmStatus[file] = PLM_STATUS_MISSING_FILE; continue; } diff --git a/tools/projmgr/test/src/ProjMgrUnitTests.cpp b/tools/projmgr/test/src/ProjMgrUnitTests.cpp index e44aac8d7..e2db7032b 100644 --- a/tools/projmgr/test/src/ProjMgrUnitTests.cpp +++ b/tools/projmgr/test/src/ProjMgrUnitTests.cpp @@ -6805,6 +6805,28 @@ TEST_F(ProjMgrUnitTests, TestNoDbgconf) { EXPECT_FALSE(cbuildrun["cbuild-run"]["debugger"]["dbgconf"].IsDefined()); } +TEST_F(ProjMgrUnitTests, MissingDbgconf) { + const string csolutionFile = testinput_folder + "/TestSolution/test.csolution.yml"; + const string dbgconf = testinput_folder + "/TestSolution/.cmsis/test+CM0.dbgconf"; + char* argv[6]; + argv[1] = (char*)"convert"; + argv[2] = (char*)csolutionFile.c_str(); + argv[3] = (char*)"-a"; + argv[4] = (char*)"CM0"; + EXPECT_EQ(0, RunProjMgr(5, argv, m_envp)); + + // remove dbgconf file and convert again but with --no-update-rte + // the missing dbgconf is just a warning, the convert must succeed + StdStreamRedirect streamRedirect; + EXPECT_TRUE(RteFsUtils::RemoveFile(dbgconf)); + EXPECT_FALSE(RteFsUtils::Exists(dbgconf)); + argv[5] = (char*)"--no-update-rte"; + EXPECT_EQ(0, RunProjMgr(6, argv, m_envp)); + auto errStr = streamRedirect.GetErrorString(); + auto expected = "warning csolution: file '" + dbgconf + "' not found; use --update-rte"; + EXPECT_TRUE(errStr.find(expected) != string::npos); +} + TEST_F(ProjMgrUnitTests, TestRunDebugMulticore) { char* argv[7]; const string& csolution = testinput_folder + "/TestRunDebug/run-debug.csolution.yml";