Skip to content

Commit e759ce0

Browse files
[packchk] Validate <mountedDevice> specifying an existing device #1079 (#1148) (#1971)
Co-authored-by: Thorsten de Buhr <[email protected]>
1 parent 25695db commit e759ce0

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

tools/packchk/test/data/CheckBoardMountedCompatibleDevices/BulbBoard_BSP/Keil.BulbBoard_BSP.pdsc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<book category="other" name="Resources/driverinstaller.exe" title="Driver for CMSIS-DAP and programming"/>
3737
<book category="other" name="Resources/PCWFM3-V01L14.zip" title="Serial Flash programming Tool"/>
3838
<book category="other" name="Resources/serialportviewerandterminalv56.exe" title="Serial Port Viewer and Terminal installer"/>
39-
<mountedDevice deviceIndex="0" Dvendor="Cypress:19" Dname="S6E1A12B0A"/>
39+
<mountedDevice deviceIndex="0" Dvendor="Cypress:19" Dname="S6E1A12B0A_notExist"/>
4040
<mountedDevice deviceIndex="2" Dname="S6E1A12B0A"/>
4141
<mountedDevice deviceIndex="3" Dvendor="Cypress:19"/>
4242
<mountedDevice deviceIndex="0" Dvendor="Cypress:19" Dname="S6E1A12B0B"/>

tools/packchk/test/integtests/src/PackChkIntegTests.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -945,12 +945,13 @@ TEST_F(PackChkIntegTests, CheckBoardMountedCompatibleDevices) {
945945
argv[4] = (char*)"--disable-validation";
946946

947947
PackChk packChk;
948-
EXPECT_EQ(1, packChk.Check(2, argv, nullptr));
948+
EXPECT_EQ(1, packChk.Check(5, argv, nullptr));
949949

950950
auto errMsgs = ErrLog::Get()->GetLogMessages();
951951
int M308_foundCnt = 0;
952952
int M318_foundCnt = 0;
953953
int M319_foundCnt = 0;
954+
int M346_foundCnt = 0;
954955
for (const string& msg : errMsgs) {
955956
size_t s;
956957
if ((s = msg.find("M308")) != string::npos) {
@@ -962,10 +963,13 @@ TEST_F(PackChkIntegTests, CheckBoardMountedCompatibleDevices) {
962963
if ((s = msg.find("M319")) != string::npos) {
963964
M319_foundCnt++;
964965
}
966+
if ((s = msg.find("M346")) != string::npos) {
967+
M346_foundCnt++;
968+
}
965969
}
966970

967-
if (M308_foundCnt != 2 || M318_foundCnt != 2 || M319_foundCnt != 2) {
968-
FAIL() << "error: missing message M348 or M369";
971+
if (M308_foundCnt != 2 || M318_foundCnt != 2 || M319_foundCnt != 2 || M346_foundCnt != 3) {
972+
FAIL() << "error: missing message M308, M318, M319, M346";
969973
}
970974
}
971975

0 commit comments

Comments
 (0)