Skip to content

Commit f768dc0

Browse files
authored
[projmgr] Fix list configs mandatory argument
1 parent 28264fc commit f768dc0

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

tools/projmgr/src/ProjMgr.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ int ProjMgr::ParseCommandLine(int argc, char** argv) {
169169
{"list packs", { true, {context, contextSet, debug, filter, load, missing, quiet, schemaCheck, toolchain, verbose, relativePaths}}},
170170
{"list boards", { true, {context, contextSet, debug, filter, load, quiet, schemaCheck, toolchain, verbose}}},
171171
{"list devices", { true, {context, contextSet, debug, filter, load, quiet, schemaCheck, toolchain, verbose}}},
172-
{"list configs", { true, {context, contextSet, debug, filter, load, quiet, schemaCheck, toolchain, verbose}}},
172+
{"list configs", { false, {context, contextSet, debug, filter, load, quiet, schemaCheck, toolchain, verbose}}},
173173
{"list components", { true, {context, contextSet, debug, filter, load, quiet, schemaCheck, toolchain, verbose}}},
174174
{"list dependencies", { false, {context, contextSet, debug, filter, load, quiet, schemaCheck, toolchain, verbose}}},
175175
{"list contexts", { false, {debug, filter, quiet, schemaCheck, verbose, ymlOrder}}},
@@ -788,11 +788,9 @@ bool ProjMgr::RunListComponents(void) {
788788
}
789789

790790
bool ProjMgr::RunListConfigs() {
791-
if (!m_csolutionFile.empty()) {
792-
// Parse all input files and create contexts
793-
if (!PopulateContexts()) {
794-
return false;
795-
}
791+
// Parse all input files and create contexts
792+
if (!PopulateContexts()) {
793+
return false;
796794
}
797795

798796
// Parse context selection

tools/projmgr/test/src/ProjMgrUnitTests.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4724,6 +4724,16 @@ info csolution: config files for each component:\n\
47244724
EXPECT_EQ(outStr, expected1);
47254725
}
47264726

4727+
TEST_F(ProjMgrUnitTests, RunProjMgr_ListConfigsWithoutInput) {
4728+
StdStreamRedirect streamRedirect;
4729+
char* argv[3];
4730+
argv[1] = (char*)"list";
4731+
argv[2] = (char*)"configs";
4732+
EXPECT_EQ(1, RunProjMgr(3, argv, m_envp));
4733+
auto errStr = streamRedirect.GetErrorString();
4734+
EXPECT_NE(string::npos, errStr.find("input yml files were not specified"));
4735+
}
4736+
47274737
TEST_F(ProjMgrUnitTests, RunProjMgr_No_target_Types) {
47284738
StdStreamRedirect streamRedirect;
47294739
char* argv[8];

0 commit comments

Comments
 (0)