Skip to content

Commit 4cd417e

Browse files
authored
[csolution-rpc] Fix examples filtering for device not being mounted on any board
1 parent ca7c1d2 commit 4cd417e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

tools/projmgr/src/ProjMgrWorker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4233,7 +4233,7 @@ vector<RteBoard*> ProjMgrWorker::GetCompatibleBoards(const ContextItem& context)
42334233
}
42344234

42354235
bool ProjMgrWorker::IsBoardListCompatible(const ContextItem& context, const vector<RteBoard*> compatibleBoards, const Collection<RteItem*>& boards) {
4236-
if (compatibleBoards.empty()) {
4236+
if (!context.rteBoard && !context.rteDevice) {
42374237
// no board/device is selected
42384238
return true;
42394239
}

tools/projmgr/test/src/ProjMgrRpcTests.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,14 @@ TEST_F(ProjMgrRpcTests, RpcGetDraftProjects) {
668668
EXPECT_EQ(templates[1]["name"], "Board2");
669669
EXPECT_EQ(templates[2]["name"], "Board3");
670670

671+
// filter 'device' that's not mounted on any board
672+
requests =
673+
FormatRequest(1, "LoadPacks") +
674+
FormatRequest(2, "GetDraftProjects", json{ { "filter", {{ "device", "RteTestGen_ARMCM0" }}} });
675+
responses = RunRpcMethods(requests);
676+
EXPECT_TRUE(responses[1]["result"]["success"]);
677+
EXPECT_FALSE(responses[1]["result"].contains("examples"));
678+
671679
// filter 'environment'
672680
requests =
673681
FormatRequest(1, "LoadPacks") +

0 commit comments

Comments
 (0)