Skip to content

Commit

Permalink
Update CI workflow for coverage and manifest check
Browse files Browse the repository at this point in the history
  • Loading branch information
chinglee-iot committed May 22, 2024
1 parent aff376d commit 1150449
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 3 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,19 @@ jobs:
submodules: true
fetch-depth: 0

# At time of writing the gitmodules are set not to pull
# Even when using fetch submodules. Need to run this command
# To force it to grab them.
- name: Perform Recursive Clone
shell: bash
run: git submodule update --checkout --init --recursive

- name: Run manifest verifier
uses: FreeRTOS/CI-CD-GitHub-Actions/manifest-verifier@main
with:
path: ./
fail-on-incorrect-version: true


proof_ci:
if: ${{ github.event.pull_request }}
runs-on: cbmc_ubuntu-latest_64-core
Expand Down
9 changes: 9 additions & 0 deletions manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,12 @@ version: "v1.3.0"
description: |
"FreeRTOS Cellular Interface implementation of the 3GPP TS v27.007 standard..\n"
license: "MIT"

dependencies:
- name: "CMock"
version: "v2.5.3"
license: "MIT"
repository:
type: "git"
url: "https://github.com/ThrowTheSwitch/CMock.git"
path: test/unit-test/CMock
45 changes: 44 additions & 1 deletion test/unit-test/cellular_pkthandler_utest.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ static int32_t pktRespCBReturn = 0;
static bool passCompareString = false;
static char * pCompareString = NULL;
static int32_t undefinedCallbackContext = 0;
static uint32_t lastDelayTimeMs = 0U;

void cellularAtParseTokenHandler( CellularContext_t * pContext,
char * pInputStr );
Expand Down Expand Up @@ -181,6 +182,7 @@ void setUp()
queueData = 0;
queueReturnFail = 0;
pktRespCBReturn = 0;
lastDelayTimeMs = 0U;
}

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

void dummyDelay( uint32_t milliseconds )
{
( void ) milliseconds;
lastDelayTimeMs = milliseconds;
}

void * mock_malloc( size_t size )
Expand Down Expand Up @@ -1116,6 +1118,47 @@ void test__Cellular_AtcmdDataSend_Happy_Path( void )
TEST_ASSERT_EQUAL( CELLULAR_PKT_STATUS_OK, pktStatus );
}

/**
* @brief Test that happy path case for _Cellular_AtcmdDataSend.
*/
void test__Cellular_AtcmdDataSend_data_send_delay( void )
{
CellularPktStatus_t pktStatus = CELLULAR_PKT_STATUS_OK;
char dataBuf[ CELLULAR_AT_CMD_TYPICAL_MAX_SIZE ] = { '\0' };
uint32_t sentDataLength = 0;
CellularAtDataReq_t atDataReq =
{
( const uint8_t * ) dataBuf,
CELLULAR_AT_CMD_TYPICAL_MAX_SIZE,
&sentDataLength,
NULL,
CELLULAR_AT_CMD_TYPICAL_MAX_SIZE
};

CellularAtReq_t atReq =
{
"AT+COPS?",
CELLULAR_AT_WITH_PREFIX,
"+COPS",
NULL,
NULL,
sizeof( int32_t ),
};
CellularContext_t context;

memset( &context, 0, sizeof( CellularContext_t ) );
_Cellular_PktioSendAtCmd_IgnoreAndReturn( CELLULAR_PKT_STATUS_OK );

/* xQueueReceive true, and the data is CELLULAR_PKT_STATUS_OK. */
_Cellular_PktioSendData_IgnoreAndReturn( CELLULAR_AT_CMD_TYPICAL_MAX_SIZE );
queueData = CELLULAR_PKT_STATUS_OK;

/* Send data with data send delay 100ms. */
pktStatus = _Cellular_AtcmdDataSend( &context, atReq, atDataReq, NULL, NULL, 0, 0, 100U );
TEST_ASSERT_EQUAL( 100U, lastDelayTimeMs );
TEST_ASSERT_EQUAL( CELLULAR_PKT_STATUS_OK, pktStatus );
}

/**
* @brief Test that Test dataReq.pData or dataReq.pSentDataLength null case for _Cellular_AtcmdDataSend.
*/
Expand Down

0 comments on commit 1150449

Please sign in to comment.