Skip to content

Commit d2fd754

Browse files
authored
Update CI workflow for coverage and manifest check (#170)
* Update CI workflow for coverage and manifest check * Update line and branch coverage min to 100% * Update github action version
1 parent aff376d commit d2fd754

4 files changed

Lines changed: 74 additions & 14 deletions

File tree

.github/workflows/ci.yml

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Clone This Repo
18-
uses: actions/checkout@v3
18+
uses: actions/checkout@v4
1919
- env:
2020
stepName: Build Unit Tests
2121
run: |
@@ -57,11 +57,13 @@ jobs:
5757
uses: FreeRTOS/CI-CD-Github-Actions/coverage-cop@main
5858
with:
5959
coverage-file: ./build/coverage.info
60+
branch-coverage-min: 100
61+
line-coverage-min: 100
6062

6163
complexity:
6264
runs-on: ubuntu-latest
6365
steps:
64-
- uses: actions/checkout@v3
66+
- uses: actions/checkout@v4
6567
- name: Check complexity - Common
6668
uses: FreeRTOS/CI-CD-Github-Actions/complexity@main
6769
with:
@@ -70,7 +72,7 @@ jobs:
7072
doxygen:
7173
runs-on: ubuntu-latest
7274
steps:
73-
- uses: actions/checkout@v3
75+
- uses: actions/checkout@v4
7476
- name: Run doxygen build
7577
uses: FreeRTOS/CI-CD-Github-Actions/doxygen@main
7678
with:
@@ -80,7 +82,7 @@ jobs:
8082
runs-on: ubuntu-latest
8183
steps:
8284
- name: Clone This Repo
83-
uses: actions/checkout@v3
85+
uses: actions/checkout@v4
8486
- name: Run spellings check
8587
uses: FreeRTOS/CI-CD-Github-Actions/spellings@main
8688
with:
@@ -89,7 +91,7 @@ jobs:
8991
formatting:
9092
runs-on: ubuntu-20.04
9193
steps:
92-
- uses: actions/checkout@v3
94+
- uses: actions/checkout@v4
9395
- name: Check formatting
9496
uses: FreeRTOS/CI-CD-Github-Actions/formatting@main
9597
with:
@@ -98,9 +100,9 @@ jobs:
98100
git-secrets:
99101
runs-on: ubuntu-latest
100102
steps:
101-
- uses: actions/checkout@v3
103+
- uses: actions/checkout@v4
102104
- name: Checkout awslabs/git-secrets
103-
uses: actions/checkout@v3
105+
uses: actions/checkout@v4
104106
with:
105107
repository: awslabs/git-secrets
106108
ref: master
@@ -115,11 +117,11 @@ jobs:
115117
memory_statistics:
116118
runs-on: ubuntu-latest
117119
steps:
118-
- uses: actions/checkout@v3
120+
- uses: actions/checkout@v4
119121
with:
120122
submodules: "recursive"
121123
- name: Install Python3
122-
uses: actions/setup-python@v3
124+
uses: actions/setup-python@v5
123125
with:
124126
python-version: "3.11.0"
125127
- name: Measure sizes
@@ -131,7 +133,7 @@ jobs:
131133
link-verifier:
132134
runs-on: ubuntu-latest
133135
steps:
134-
- uses: actions/checkout@v3
136+
- uses: actions/checkout@v4
135137
- name: Check Links
136138
env:
137139
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -140,18 +142,24 @@ jobs:
140142
verify-manifest:
141143
runs-on: ubuntu-latest
142144
steps:
143-
- uses: actions/checkout@v3
145+
- uses: actions/checkout@v4
144146
with:
145147
submodules: true
146148
fetch-depth: 0
147149

150+
# At time of writing the gitmodules are set not to pull
151+
# Even when using fetch submodules. Need to run this command
152+
# To force it to grab them.
153+
- name: Perform Recursive Clone
154+
shell: bash
155+
run: git submodule update --checkout --init --recursive
156+
148157
- name: Run manifest verifier
149158
uses: FreeRTOS/CI-CD-GitHub-Actions/manifest-verifier@main
150159
with:
151160
path: ./
152161
fail-on-incorrect-version: true
153162

154-
155163
proof_ci:
156164
if: ${{ github.event.pull_request }}
157165
runs-on: cbmc_ubuntu-latest_64-core

manifest.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,12 @@ version: "v1.3.0"
33
description: |
44
"FreeRTOS Cellular Interface implementation of the 3GPP TS v27.007 standard..\n"
55
license: "MIT"
6+
7+
dependencies:
8+
- name: "CMock"
9+
version: "v2.5.3"
10+
license: "MIT"
11+
repository:
12+
type: "git"
13+
url: "https://github.com/ThrowTheSwitch/CMock.git"
14+
path: test/unit-test/CMock

test/unit-test/cellular_pkthandler_utest.c

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ static int32_t pktRespCBReturn = 0;
6868
static bool passCompareString = false;
6969
static char * pCompareString = NULL;
7070
static int32_t undefinedCallbackContext = 0;
71+
static uint32_t lastDelayTimeMs = 0U;
7172

7273
void cellularAtParseTokenHandler( CellularContext_t * pContext,
7374
char * pInputStr );
@@ -181,6 +182,7 @@ void setUp()
181182
queueData = 0;
182183
queueReturnFail = 0;
183184
pktRespCBReturn = 0;
185+
lastDelayTimeMs = 0U;
184186
}
185187

186188
/* Called after each test method. */
@@ -203,7 +205,7 @@ int suiteTearDown( int numFailures )
203205

204206
void dummyDelay( uint32_t milliseconds )
205207
{
206-
( void ) milliseconds;
208+
lastDelayTimeMs = milliseconds;
207209
}
208210

209211
void * mock_malloc( size_t size )
@@ -1116,6 +1118,47 @@ void test__Cellular_AtcmdDataSend_Happy_Path( void )
11161118
TEST_ASSERT_EQUAL( CELLULAR_PKT_STATUS_OK, pktStatus );
11171119
}
11181120

1121+
/**
1122+
* @brief Test that happy path case for _Cellular_AtcmdDataSend.
1123+
*/
1124+
void test__Cellular_AtcmdDataSend_data_send_delay( void )
1125+
{
1126+
CellularPktStatus_t pktStatus = CELLULAR_PKT_STATUS_OK;
1127+
char dataBuf[ CELLULAR_AT_CMD_TYPICAL_MAX_SIZE ] = { '\0' };
1128+
uint32_t sentDataLength = 0;
1129+
CellularAtDataReq_t atDataReq =
1130+
{
1131+
( const uint8_t * ) dataBuf,
1132+
CELLULAR_AT_CMD_TYPICAL_MAX_SIZE,
1133+
&sentDataLength,
1134+
NULL,
1135+
CELLULAR_AT_CMD_TYPICAL_MAX_SIZE
1136+
};
1137+
1138+
CellularAtReq_t atReq =
1139+
{
1140+
"AT+COPS?",
1141+
CELLULAR_AT_WITH_PREFIX,
1142+
"+COPS",
1143+
NULL,
1144+
NULL,
1145+
sizeof( int32_t ),
1146+
};
1147+
CellularContext_t context;
1148+
1149+
memset( &context, 0, sizeof( CellularContext_t ) );
1150+
_Cellular_PktioSendAtCmd_IgnoreAndReturn( CELLULAR_PKT_STATUS_OK );
1151+
1152+
/* xQueueReceive true, and the data is CELLULAR_PKT_STATUS_OK. */
1153+
_Cellular_PktioSendData_IgnoreAndReturn( CELLULAR_AT_CMD_TYPICAL_MAX_SIZE );
1154+
queueData = CELLULAR_PKT_STATUS_OK;
1155+
1156+
/* Send data with data send delay 100ms. */
1157+
pktStatus = _Cellular_AtcmdDataSend( &context, atReq, atDataReq, NULL, NULL, 0, 0, 100U );
1158+
TEST_ASSERT_EQUAL( 100U, lastDelayTimeMs );
1159+
TEST_ASSERT_EQUAL( CELLULAR_PKT_STATUS_OK, pktStatus );
1160+
}
1161+
11191162
/**
11201163
* @brief Test that Test dataReq.pData or dataReq.pSentDataLength null case for _Cellular_AtcmdDataSend.
11211164
*/

0 commit comments

Comments
 (0)