Skip to content

Commit

Permalink
Add coverage check and default build combo test (FreeRTOS#477)
Browse files Browse the repository at this point in the history
* Add coverage checker

* Add build check with default configuration

* Fix build combination and DNS error

* uncrustified and fixed cmakelists
  • Loading branch information
AniruddhaKanhere authored Jun 2, 2022
1 parent 630e94f commit ceb8e1a
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 7 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ jobs:
run: |
make -C test/unit-test/build/ coverage
lcov --list --rc lcov_branch_coverage=1 test/unit-test/build/coverage.info
- name: Check Coverage
uses: FreeRTOS/CI-CD-Github-Actions/coverage-cop@main
with:
path: ./test/unit-test/build/coverage.info

spell-check:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -119,6 +123,11 @@ jobs:
cmake -S test/build-combination -B test/build-combination/build/ \
-DTEST_CONFIGURATION=DISABLE_ALL
make -C test/build-combination/build/
- name: Build checks (Default configuration)
run: |
cmake -S test/build-combination -B test/build-combination/build/ \
-DTEST_CONFIGURATION=DEFAULT_CONF
make -C test/build-combination/build/
complexity:
runs-on: ubuntu-latest
Expand Down
6 changes: 5 additions & 1 deletion source/FreeRTOS_DNS.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,11 @@
{
size_t xLength = strlen( pcHostName ) + 1U;

if( xLength <= ipconfigDNS_CACHE_NAME_LENGTH )
#if ( ipconfigUSE_DNS_CACHE != 0 )
if( xLength <= ipconfigDNS_CACHE_NAME_LENGTH )
#else
if( xLength <= dnsMAX_HOSTNAME_LENGTH )
#endif
{
/* The name is not too long. */
xLengthOk = pdTRUE;
Expand Down
7 changes: 5 additions & 2 deletions source/include/FreeRTOS_DNS_Globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,11 @@
#endif /* ( ipconfigUSE_NBNS == 1 ) */

/* Host types. */
#define dnsTYPE_A_HOST 0x01U /**< DNS type A host. */
#define dnsCLASS_IN 0x01U /**< DNS class IN (Internet). */
#define dnsTYPE_A_HOST 0x01U /**< DNS type A host. */
#define dnsCLASS_IN 0x01U /**< DNS class IN (Internet). */

/* Maximum hostname length as defined in RFC 1035 section 3.1. */
#define dnsMAX_HOSTNAME_LENGTH 0xFFU

#ifndef _lint
/* LLMNR constants. */
Expand Down
7 changes: 4 additions & 3 deletions test/build-combination/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ option( BUILD_CLONE_SUBMODULES
ON )


option(TEST_CONFIGURATION "Configuration All Enable/Disable" ENABLE_ALL)
option(TEST_CONFIGURATION "Configuration All Enable/Disable or default" ENABLE_ALL)

message( STATUS "Argument: ${TEST_CONFIGURATION}")

Expand All @@ -47,8 +47,10 @@ include_directories( ${TEST_DIR}/Common )

if( ${TEST_CONFIGURATION} STREQUAL "ENABLE_ALL" )
include_directories( ${TEST_DIR}/AllEnable )
else()
elseif( ${TEST_CONFIGURATION} STREQUAL "DISABLE_ALL" )
include_directories( ${TEST_DIR}/AllDisable )
else()
include_directories( ${TEST_DIR}/DefaultConf )
endif()


Expand All @@ -60,7 +62,6 @@ file(GLOB TCP_SOURCES "${MODULE_ROOT_DIR}/source/*.c"
message(STATUS "${KERNEL_SOURCES}")
message(STATUS "${TCP_SOURCES}")


add_executable(project ${KERNEL_SOURCES}
${TCP_SOURCES}
${FREERTOS_KERNEL_DIR}/portable/MemMang/heap_4.c
Expand Down
2 changes: 1 addition & 1 deletion test/build-combination/Common/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ BaseType_t xNetworkInterfaceInitialise( void )
/* Provide a stub for this function. */
}

#if ( ipconfigUSE_TCP == 1 )
#if ( ( ipconfigUSE_TCP == 1 ) && ( ipconfigUSE_DHCP_HOOK != 0 ) )
eDHCPCallbackAnswer_t xApplicationDHCPHook( eDHCPCallbackPhase_t eDHCPPhase,
uint32_t ulIPAddress )
{
Expand Down
43 changes: 43 additions & 0 deletions test/build-combination/DefaultConf/FreeRTOSIPConfig.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* FreeRTOS Kernel V10.4.1
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* http://aws.amazon.com/freertos
* http://www.FreeRTOS.org
*/


/*****************************************************************************
*
* See the following URL for configuration information.
* http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html
*
*****************************************************************************/

#ifndef FREERTOS_IP_CONFIG_H
#define FREERTOS_IP_CONFIG_H

/* Empty configuration file to check the build with default configuration. */

/* It is not sensible for this macro to have a default value as it is hardware
* dependent. */
#define ipconfigBYTE_ORDER pdFREERTOS_LITTLE_ENDIAN

#endif

0 comments on commit ceb8e1a

Please sign in to comment.