Skip to content

Commit

Permalink
PackChk: Device Feature "SON"
Browse files Browse the repository at this point in the history
Co-authored-by: Thorsten de Buhr <[email protected]>
  • Loading branch information
grasci-arm and thorstendb-ARM authored Jul 25, 2022
1 parent d0e6270 commit 3b0c9cd
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 0 deletions.
1 change: 1 addition & 0 deletions tools/packchk/src/ValidateSyntax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ void ValidateSyntax::InitFeatures()
m_featureTableDevice["QFN"] = FeatureEntry("QFN", "<feature type=\"QFN\" n=\"33\" name=\"QFN Package\"/>", "33-pad QFN Package");
m_featureTableDevice["QFP"] = FeatureEntry("QFP", "<feature type=\"QFP\" n=\"128\" name=\"Low-Profile QFP Package\"/>", "128-lead Low-Profile QFP Package");
m_featureTableDevice["SOP"] = FeatureEntry("SOP", "<feature type=\"SOP\" n=\"16\" name=\"SSOP Package\"/>", "16-lead SSOP Package");
m_featureTableDevice["SON"] = FeatureEntry("SON", "<feature type=\"SON\" n=\"16\" name=\"SSON Package\"/>", "16-no-lead SSON Package");
m_featureTableDevice["DIP"] = FeatureEntry("DIP", "<feature type=\"DIP\" n=\"16\" name=\"Dual In-Line Package\"/>", "16-lead Dual In-Line Package");
m_featureTableDevice["PackageOther"] = FeatureEntry("Other Package Type", "<feature type=\"PackageOther\" n=\"44\" name=\"My other Package\"/>", "44-contacts My other Package");
m_featureTableDevice["IOs"] = FeatureEntry("Inputs/Outputs", "<feature type=\"IOs\" n=\"112\" name=\"General Purpose I/Os, 5V tolerant\"/>", "112 General Purpose I/Os, 5V tolerant");
Expand Down
50 changes: 50 additions & 0 deletions tools/packchk/test/data/TestSON/TestVendor.TestSON.pdsc
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>

<package schemaVersion="1.4" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="PACK.xsd">
<vendor>TestVendor</vendor>
<url>http://www.testurl.com/pack/</url>
<name>TestPackLicense</name>
<description>TestPackLicense</description>
<license>licenses\license.dat</license>

<releases>
<release version="0.0.1" date="2022-06-20">>
Initial release of TestPackLicense.
</release>
</releases>

<keywords>
<keyword>TestPackLicense</keyword>
</keywords>

<conditions>
<condition id="Test_Condition">
<description>Test Device</description>
<require Dvendor="ARM:82"/>
</condition>
</conditions>

<components>
<component Cclass="TestClass" Cgroup="TestGlobal" Cversion="1.0.0" condition="Test_Condition">
<description>TestGlobal</description>
</component>
</components>

<devices>
<family Dfamily="STM32F1 Series" Dvendor="STMicroelectronics:13">
<processor Dcore="Cortex-M3" DcoreVersion="r1p1"/>

<!-- ************************ Subfamily 'STM32F100' **************************** -->
<subFamily DsubFamily="STM32F100">

<!-- ************************* Device 'STM32F100C4' ***************************** -->
<device Dname="STM32F100C4">
<processor Dfpu="0" Dmpu="0" Dendian="Little-endian" Dclock="24000000"/>
<feature type="SON" n="16"/>
<feature type="SOX" n="16"/>
</device>
</subFamily>
</family>
</devices>

</package>
29 changes: 29 additions & 0 deletions tools/packchk/test/integtests/src/PackChkIntegTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,5 +361,34 @@ TEST_F(PackChkIntegTests, CheckPackLicense) {
if (!bFound) {
FAIL() << "error: missing warning M327";
}
}

// Validate license path
TEST_F(PackChkIntegTests, CheckFeatureSON) {
const char* argv[2];

const string& pdscFile = PackChkIntegTestEnv::localtestdata_dir +
"/TestSON/TestVendor.TestSON.pdsc";
ASSERT_TRUE(RteFsUtils::Exists(pdscFile));

argv[0] = (char*)"";
argv[1] = (char*)pdscFile.c_str();

PackChk packChk;
EXPECT_EQ(1, packChk.Check(2, argv, nullptr));

auto errMsgs = ErrLog::Get()->GetLogMessages();
bool bFound = false;
for (const string& msg : errMsgs) {
size_t s;
if ((s = msg.find("M371")) != string::npos) {
bFound = true;
break;
}
}

if (!bFound) {
FAIL() << "error: missing error M371";
}
}

0 comments on commit 3b0c9cd

Please sign in to comment.