Skip to content

Commit 085d48e

Browse files
[projmgr] Add return code for compiler not defined (#1092) (#1888)
Co-authored-by: Daniel Brondani <[email protected]>
1 parent 973de90 commit 085d48e

File tree

5 files changed

+17
-2
lines changed

5 files changed

+17
-2
lines changed

tools/projmgr/include/ProjMgr.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ enum ErrorCode
2121
{
2222
SUCCESS = 0,
2323
ERROR = 1,
24-
VARIABLE_NOT_DEFINED
24+
VARIABLE_NOT_DEFINED = 2,
25+
COMPILER_NOT_DEFINED = 3,
2526
};
2627

2728
/**

tools/projmgr/include/ProjMgrWorker.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,12 @@ class ProjMgrWorker {
697697
*/
698698
bool HasVarDefineError();
699699

700+
/**
701+
* @brief check whether compiler is not defined and there are selectable ones
702+
* @return true if error is set
703+
*/
704+
bool HasCompilerDefineError();
705+
700706
/**
701707
* @brief get list of detected undefined layer variables
702708
* @return list of undefined layer variables

tools/projmgr/src/ProjMgr.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,10 @@ int ProjMgr::ProcessCommands() {
387387
if (m_worker.HasVarDefineError()) {
388388
return ErrorCode::VARIABLE_NOT_DEFINED;
389389
}
390+
// Check if compiler not defined and there are selectable ones
391+
if (m_worker.HasCompilerDefineError()) {
392+
return ErrorCode::COMPILER_NOT_DEFINED;
393+
}
390394
if (!convSuccess) {
391395
return ErrorCode::ERROR;
392396
}

tools/projmgr/src/ProjMgrWorker.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5030,6 +5030,10 @@ bool ProjMgrWorker::HasVarDefineError() {
50305030
return (m_undefLayerVars.size() > 0 ? true : false);
50315031
}
50325032

5033+
bool ProjMgrWorker::HasCompilerDefineError() {
5034+
return (m_undefCompiler && !m_selectableCompilers.empty());
5035+
}
5036+
50335037
const set<string>& ProjMgrWorker::GetUndefLayerVars() {
50345038
return m_undefLayerVars;
50355039
}

tools/projmgr/test/src/ProjMgrUnitTests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6188,7 +6188,7 @@ TEST_F(ProjMgrUnitTests, SelectableToolchains) {
61886188
argv[3] = (char*)"-o";
61896189
argv[4] = (char*)testoutput_folder.c_str();
61906190
argv[5] = (char*)"--cbuildgen";
6191-
EXPECT_EQ(1, RunProjMgr(6, argv, m_envp));
6191+
EXPECT_EQ(ErrorCode::COMPILER_NOT_DEFINED, RunProjMgr(6, argv, m_envp));
61926192
const string err = streamRedirect.GetErrorString();
61936193
const string expectedErr = \
61946194
"error csolution: compiler undefined, use '--toolchain' option or add 'compiler: <value>' to yml input, selectable values can be found in cbuild-idx.yml";

0 commit comments

Comments
 (0)