Skip to content

Commit 2a090cf

Browse files
authored
Merge branch 'main' into outbound/urlIsHttps_1109
2 parents 42bc194 + 331b229 commit 2a090cf

File tree

9 files changed

+114
-22
lines changed

9 files changed

+114
-22
lines changed

libs/errlog/include/ErrLog.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,16 @@ class ErrLog {
197197
return theErrLog;
198198
}
199199

200+
/**
201+
* @brief singleton operation: destroys global application object
202+
*/
203+
static void Destroy() {
204+
if (theErrLog) {
205+
delete theErrLog;
206+
theErrLog = nullptr;
207+
}
208+
}
209+
200210
public:
201211
/**
202212
* @brief empty messages buffer
@@ -517,7 +527,6 @@ class ErrLog {
517527
~ErrLogDestroyer() { ErrLog::Destroy(); }
518528
};
519529

520-
static void Destroy() { delete theErrLog; theErrLog = nullptr; }
521530
static ErrLogDestroyer theErrLogDestroyer;
522531
static ErrLog* theErrLog; // the application-wide ErrLog Object
523532

tools/packchk/src/CheckFiles.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ bool CheckFiles::CheckFileExtension(RteItem* item)
824824
}
825825
}
826826
else if(category == "sourceCpp") {
827-
if(_stricmp(extension.c_str(), "cpp")) {
827+
if(_stricmp(extension.c_str(), "cpp") && _stricmp(extension.c_str(), "cc") && _stricmp(extension.c_str(), "cxx")) {
828828
LogMsg("M337", VAL("CAT", category), PATH(name), EXT(extension), lineNo);
829829
ok = false;
830830
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// tests1.c
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
//header 1
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// tests1.c
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// tests1.c
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// tests1.c
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<package schemaVersion="1.4" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="PACK.xsd">
4+
<vendor>TestVendor</vendor>
5+
<url>http://www.testurl.com/pack/</url>
6+
<name>SupportCcFiles_DFP</name>
7+
<description>Filename is directory</description>
8+
9+
<releases>
10+
<release version="0.0.1" date="2025-02-03">>
11+
Initial release of SupportCcFiles.
12+
</release>
13+
</releases>
14+
15+
<keywords>
16+
<keyword>SupportCcFiles</keyword>
17+
</keywords>
18+
19+
<conditions>
20+
<condition id="Test_Condition">
21+
<description>Test Device</description>
22+
<require Dvendor="ARM:82"/>
23+
</condition>
24+
</conditions>
25+
26+
<components>
27+
<component Cclass="TestClass" Cgroup="TestFiles" Cversion="1.0.0" condition="Test_Condition">
28+
<description>Test files</description>
29+
<files>
30+
<file category="TestGlobal" name="Files/header1.h"/>
31+
<file category="source" name="Files/test1.c"/>
32+
<file category="sourceC" name="Files/test1.c"/>
33+
<file category="sourceCpp" name="Files/test1.cpp"/>
34+
<file category="sourceCpp" name="Files/test1.cc"/>
35+
<file category="sourceCpp" name="Files/fileWillFail.ccc"/>
36+
</files>
37+
</component>
38+
</components>
39+
</package>

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

Lines changed: 59 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ void PackChkIntegTests::SetUp() {
2727
}
2828

2929
void PackChkIntegTests::TearDown() {
30-
ErrLog::Get()->ClearLogMessages();
30+
ErrLog::Get()->Destroy();
3131
}
3232

3333
string PackChkIntegTests::GetPackXsd() {
@@ -80,6 +80,17 @@ TEST_F(PackChkIntegTests, FileNotAVailable) {
8080
EXPECT_EQ(1, packChk.Check(2, argv, nullptr));
8181
}
8282

83+
TEST_F(PackChkIntegTests, FileNotAVailable2) {
84+
const char* argv[2];
85+
86+
argv[0] = (char*)"";
87+
argv[1] = (char*)"UNKNOWN.FILE.pdsc";
88+
89+
PackChk packChk;
90+
EXPECT_EQ(1, packChk.Check(2, argv, nullptr));
91+
}
92+
93+
8394
TEST_F(PackChkIntegTests, VersionOption) {
8495
const char* argv[2];
8596

@@ -825,7 +836,7 @@ TEST_F(PackChkIntegTests, CheckConfigFileInIncludePath) {
825836
argv[2] = (char *)"--disable-validation";
826837

827838
PackChk packChk;
828-
EXPECT_EQ(0, packChk.Check(3, argv, nullptr));
839+
EXPECT_EQ(1, packChk.Check(3, argv, nullptr));
829840

830841
auto errMsgs = ErrLog::Get()->GetLogMessages();
831842
int M357_foundCnt = 0;
@@ -892,7 +903,7 @@ TEST_F(PackChkIntegTests, CheckBoardMountedCompatibleDevices) {
892903
argv[0] = (char*)"";
893904
argv[1] = (char*)pdscFile.c_str();
894905
argv[2] = (char*)"-i";
895-
argv[3] = (char*)pdscFile.c_str();
906+
argv[3] = (char*)pdscFileAdd.c_str();
896907
argv[4] = (char*)"--disable-validation";
897908

898909
PackChk packChk;
@@ -920,36 +931,30 @@ TEST_F(PackChkIntegTests, CheckBoardMountedCompatibleDevices) {
920931
}
921932
}
922933

923-
TEST_F(PackChkIntegTests, CheckConditionComponentDependency_Neg) {
924-
const char* argv[5];
934+
TEST_F(PackChkIntegTests, CheckSupportCcFiles) {
935+
const char* argv[3];
925936

926-
const string& pdscFile = PackChkIntegTestEnv::globaltestdata_dir +
927-
"/packs/ARM/RteTest_DFP/0.2.0/ARM.RteTest_DFP.pdsc";
928-
const string& refFile = PackChkIntegTestEnv::globaltestdata_dir +
929-
"/packs/ARM/RteTest/0.1.0/ARM.RteTest.pdsc";
937+
string pdscFile = PackChkIntegTestEnv::localtestdata_dir +
938+
"/SupportCcFiles/TestVendor.SupportCcFiles_DFP.pdsc";
930939
ASSERT_TRUE(RteFsUtils::Exists(pdscFile));
931-
ASSERT_TRUE(RteFsUtils::Exists(refFile));
932940

933941
argv[0] = (char*)"";
934942
argv[1] = (char*)pdscFile.c_str();
935-
argv[2] = (char*)"-x";
936-
argv[3] = (char*)"!M317";
937-
argv[4] = (char*)"--disable-validation";
943+
argv[2] = (char*)"--disable-validation";
938944

939945
PackChk packChk;
940-
EXPECT_EQ(0, packChk.Check(5, argv, nullptr));
946+
EXPECT_EQ(0, packChk.Check(3, argv, nullptr));
941947

942948
auto errMsgs = ErrLog::Get()->GetLogMessages();
943-
int M317_foundCnt = 0;
949+
int M337_foundCnt = 0;
944950
for (const string& msg : errMsgs) {
945-
size_t s;
946-
if ((s = msg.find("M317", 0)) != string::npos) {
947-
M317_foundCnt++;
951+
if (msg.find("M337", 0) != string::npos) {
952+
M337_foundCnt++;
948953
}
949954
}
950955

951-
if(M317_foundCnt != 4) {
952-
FAIL() << "error: warning M317 count != 4";
956+
if(!M337_foundCnt) {
957+
FAIL() << "error: Missing message M337: File with category 'sourceCpp' has wrong extension 'ccc': 'Files/fileWillFail.ccc'";
953958
}
954959
}
955960

@@ -987,3 +992,37 @@ TEST_F(PackChkIntegTests, CheckConditionComponentDependency_Pos) {
987992
FAIL() << "error: warning M317 found";
988993
}
989994
}
995+
996+
TEST_F(PackChkIntegTests, CheckConditionComponentDependency_Neg) {
997+
const char* argv[5];
998+
999+
const string& pdscFile = PackChkIntegTestEnv::globaltestdata_dir +
1000+
"/packs/ARM/RteTest_DFP/0.2.0/ARM.RteTest_DFP.pdsc";
1001+
const string& refFile = PackChkIntegTestEnv::globaltestdata_dir +
1002+
"/packs/ARM/RteTest/0.1.0/ARM.RteTest.pdsc";
1003+
ASSERT_TRUE(RteFsUtils::Exists(pdscFile));
1004+
ASSERT_TRUE(RteFsUtils::Exists(refFile));
1005+
1006+
argv[0] = (char*)"";
1007+
argv[1] = (char*)pdscFile.c_str();
1008+
argv[2] = (char*)"-x";
1009+
argv[3] = (char*)"!M317";
1010+
argv[4] = (char*)"--disable-validation";
1011+
1012+
PackChk packChk;
1013+
EXPECT_EQ(0, packChk.Check(5, argv, nullptr));
1014+
1015+
auto errMsgs = ErrLog::Get()->GetLogMessages();
1016+
int M317_foundCnt = 0;
1017+
for (const string& msg : errMsgs) {
1018+
size_t s;
1019+
if ((s = msg.find("M317", 0)) != string::npos) {
1020+
M317_foundCnt++;
1021+
}
1022+
}
1023+
1024+
if(M317_foundCnt != 4) {
1025+
FAIL() << "error: warning M317 count != 4";
1026+
}
1027+
}
1028+

0 commit comments

Comments
 (0)