mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-17 02:07:48 -04:00
Add Full TCP test suite - not using secure sockets (#131)
* Add Full-TCP suite * delete unnecessary files * Change after Joshua's comments
This commit is contained in:
parent
d7667a0034
commit
7caa328634
47 changed files with 9979 additions and 0 deletions
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* FreeRTOS V202002.00
|
||||
* Copyright (C) 2020 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
|
||||
*/
|
||||
|
||||
#ifndef _AWS_APPLICATION_VERSION_H_
|
||||
#define _AWS_APPLICATION_VERSION_H_
|
||||
|
||||
#include "iot_appversion32.h"
|
||||
extern const AppVersion32_t xAppFirmwareVersion;
|
||||
|
||||
#define APP_VERSION_MAJOR 0
|
||||
#define APP_VERSION_MINOR 9
|
||||
#define APP_VERSION_BUILD 0
|
||||
|
||||
#endif
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* FreeRTOS V202002.00
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __CLIENTCREDENTIAL__H__
|
||||
#define __CLIENTCREDENTIAL__H__
|
||||
|
||||
/*
|
||||
* @brief Wi-Fi network to join.
|
||||
*
|
||||
* @todo If you are using Wi-Fi, set this to your network name.
|
||||
*/
|
||||
#define clientcredentialWIFI_SSID ""
|
||||
|
||||
/*
|
||||
* @brief Password needed to join Wi-Fi network.
|
||||
*
|
||||
* @todo If you are using WPA, set this to your network password.
|
||||
*/
|
||||
#define clientcredentialWIFI_PASSWORD ""
|
||||
|
||||
/*
|
||||
* @brief Wi-Fi network security type.
|
||||
*
|
||||
* @see WIFISecurity_t.
|
||||
*
|
||||
* @note Possible values are eWiFiSecurityOpen, eWiFiSecurityWEP, eWiFiSecurityWPA,
|
||||
* eWiFiSecurityWPA2 (depending on the support of your device Wi-Fi radio).
|
||||
*/
|
||||
#define clientcredentialWIFI_SECURITY eWiFiSecurityWPA2
|
||||
|
||||
#endif
|
|
@ -0,0 +1,299 @@
|
|||
/*
|
||||
* FreeRTOS V202002.00
|
||||
* Copyright (C) 2020 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
|
||||
*/
|
||||
|
||||
/* This file contains default configuration settings for the tests on FreeRTOS. */
|
||||
|
||||
#ifndef IOT_CONFIG_COMMON_H_
|
||||
#define IOT_CONFIG_COMMON_H_
|
||||
|
||||
/* FreeRTOS include. */
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
/* Credentials include. */
|
||||
#include <aws_clientcredential.h>
|
||||
#include <aws_clientcredential_keys.h>
|
||||
|
||||
/* Unity framework includes. */
|
||||
#include "unity.h"
|
||||
|
||||
/* Use platform types on FreeRTOS. */
|
||||
#include "platform/iot_platform_types_freertos.h"
|
||||
|
||||
/* SDK version. */
|
||||
#define IOT_SDK_VERSION "4.0.0"
|
||||
|
||||
/* This config file is for the tests. */
|
||||
#ifndef IOT_BUILD_TESTS
|
||||
#define IOT_BUILD_TESTS ( 1 )
|
||||
#endif
|
||||
|
||||
#if IOT_BUILD_TESTS != 1
|
||||
#error "IOT_BUILD_TESTS must be 1 for this test project."
|
||||
#endif
|
||||
|
||||
/* Unity on FreeRTOS does not provide malloc overrides. */
|
||||
#define IOT_TEST_NO_MALLOC_OVERRIDES ( 1 )
|
||||
|
||||
/* Supported network types.*/
|
||||
#define AWSIOT_NETWORK_TYPE_NONE 0x00000000
|
||||
#define AWSIOT_NETWORK_TYPE_WIFI 0x00000001
|
||||
#define AWSIOT_NETWORK_TYPE_BLE 0x00000002
|
||||
|
||||
/* Logging puts function. */
|
||||
#define IotLogging_Puts( str ) configPRINTF( ( "%s\r\n", str ) )
|
||||
|
||||
/* Enable asserts in libraries. */
|
||||
#define IOT_METRICS_ENABLE_ASSERTS ( 1 )
|
||||
#define IOT_CONTAINERS_ENABLE_ASSERTS ( 1 )
|
||||
#define IOT_TASKPOOL_ENABLE_ASSERTS ( 1 )
|
||||
#define IOT_MQTT_ENABLE_ASSERTS ( 1 )
|
||||
#define AWS_IOT_SHADOW_ENABLE_ASSERTS ( 1 )
|
||||
#define AWS_IOT_DEFENDER_ENABLE_ASSERTS ( 1 )
|
||||
#define IOT_BLE_ENABLE_ASSERTS ( 1 )
|
||||
|
||||
/* Assert functions. */
|
||||
#define IotMetrics_Assert( expression ) if( ( expression ) == 0 ) TEST_FAIL_MESSAGE( "Assertion failure" )
|
||||
#define IotContainers_Assert( expression ) if( ( expression ) == 0 ) TEST_FAIL_MESSAGE( "Assertion failure" )
|
||||
#define IotTaskPool_Assert( expression ) if( ( expression ) == 0 ) TEST_FAIL_MESSAGE( "Assertion failure" )
|
||||
#define IotMqtt_Assert( expression ) if( ( expression ) == 0 ) TEST_FAIL_MESSAGE( "Assertion failure" )
|
||||
#define AwsIotShadow_Assert( expression ) if( ( expression ) == 0 ) TEST_FAIL_MESSAGE( "Assertion failure" )
|
||||
#define AwsIotDefender_Assert( expression ) if( ( expression ) == 0 ) TEST_FAIL_MESSAGE( "Assertion failure" )
|
||||
#define IotBle_Assert( expression ) if( ( expression ) == 0 ) TEST_FAIL_MESSAGE( "Assertion failure" )
|
||||
|
||||
/* Control the usage of dynamic memory allocation. */
|
||||
#ifndef IOT_STATIC_MEMORY_ONLY
|
||||
#define IOT_STATIC_MEMORY_ONLY ( 0 )
|
||||
#endif
|
||||
|
||||
/* Memory allocation configuration. Note that these functions will not be affected
|
||||
* by IOT_STATIC_MEMORY_ONLY. */
|
||||
#define IotNetwork_Malloc pvPortMalloc
|
||||
#define IotNetwork_Free vPortFree
|
||||
#define IotThreads_Malloc pvPortMalloc
|
||||
#define IotThreads_Free vPortFree
|
||||
#define IotLogging_Malloc pvPortMalloc
|
||||
#define IotLogging_Free vPortFree
|
||||
#define IotBle_Malloc pvPortMalloc
|
||||
#define IotBle_Free vPortFree
|
||||
/* #define IotLogging_StaticBufferSize */
|
||||
#define IotTest_Malloc pvPortMalloc
|
||||
#define IotTest_Free vPortFree
|
||||
|
||||
|
||||
/* Memory allocation function configuration for the MQTT library. The MQTT library
|
||||
* will be affected by IOT_STATIC_MEMORY_ONLY. */
|
||||
#if IOT_STATIC_MEMORY_ONLY == 0
|
||||
#define IotMetrics_MallocTcpConnection pvPortMalloc
|
||||
#define IotMetrics_FreeTcpConnection vPortFree
|
||||
#define IotMetrics_MallocIpAddress pvPortMalloc
|
||||
#define IotMetrics_FreeIpAddress vPortFree
|
||||
|
||||
#define IotTaskPool_MallocTaskPool pvPortMalloc
|
||||
#define IotTaskPool_FreeTaskPool vPortFree
|
||||
#define IotTaskPool_MallocJob pvPortMalloc
|
||||
#define IotTaskPool_FreeJob vPortFree
|
||||
#define IotTaskPool_MallocTimerEvent pvPortMalloc
|
||||
#define IotTaskPool_FreeTimerEvent vPortFree
|
||||
|
||||
#define IotMqtt_MallocConnection pvPortMalloc
|
||||
#define IotMqtt_FreeConnection vPortFree
|
||||
#define IotMqtt_MallocMessage pvPortMalloc
|
||||
#define IotMqtt_FreeMessage vPortFree
|
||||
#define IotMqtt_MallocOperation pvPortMalloc
|
||||
#define IotMqtt_FreeOperation vPortFree
|
||||
#define IotMqtt_MallocSubscription pvPortMalloc
|
||||
#define IotMqtt_FreeSubscription vPortFree
|
||||
|
||||
#define IotSerializer_MallocCborEncoder pvPortMalloc
|
||||
#define IotSerializer_FreeCborEncoder vPortFree
|
||||
#define IotSerializer_MallocCborParser pvPortMalloc
|
||||
#define IotSerializer_FreeCborParser vPortFree
|
||||
#define IotSerializer_MallocCborValue pvPortMalloc
|
||||
#define IotSerializer_FreeCborValue vPortFree
|
||||
#define IotSerializer_MallocDecoderObject pvPortMalloc
|
||||
#define IotSerializer_FreeDecoderObject vPortFree
|
||||
|
||||
#define AwsIotShadow_MallocOperation pvPortMalloc
|
||||
#define AwsIotShadow_FreeOperation vPortFree
|
||||
#define AwsIotShadow_MallocString pvPortMalloc
|
||||
#define AwsIotShadow_FreeString vPortFree
|
||||
#define AwsIotShadow_MallocSubscription pvPortMalloc
|
||||
#define AwsIotShadow_FreeSubscription vPortFree
|
||||
|
||||
#define AwsIotDefender_MallocReport pvPortMalloc
|
||||
#define AwsIotDefender_FreeReport vPortFree
|
||||
#define AwsIotDefender_MallocTopic pvPortMalloc
|
||||
#define AwsIotDefender_FreeTopic vPortFree
|
||||
#endif /* if IOT_STATIC_MEMORY_ONLY == 0 */
|
||||
|
||||
/* Require MQTT serializer overrides for the tests. */
|
||||
#define IOT_MQTT_ENABLE_SERIALIZER_OVERRIDES ( 1 )
|
||||
|
||||
/* Platform and SDK name for AWS MQTT metrics. Only used when AWS_IOT_MQTT_ENABLE_METRICS is 1. */
|
||||
#define IOT_SDK_NAME "AmazonFreeRTOS"
|
||||
#ifdef configPLATFORM_NAME
|
||||
#define IOT_PLATFORM_NAME configPLATFORM_NAME
|
||||
#else
|
||||
#define IOT_PLATFORM_NAME "Unknown"
|
||||
#endif
|
||||
|
||||
/* BLE_HAL test suites header file abstraction */
|
||||
#define IOT_LINEAR_CONTAINERS "iot_linear_containers.h"
|
||||
#define IOT_THREADS "platform/iot_threads.h"
|
||||
#define IOT_CLOCK "platform/iot_clock.h"
|
||||
#define IOT_PLATFORM_TYPES "types/iot_platform_types.h"
|
||||
#define IOT_BT_HAL_MANAGER_ADAPTER_BLE "bt_hal_manager_adapter_ble.h"
|
||||
#define IOT_BT_HAL_MANAGER_ADAPTER "bt_hal_manager.h"
|
||||
#define IOT_BT_HAL_GATT_SERVER "bt_hal_gatt_server.h"
|
||||
#define IOT_BT_HAL_GATT_TYPES "bt_hal_gatt_types.h"
|
||||
#define IOT_UNITY_FIXTURE "unity_fixture.h"
|
||||
#define IOT_UNITY "unity.h"
|
||||
#define IOT_LOG "iot_logging_setup.h"
|
||||
|
||||
/* Cloud endpoint to which the device connects to. */
|
||||
#define IOT_CLOUD_ENDPOINT clientcredentialMQTT_BROKER_ENDPOINT
|
||||
|
||||
/* Certificate for the device.*/
|
||||
#define IOT_DEVICE_CERTIFICATE keyCLIENT_CERTIFICATE_PEM
|
||||
|
||||
/**
|
||||
* @brief Unique identifier used to recognize a device by the cloud.
|
||||
* This could be SHA-256 of the device certificate.
|
||||
*/
|
||||
extern const char * getDeviceIdentifier( void );
|
||||
#define IOT_DEVICE_IDENTIFIER getDeviceIdentifier()
|
||||
|
||||
/**
|
||||
* @brief Metrics emitted by the device.
|
||||
*/
|
||||
extern const char * getDeviceMetrics( void );
|
||||
#define AWS_IOT_METRICS_USERNAME getDeviceMetrics()
|
||||
|
||||
/**
|
||||
* @brief Length of the metrics emitted by device.
|
||||
*/
|
||||
extern uint16_t getDeviceMetricsLength( void );
|
||||
#define AWS_IOT_METRICS_USERNAME_LENGTH getDeviceMetricsLength()
|
||||
|
||||
/* Set Thing Name. */
|
||||
#define AWS_IOT_TEST_SHADOW_THING_NAME clientcredentialIOT_THING_NAME
|
||||
#define AWS_IOT_TEST_DEFENDER_THING_NAME clientcredentialIOT_THING_NAME
|
||||
|
||||
/* Configuration for defender demo: set format to CBOR. */
|
||||
#define AWS_IOT_DEFENDER_FORMAT AWS_IOT_DEFENDER_FORMAT_CBOR
|
||||
|
||||
/* Configuration for defender demo: use long tag for readable output. Please use short tag for the real application. */
|
||||
#define AWS_IOT_DEFENDER_USE_LONG_TAG ( 1 )
|
||||
|
||||
/* Define the data type of metrics connection id as same as Socket_t in aws_secure_socket.h */
|
||||
#define IotMetricsConnectionId_t void *
|
||||
|
||||
/* For compatibility with the FreeRTOS test framework, UnityPrint and similar
|
||||
* must be redefined. */
|
||||
extern int snprintf( char *,
|
||||
size_t,
|
||||
const char *,
|
||||
... );
|
||||
#define UnityPrint( X ) configPRINTF( ( X ) )
|
||||
#define UnityPrintNumber( X ) { char number[ 12 ] = { 0 }; snprintf( number, 12, "%d", X ); configPRINTF( ( number ) ); }
|
||||
#undef UNITY_PRINT_EOL
|
||||
#define UNITY_PRINT_EOL() configPRINTF( ( "\r\n" ) )
|
||||
|
||||
/* Default platform thread stack size and priority. */
|
||||
#ifndef IOT_THREAD_DEFAULT_STACK_SIZE
|
||||
#define IOT_THREAD_DEFAULT_STACK_SIZE 2048
|
||||
#endif
|
||||
#ifndef IOT_THREAD_DEFAULT_PRIORITY
|
||||
#define IOT_THREAD_DEFAULT_PRIORITY tskIDLE_PRIORITY
|
||||
#endif
|
||||
|
||||
/* Platform network configuration. */
|
||||
#ifndef IOT_NETWORK_RECEIVE_TASK_PRIORITY
|
||||
#define IOT_NETWORK_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
#endif
|
||||
#ifndef IOT_NETWORK_RECEIVE_TASK_STACK_SIZE
|
||||
#define IOT_NETWORK_RECEIVE_TASK_STACK_SIZE IOT_THREAD_DEFAULT_STACK_SIZE
|
||||
#endif
|
||||
|
||||
/* Use FreeRTOS Secure Sockets network for tests. */
|
||||
#ifndef IOT_TEST_NETWORK_HEADER
|
||||
#define IOT_TEST_NETWORK_HEADER "platform/iot_network_freertos.h"
|
||||
#endif
|
||||
|
||||
/* All tests use a secured connection. */
|
||||
#define IOT_TEST_SECURED_CONNECTION ( 1 )
|
||||
|
||||
/* Allow the network interface to be chosen by at runtime. */
|
||||
struct IotNetworkInterface;
|
||||
extern const struct IotNetworkInterface * IotTestNetwork_GetNetworkInterface( void );
|
||||
#define IOT_TEST_NETWORK_INTERFACE IotTestNetwork_GetNetworkInterface()
|
||||
|
||||
/* Allow the network serializer to be chosen by at runtime. */
|
||||
struct IotMqttSerializer;
|
||||
extern const struct IotMqttSerializer * IotTestNetwork_GetSerializer( void );
|
||||
#define IOT_TEST_MQTT_SERIALIZER IotTestNetwork_GetSerializer()
|
||||
|
||||
/* Retry the MQTT Connections in the MQTT System unit tests for all hardware
|
||||
* platforms supported in FreeRTOS.
|
||||
* Set this to the number of connection attempts for the MQTT tests.
|
||||
* If undefined, it should default to 1. */
|
||||
#define IOT_TEST_MQTT_CONNECT_RETRY_COUNT ( 3 )
|
||||
|
||||
/* AWS IoT Service limits only allow 1 connection per MQTT client ID per second.
|
||||
* Wait until 1100 ms have elapsed since the last connection. */
|
||||
#define IOT_TEST_MQTT_CONNECT_INIT_RETRY_DELAY_MS ( 1100 )
|
||||
|
||||
/* Forward declarations of network types used in the tests. */
|
||||
typedef struct IotNetworkConnection IotTestNetworkConnection_t;
|
||||
typedef struct IotNetworkServerInfo IotTestNetworkServerInfo_t;
|
||||
typedef struct IotNetworkCredentials IotTestNetworkCredentials_t;
|
||||
|
||||
/* Define test network initializers. */
|
||||
#define IOT_TEST_NETWORK_CONNECTION_INITIALIZER IOT_NETWORK_CONNECTION_AFR_INITIALIZER
|
||||
#define IOT_TEST_NETWORK_SERVER_INFO_INITIALIZER AWS_IOT_NETWORK_SERVER_INFO_AFR_INITIALIZER
|
||||
|
||||
/* Define the credentials initializer based on the server port. Use ALPN if on
|
||||
* 443, otherwise disable ALPN. */
|
||||
#if clientcredentialMQTT_BROKER_PORT == 443
|
||||
#define IOT_TEST_NETWORK_CREDENTIALS_INITIALIZER AWS_IOT_NETWORK_CREDENTIALS_AFR_INITIALIZER
|
||||
#else
|
||||
#define IOT_TEST_NETWORK_CREDENTIALS_INITIALIZER \
|
||||
{ \
|
||||
.disableSni = false, \
|
||||
.pAlpnProtos = NULL, \
|
||||
.pRootCa = NULL, \
|
||||
.pClientCert = keyCLIENT_CERTIFICATE_PEM, \
|
||||
.pPrivateKey = keyCLIENT_PRIVATE_KEY_PEM, \
|
||||
.rootCaSize = 0, \
|
||||
.clientCertSize = sizeof( keyCLIENT_CERTIFICATE_PEM ), \
|
||||
.privateKeySize = sizeof( keyCLIENT_PRIVATE_KEY_PEM ) \
|
||||
}
|
||||
#endif /* if clientcredentialMQTT_BROKER_PORT == 443 */
|
||||
|
||||
/* Network initialization and cleanup functions are not needed on FreeRTOS. */
|
||||
#define IotTestNetwork_Init() IOT_NETWORK_SUCCESS
|
||||
#define IotTestNetwork_Cleanup()
|
||||
|
||||
#endif /* ifndef IOT_CONFIG_COMMON_H_ */
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* FreeRTOS V202002.00
|
||||
* Copyright (C) 2020 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
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file aws_test_framework.h
|
||||
* @brief Header file for test framework.
|
||||
*/
|
||||
|
||||
#ifndef _AWS_TEST_FRAMEWORK_H_
|
||||
#define _AWS_TEST_FRAMEWORK_H_
|
||||
|
||||
void TEST_CacheResult( char cResult );
|
||||
|
||||
void TEST_SubmitResultBuffer( void );
|
||||
|
||||
void TEST_NotifyTestStart( void );
|
||||
|
||||
void TEST_NotifyTestFinished( void );
|
||||
|
||||
void TEST_SubmitResult( const char * pcResult );
|
||||
|
||||
#endif /* _AWS_TEST_FRAMEWORK_H_ */
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* FreeRTOS V202002.00
|
||||
* Copyright (C) 2020 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
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file aws_test_runner.h
|
||||
* @brief The function to be called to run all the tests.
|
||||
*/
|
||||
|
||||
#ifndef _AWS_TEST_RUNNER_H_
|
||||
#define _AWS_TEST_RUNNER_H_
|
||||
|
||||
/*
|
||||
* @brief If set to 1, will run DQP_FR tests only.
|
||||
*/
|
||||
#define testrunnerTEST_FILTER 0
|
||||
|
||||
|
||||
/**
|
||||
* @brief Size of shared array.
|
||||
*
|
||||
*/
|
||||
#define testrunnerBUFFER_SIZE ( 4000 )
|
||||
|
||||
/**
|
||||
* @brief Buffer used for all tests.
|
||||
*
|
||||
* Since tests are run in series, they can use the same memory array.
|
||||
* This makes significant heap savings.
|
||||
*/
|
||||
extern char cBuffer[ testrunnerBUFFER_SIZE ];
|
||||
|
||||
/**
|
||||
* @brief FreeRTOS heap measurement taken before tests are run.
|
||||
*/
|
||||
extern unsigned int xHeapBefore;
|
||||
|
||||
/**
|
||||
* @brief FreeRTOS heap measurement taken after all tests are run.
|
||||
*/
|
||||
extern unsigned int xHeapAfter;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Runs all the tests.
|
||||
*/
|
||||
void TEST_RUNNER_RunTests_task( void * pvParameters );
|
||||
|
||||
|
||||
|
||||
#endif /* _AWS_TEST_RUNNER_H_ */
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* FreeRTOS V202002.00
|
||||
* Copyright (C) 2020 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
|
||||
*/
|
||||
|
||||
#ifndef TEST_TCP_H
|
||||
#define TEST_TCP_H
|
||||
|
||||
/* Non-Encrypted Echo Server.
|
||||
* Update tcptestECHO_SERVER_ADDR# and
|
||||
* tcptestECHO_PORT with IP address
|
||||
* and port of unencrypted TCP echo server. */
|
||||
|
||||
/* You can find the code to setup an echo server in the Repo */
|
||||
|
||||
/* Assume ECHO server IP-address A.B.C.D And Port Z*/
|
||||
#define tcptestECHO_SERVER_ADDR0 ( 255 ) /* Replace with Your Echo Server Addr First Byte i.e. A */
|
||||
#define tcptestECHO_SERVER_ADDR1 ( 255 ) /* Replace with Your Echo Server Addr Second Byte i.e. B */
|
||||
#define tcptestECHO_SERVER_ADDR2 ( 255 ) /* Replace with Your Echo Server Addr Third Byte i.e. C */
|
||||
#define tcptestECHO_SERVER_ADDR3 ( 255 ) /* Replace with Your Echo Server Addr Fourth Byte i.e. D */
|
||||
#define tcptestECHO_PORT ( 0 ) /* Replace with Your Echo Server Port Number i.e. Z */
|
||||
|
||||
#if tcptestECHO_PORT == 0
|
||||
#error "Use Correct Port number and Correct IP address by setting tcptestECHO_SERVER_ADDR[0-3] and tcptestECHO_PORT in test_tcp.h"
|
||||
#endif
|
||||
/* Number of times to retry a connection if it fails. */
|
||||
#define tcptestRETRY_CONNECTION_TIMES 6
|
||||
|
||||
#endif /* ifndef TEST_TCP_H */
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* Copyright (C) 2018 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
|
||||
*/
|
||||
|
||||
#ifndef AWS_INTEGRATION_TEST_TCP_CONFIG_H
|
||||
#define AWS_INTEGRATION_TEST_TCP_CONFIG_H
|
||||
|
||||
/**
|
||||
* @file aws_integration_test_tcp_portable.h
|
||||
* @brief Port-specific variables for TCP tests. */
|
||||
|
||||
|
||||
/**
|
||||
* @brief Indicates how much longer than the specified timeout is acceptable for
|
||||
* RCVTIMEO tests.
|
||||
*
|
||||
* This value can be used to compensate for clock differences, and other
|
||||
* code overhead.
|
||||
*/
|
||||
#define integrationtestportableTIMEOUT_OVER_TOLERANCE 1
|
||||
|
||||
/**
|
||||
* @brief Indicates how much less time than the specified timeout is acceptable for
|
||||
* RCVTIMEO tests.
|
||||
*
|
||||
* This value must be 0 unless networking is performs on a separate processor.
|
||||
* If networking and tests are on different CPUs, an "under tolerance" is acceptable.
|
||||
* For tests where same clock is used for networking and tests.
|
||||
*/
|
||||
#define integrationtestportableTIMEOUT_UNDER_TOLERANCE 0
|
||||
|
||||
/**
|
||||
* @brief Indicates how long receive needs to wait for data before Timeout happens.
|
||||
*
|
||||
*/
|
||||
#define integrationtestportableRECEIVE_TIMEOUT 2000
|
||||
|
||||
/**
|
||||
* @brief Indicates how long send needs to wait before Timeout happens.
|
||||
*
|
||||
*/
|
||||
#define integrationtestportableSEND_TIMEOUT 2000
|
||||
|
||||
|
||||
/**
|
||||
* @brief Choose a desired hostname to be resolved.
|
||||
* Also, select the number of IP-addresses the test should expect by modifying
|
||||
* dnstestNUM_UNIQUE_IP_ADDRESSES in test_tcp.c source file.
|
||||
*/
|
||||
#define HostNameUNIQUE_ADDRESSES_TEST "freertos.org"
|
||||
|
||||
|
||||
#endif /*AWS_INTEGRATION_TEST_TCP_CONFIG_H */
|
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* FreeRTOS V202002.00
|
||||
* Copyright (C) 2020 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
|
||||
*/
|
||||
|
||||
#ifndef _TEST_UTILS_H_
|
||||
#define _TEST_UTILS_H_
|
||||
|
||||
/**
|
||||
* @brief Retry expression or statement with exponential backoff
|
||||
*
|
||||
* @param xCommand The expression or statement that should be
|
||||
* retried
|
||||
* @param xSuccessStatus The success status where a xCommand need not
|
||||
* be retried any more
|
||||
* @param ulStartingPeriodMs The initial delay period in milliseconds
|
||||
* @param lRetries The number of times to retry. xCommand will
|
||||
* be tried once, and then retried n times.
|
||||
*
|
||||
* @code
|
||||
* int a = 0;
|
||||
* RETRY_EXPONENTIAL( printf( "foo\n" ), 4, 150, 8 );
|
||||
* RETRY_EXPONENTIAL( a = printf( "bar\n" ), 0, 250, 8 );
|
||||
* RETRY_EXPONENTIAL( a = printf( "bar\n" ), 0, 250, 8 );
|
||||
* RETRY_EXPONENTIAL( a = connect_to_server(), CONNECTION_SUCCESS, 250, 8 );
|
||||
* RETRY_EXPONENTIAL( a++, 10, 250, 8 );
|
||||
* @endcode
|
||||
*
|
||||
* @return None
|
||||
*/
|
||||
#define RETRY_EXPONENTIAL( \
|
||||
xCommand, xSuccessStatus, ulStartingPeriodMs, lRetries ) \
|
||||
{ \
|
||||
int32_t lRetried = 0; \
|
||||
uint32_t ulPeriodMs = ulStartingPeriodMs; \
|
||||
int32_t lStatus; \
|
||||
for( ; lRetried <= lRetries; lRetried++ ) { \
|
||||
if( lRetried ) { \
|
||||
configPRINTF( ( "retrying \"%s\", %d of %d, in %d ms\n", \
|
||||
# xCommand, lRetried, \
|
||||
lRetries, ulPeriodMs ) ); \
|
||||
vTaskDelay( pdMS_TO_TICKS( ulPeriodMs ) ); \
|
||||
ulPeriodMs *= 2; \
|
||||
} \
|
||||
lStatus = xCommand; \
|
||||
if( xSuccessStatus == lStatus ) { \
|
||||
break; \
|
||||
} \
|
||||
configPRINTF( ( "expected %d, got %d\n", \
|
||||
xSuccessStatus, lStatus ) ); \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the file name at the end of a windows path
|
||||
*
|
||||
* @param full_path The full path
|
||||
*
|
||||
* @return file name
|
||||
*/
|
||||
#define WIN_FILENAME( full_path ) \
|
||||
( strrchr( full_path, '\\' ) ? strrchr( full_path, '\\' ) + 1 : full_path )
|
||||
|
||||
/**
|
||||
* @brief Returns the file name at the end of a linux path
|
||||
*
|
||||
* @param full_path The full path
|
||||
*
|
||||
* @return file name
|
||||
*/
|
||||
#define NIX_FILENAME( full_path ) \
|
||||
( strrchr( full_path, '/' ) ? strrchr( full_path, '/' ) + 1 : full_path )
|
||||
|
||||
/**
|
||||
* The name of the current file, stripped of the path
|
||||
*/
|
||||
#define __FILENAME__ WIN_FILENAME( NIX_FILENAME( __FILE__ ) )
|
||||
|
||||
|
||||
#endif /* end of include guard: _AWS_TEST_UTILS_H_ */
|
|
@ -0,0 +1,280 @@
|
|||
/*
|
||||
* FreeRTOS V202002.00
|
||||
* Copyright (C) 2020 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
|
||||
*/
|
||||
|
||||
/* Unity Configuration
|
||||
* As of May 11th, 2016 at ThrowTheSwitch/Unity commit 837c529
|
||||
* Update: December 29th, 2016
|
||||
* See Also: Unity/docs/UnityConfigurationGuide.pdf
|
||||
*
|
||||
* Unity is designed to run on almost anything that is targeted by a C compiler.
|
||||
* It would be awesome if this could be done with zero configuration. While
|
||||
* there are some targets that come close to this dream, it is sadly not
|
||||
* universal. It is likely that you are going to need at least a couple of the
|
||||
* configuration options described in this document.
|
||||
*
|
||||
* All of Unity's configuration options are `#defines`. Most of these are simple
|
||||
* definitions. A couple are macros with arguments. They live inside the
|
||||
* unity_internals.h header file. We don't necessarily recommend opening that
|
||||
* file unless you really need to. That file is proof that a cross-platform
|
||||
* library is challenging to build. From a more positive perspective, it is also
|
||||
* proof that a great deal of complexity can be centralized primarily to one
|
||||
* place in order to provide a more consistent and simple experience elsewhere.
|
||||
*
|
||||
* Using These Options
|
||||
* It doesn't matter if you're using a target-specific compiler and a simulator
|
||||
* or a native compiler. In either case, you've got a couple choices for
|
||||
* configuring these options:
|
||||
*
|
||||
* 1. Because these options are specified via C defines, you can pass most of
|
||||
* these options to your compiler through command line compiler flags. Even
|
||||
* if you're using an embedded target that forces you to use their
|
||||
* overbearing IDE for all configuration, there will be a place somewhere in
|
||||
* your project to configure defines for your compiler.
|
||||
* 2. You can create a custom `unity_config.h` configuration file (present in
|
||||
* your toolchain's search paths). In this file, you will list definitions
|
||||
* and macros specific to your target. All you must do is define
|
||||
* `UNITY_INCLUDE_CONFIG_H` and Unity will rely on `unity_config.h` for any
|
||||
* further definitions it may need.
|
||||
*/
|
||||
|
||||
#ifndef AWS_UNITY_CONFIG_H
|
||||
#define AWS_UNITY_CONFIG_H
|
||||
|
||||
/* ************************* AUTOMATIC INTEGER TYPES ***************************
|
||||
* C's concept of an integer varies from target to target. The C Standard has
|
||||
* rules about the `int` matching the register size of the target
|
||||
* microprocessor. It has rules about the `int` and how its size relates to
|
||||
* other integer types. An `int` on one target might be 16 bits while on another
|
||||
* target it might be 64. There are more specific types in compilers compliant
|
||||
* with C99 or later, but that's certainly not every compiler you are likely to
|
||||
* encounter. Therefore, Unity has a number of features for helping to adjust
|
||||
* itself to match your required integer sizes. It starts off by trying to do it
|
||||
* automatically.
|
||||
**************************************************************************** */
|
||||
|
||||
/* The first attempt to guess your types is to check `limits.h`. Some compilers
|
||||
* that don't support `stdint.h` could include `limits.h`. If you don't
|
||||
* want Unity to check this file, define this to make it skip the inclusion.
|
||||
* Unity looks at UINT_MAX & ULONG_MAX, which were available since C89.
|
||||
*/
|
||||
/* #define UNITY_EXCLUDE_LIMITS_H */
|
||||
|
||||
/* The second thing that Unity does to guess your types is check `stdint.h`.
|
||||
* This file defines `UINTPTR_MAX`, since C99, that Unity can make use of to
|
||||
* learn about your system. It's possible you don't want it to do this or it's
|
||||
* possible that your system doesn't support `stdint.h`. If that's the case,
|
||||
* you're going to want to define this. That way, Unity will know to skip the
|
||||
* inclusion of this file and you won't be left with a compiler error.
|
||||
*/
|
||||
/* #define UNITY_EXCLUDE_STDINT_H */
|
||||
|
||||
/* ********************** MANUAL INTEGER TYPE DEFINITION ***********************
|
||||
* If you've disabled all of the automatic options above, you're going to have
|
||||
* to do the configuration yourself. There are just a handful of defines that
|
||||
* you are going to specify if you don't like the defaults.
|
||||
**************************************************************************** */
|
||||
|
||||
/* Define this to be the number of bits an `int` takes up on your system. The
|
||||
* default, if not auto-detected, is 32 bits.
|
||||
*
|
||||
* Example:
|
||||
*/
|
||||
/* #define UNITY_INT_WIDTH 16 */
|
||||
|
||||
/* Define this to be the number of bits a `long` takes up on your system. The
|
||||
* default, if not autodetected, is 32 bits. This is used to figure out what
|
||||
* kind of 64-bit support your system can handle. Does it need to specify a
|
||||
* `long` or a `long long` to get a 64-bit value. On 16-bit systems, this option
|
||||
* is going to be ignored.
|
||||
*
|
||||
* Example:
|
||||
*/
|
||||
/* #define UNITY_LONG_WIDTH 16 */
|
||||
|
||||
/* Define this to be the number of bits a pointer takes up on your system. The
|
||||
* default, if not autodetected, is 32-bits. If you're getting ugly compiler
|
||||
* warnings about casting from pointers, this is the one to look at.
|
||||
*
|
||||
* Example:
|
||||
*/
|
||||
/* #define UNITY_POINTER_WIDTH 64 */
|
||||
|
||||
/* Unity will automatically include 64-bit support if it auto-detects it, or if
|
||||
* your `int`, `long`, or pointer widths are greater than 32-bits. Define this
|
||||
* to enable 64-bit support if none of the other options already did it for you.
|
||||
* There can be a significant size and speed impact to enabling 64-bit support
|
||||
* on small targets, so don't define it if you don't need it.
|
||||
*/
|
||||
/* #define UNITY_INCLUDE_64 */
|
||||
|
||||
|
||||
/* *************************** FLOATING POINT TYPES ****************************
|
||||
* In the embedded world, it's not uncommon for targets to have no support for
|
||||
* floating point operations at all or to have support that is limited to only
|
||||
* single precision. We are able to guess integer sizes on the fly because
|
||||
* integers are always available in at least one size. Floating point, on the
|
||||
* other hand, is sometimes not available at all. Trying to include `float.h` on
|
||||
* these platforms would result in an error. This leaves manual configuration as
|
||||
* the only option.
|
||||
**************************************************************************** */
|
||||
|
||||
/* By default, Unity guesses that you will want single precision floating point
|
||||
* support, but not double precision. It's easy to change either of these using
|
||||
* the include and exclude options here. You may include neither, just float,
|
||||
* or both, as suits your needs.
|
||||
*/
|
||||
/* #define UNITY_EXCLUDE_FLOAT */
|
||||
/* #define UNITY_INCLUDE_DOUBLE */
|
||||
/* #define UNITY_EXCLUDE_DOUBLE */
|
||||
|
||||
/* For features that are enabled, the following floating point options also
|
||||
* become available.
|
||||
*/
|
||||
|
||||
/* Unity aims for as small of a footprint as possible and avoids most standard
|
||||
* library calls (some embedded platforms don't have a standard library!).
|
||||
* Because of this, its routines for printing integer values are minimalist and
|
||||
* hand-coded. To keep Unity universal, though, we eventually chose to develop
|
||||
* our own floating point print routines. Still, the display of floating point
|
||||
* values during a failure are optional. By default, Unity will print the
|
||||
* actual results of floating point assertion failures. So a failed assertion
|
||||
* will produce a message like "Expected 4.0 Was 4.25". If you would like less
|
||||
* verbose failure messages for floating point assertions, use this option to
|
||||
* give a failure message `"Values Not Within Delta"` and trim the binary size.
|
||||
*/
|
||||
/* #define UNITY_EXCLUDE_FLOAT_PRINT */
|
||||
|
||||
/* If enabled, Unity assumes you want your `FLOAT` asserts to compare standard C
|
||||
* floats. If your compiler supports a specialty floating point type, you can
|
||||
* always override this behavior by using this definition.
|
||||
*
|
||||
* Example:
|
||||
*/
|
||||
/* #define UNITY_FLOAT_TYPE float16_t */
|
||||
|
||||
/* If enabled, Unity assumes you want your `DOUBLE` asserts to compare standard
|
||||
* C doubles. If you would like to change this, you can specify something else
|
||||
* by using this option. For example, defining `UNITY_DOUBLE_TYPE` to `long
|
||||
* double` could enable gargantuan floating point types on your 64-bit processor
|
||||
* instead of the standard `double`.
|
||||
*
|
||||
* Example:
|
||||
*/
|
||||
/* #define UNITY_DOUBLE_TYPE long double */
|
||||
|
||||
/* If you look up `UNITY_ASSERT_EQUAL_FLOAT` and `UNITY_ASSERT_EQUAL_DOUBLE` as
|
||||
* documented in the Unity Assertion Guide, you will learn that they are not
|
||||
* really asserting that two values are equal but rather that two values are
|
||||
* "close enough" to equal. "Close enough" is controlled by these precision
|
||||
* configuration options. If you are working with 32-bit floats and/or 64-bit
|
||||
* doubles (the normal on most processors), you should have no need to change
|
||||
* these options. They are both set to give you approximately 1 significant bit
|
||||
* in either direction. The float precision is 0.00001 while the double is
|
||||
* 10^-12. For further details on how this works, see the appendix of the Unity
|
||||
* Assertion Guide.
|
||||
*
|
||||
* Example:
|
||||
*/
|
||||
/* #define UNITY_FLOAT_PRECISION 0.001f */
|
||||
/* #define UNITY_DOUBLE_PRECISION 0.001f */
|
||||
|
||||
|
||||
/* *************************** TOOLSET CUSTOMIZATION ***************************
|
||||
* In addition to the options listed above, there are a number of other options
|
||||
* which will come in handy to customize Unity's behavior for your specific
|
||||
* toolchain. It is possible that you may not need to touch any of these but
|
||||
* certain platforms, particularly those running in simulators, may need to jump
|
||||
* through extra hoops to operate properly. These macros will help in those
|
||||
* situations.
|
||||
**************************************************************************** */
|
||||
|
||||
/* By default, Unity prints its results to `stdout` as it runs. This works
|
||||
* perfectly fine in most situations where you are using a native compiler for
|
||||
* testing. It works on some simulators as well so long as they have `stdout`
|
||||
* routed back to the command line. There are times, however, where the
|
||||
* simulator will lack support for dumping results or you will want to route
|
||||
* results elsewhere for other reasons. In these cases, you should define the
|
||||
* `UNITY_OUTPUT_CHAR` macro. This macro accepts a single character at a time
|
||||
* (as an `int`, since this is the parameter type of the standard C `putchar`
|
||||
* function most commonly used). You may replace this with whatever function
|
||||
* call you like.
|
||||
*
|
||||
* Example:
|
||||
* Say you are forced to run your test suite on an embedded processor with no
|
||||
* `stdout` option. You decide to route your test result output to a custom
|
||||
* serial `RS232_putc()` function you wrote like thus:
|
||||
*/
|
||||
/* #define UNITY_OUTPUT_CHAR(a) RS232_putc(a) */
|
||||
/* #define UNITY_OUTPUT_CHAR_HEADER_DECLARATION RS232_putc(int) */
|
||||
/* #define UNITY_OUTPUT_FLUSH() RS232_flush() */
|
||||
/* #define UNITY_OUTPUT_FLUSH_HEADER_DECLARATION RS232_flush(void) */
|
||||
/* #define UNITY_OUTPUT_START() RS232_config(115200,1,8,0) */
|
||||
/* #define UNITY_OUTPUT_COMPLETE() RS232_close() */
|
||||
|
||||
/* For some targets, Unity can make the otherwise required `setUp()` and
|
||||
* `tearDown()` functions optional. This is a nice convenience for test writers
|
||||
* since `setUp` and `tearDown` don't often actually _do_ anything. If you're
|
||||
* using gcc or clang, this option is automatically defined for you. Other
|
||||
* compilers can also support this behavior, if they support a C feature called
|
||||
* weak functions. A weak function is a function that is compiled into your
|
||||
* executable _unless_ a non-weak version of the same function is defined
|
||||
* elsewhere. If a non-weak version is found, the weak version is ignored as if
|
||||
* it never existed. If your compiler supports this feature, you can let Unity
|
||||
* know by defining `UNITY_SUPPORT_WEAK` as the function attributes that would
|
||||
* need to be applied to identify a function as weak. If your compiler lacks
|
||||
* support for weak functions, you will always need to define `setUp` and
|
||||
* `tearDown` functions (though they can be and often will be just empty). The
|
||||
* most common options for this feature are:
|
||||
*/
|
||||
/* #define UNITY_SUPPORT_WEAK weak */
|
||||
/* #define UNITY_SUPPORT_WEAK __attribute__((weak)) */
|
||||
/* #define UNITY_NO_WEAK */
|
||||
|
||||
/* Some compilers require a custom attribute to be assigned to pointers, like
|
||||
* `near` or `far`. In these cases, you can give Unity a safe default for these
|
||||
* by defining this option with the attribute you would like.
|
||||
*
|
||||
* Example:
|
||||
*/
|
||||
/* #define UNITY_PTR_ATTRIBUTE __attribute__((far)) */
|
||||
/* #define UNITY_PTR_ATTRIBUTE near */
|
||||
|
||||
#include "aws_test_framework.h"
|
||||
|
||||
/* Redirect output to print task. */
|
||||
#ifndef UNITY_OUTPUT_CHAR
|
||||
#define UNITY_OUTPUT_CHAR( a ) TEST_CacheResult( a )
|
||||
#endif
|
||||
#ifndef UNITY_OUTPUT_FLUSH
|
||||
#define UNITY_OUTPUT_FLUSH() TEST_SubmitResultBuffer()
|
||||
#endif
|
||||
#ifndef UNITY_OUTPUT_START
|
||||
#define UNITY_OUTPUT_START() TEST_NotifyTestStart()
|
||||
#endif
|
||||
#ifndef UNITY_OUTPUT_COMPLETE
|
||||
#define UNITY_OUTPUT_COMPLETE() TEST_NotifyTestFinished()
|
||||
#endif
|
||||
|
||||
#endif /* AWS_UNITY_CONFIG_H */
|
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* FreeRTOS V202002.00
|
||||
* Copyright (C) 2020 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
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file iot_demo.c
|
||||
* @brief Demo
|
||||
*/
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an
|
||||
* implementation of vApplicationGetIdleTaskMemory() to provide the memory that is
|
||||
* used by the Idle task. */
|
||||
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
|
||||
StackType_t ** ppxIdleTaskStackBuffer,
|
||||
uint32_t * pulIdleTaskStackSize )
|
||||
{
|
||||
/* If the buffers to be provided to the Idle task are declared inside this
|
||||
* function then they must be declared static - otherwise they will be allocated on
|
||||
* the stack and so not exists after this function exits. */
|
||||
static StaticTask_t xIdleTaskTCB;
|
||||
static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];
|
||||
|
||||
/* Pass out a pointer to the StaticTask_t structure in which the Idle
|
||||
* task's state will be stored. */
|
||||
*ppxIdleTaskTCBBuffer = &xIdleTaskTCB;
|
||||
|
||||
/* Pass out the array that will be used as the Idle task's stack. */
|
||||
*ppxIdleTaskStackBuffer = uxIdleTaskStack;
|
||||
|
||||
/* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.
|
||||
* Note that, as the array is necessarily of type StackType_t,
|
||||
* configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||
*pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief This is to provide the memory that is used by the RTOS daemon/time task.
|
||||
*
|
||||
* If configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an
|
||||
* implementation of vApplicationGetTimerTaskMemory() to provide the memory that is
|
||||
* used by the RTOS daemon/time task.
|
||||
*/
|
||||
void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
|
||||
StackType_t ** ppxTimerTaskStackBuffer,
|
||||
uint32_t * pulTimerTaskStackSize )
|
||||
{
|
||||
/* If the buffers to be provided to the Timer task are declared inside this
|
||||
* function then they must be declared static - otherwise they will be allocated on
|
||||
* the stack and so not exists after this function exits. */
|
||||
static StaticTask_t xTimerTaskTCB;
|
||||
static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
|
||||
|
||||
/* Pass out a pointer to the StaticTask_t structure in which the Idle
|
||||
* task's state will be stored. */
|
||||
*ppxTimerTaskTCBBuffer = &xTimerTaskTCB;
|
||||
|
||||
/* Pass out the array that will be used as the Timer task's stack. */
|
||||
*ppxTimerTaskStackBuffer = uxTimerTaskStack;
|
||||
|
||||
/* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.
|
||||
* Note that, as the array is necessarily of type StackType_t,
|
||||
* configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||
*pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* FreeRTOS V202002.00
|
||||
* Copyright (C) 2020 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
|
||||
*/
|
||||
|
||||
/* Standard includes. */
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
/* FreeRTOS includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
/* Test framework include */
|
||||
#include "test_framework.h"
|
||||
|
||||
/* Unity include */
|
||||
#include "unity.h"
|
||||
|
||||
#define TEST_RESULT_BUFFER_CAPACITY 1024
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* The buffer to store test result. The content will be printed if an eol character
|
||||
* is received */
|
||||
static char pcTestResultBuffer[ TEST_RESULT_BUFFER_CAPACITY ];
|
||||
static int16_t xBufferSize = 0;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void TEST_CacheResult( char cResult )
|
||||
{
|
||||
if( TEST_RESULT_BUFFER_CAPACITY - xBufferSize == 2 )
|
||||
{
|
||||
cResult = '\n';
|
||||
}
|
||||
|
||||
pcTestResultBuffer[ xBufferSize++ ] = cResult;
|
||||
|
||||
if( ( '\n' == cResult ) )
|
||||
{
|
||||
TEST_SubmitResultBuffer();
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void TEST_SubmitResultBuffer()
|
||||
{
|
||||
if( 0 != xBufferSize )
|
||||
{
|
||||
TEST_SubmitResult( pcTestResultBuffer );
|
||||
memset( pcTestResultBuffer, 0, TEST_RESULT_BUFFER_CAPACITY );
|
||||
xBufferSize = 0;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void TEST_NotifyTestStart()
|
||||
{
|
||||
TEST_SubmitResult( "---------STARTING TESTS---------\n" );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void TEST_NotifyTestFinished()
|
||||
{
|
||||
TEST_SubmitResult( "-------ALL TESTS FINISHED-------\n" );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void TEST_SubmitResult( const char * pcResult )
|
||||
{
|
||||
/* We want to print test result no matter configPRINTF is defined or not */
|
||||
vLoggingPrintf( pcResult );
|
||||
|
||||
/* Wait for 0.1 seconds to let print task empty its buffer. */
|
||||
vTaskDelay( pdMS_TO_TICKS( 100UL ) );
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* FreeRTOS V202002.00
|
||||
* Copyright (C) 2020 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
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file iot_test_freertos.c
|
||||
* @brief Common hooks file for platforms that have not implemented hooks.
|
||||
*/
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
/* It is recommended to implement hooks that use platform specific APIs. This allows
|
||||
* for better error messages and recovery. Should platform specific hooks be implemented,
|
||||
* add this macro to iot_config.h to avoid compiling these symbols.*/
|
||||
#ifndef iotconfigUSE_PORT_SPECIFIC_HOOKS
|
||||
|
||||
/**
|
||||
* @brief Warn user if pvPortMalloc fails.
|
||||
*
|
||||
* Called if a call to pvPortMalloc() fails because there is insufficient
|
||||
* free memory available in the FreeRTOS heap. pvPortMalloc() is called
|
||||
* internally by FreeRTOS API functions that create tasks, queues, software
|
||||
* timers, and semaphores. The size of the FreeRTOS heap is set by the
|
||||
* configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
|
||||
*
|
||||
*/
|
||||
void vApplicationMallocFailedHook()
|
||||
{
|
||||
configPRINT_STRING( ( "ERROR: Malloc failed to allocate memory\r\n" ) );
|
||||
taskDISABLE_INTERRUPTS();
|
||||
|
||||
/* Loop forever */
|
||||
for( ; ; )
|
||||
{
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief Loop forever if stack overflow is detected.
|
||||
*
|
||||
* If configCHECK_FOR_STACK_OVERFLOW is set to 1,
|
||||
* this hook provides a location for applications to
|
||||
* define a response to a stack overflow.
|
||||
*
|
||||
* Use this hook to help identify that a stack overflow
|
||||
* has occurred.
|
||||
*
|
||||
*/
|
||||
void vApplicationStackOverflowHook( TaskHandle_t xTask,
|
||||
char * pcTaskName )
|
||||
{
|
||||
/* Disable unused parameter warnings. */
|
||||
( void ) xTask;
|
||||
( void ) pcTaskName;
|
||||
|
||||
configPRINT_STRING( ( "ERROR: stack overflow with task \r\n" ) );
|
||||
portDISABLE_INTERRUPTS();
|
||||
|
||||
/* Loop forever */
|
||||
for( ; ; )
|
||||
{
|
||||
}
|
||||
}
|
||||
#endif /* iotconfigUSE_PORT_SPECIFIC_HOOKS */
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,108 @@
|
|||
/*
|
||||
* FreeRTOS V202002.00
|
||||
* Copyright (C) 2020 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
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file aws_test_runner.c
|
||||
* @brief The function to be called to run all the tests.
|
||||
*/
|
||||
|
||||
/* Test runner interface includes. */
|
||||
#include "test_runner.h"
|
||||
|
||||
/* FreeRTOS includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
/* Unity framework includes. */
|
||||
#include "unity_fixture.h"
|
||||
#include "unity_internals.h"
|
||||
|
||||
char cBuffer[ testrunnerBUFFER_SIZE ];
|
||||
|
||||
/* Heap leak variables. */
|
||||
unsigned int xHeapBefore;
|
||||
unsigned int xHeapAfter;
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* This function will be generated by the test automation framework,
|
||||
* do not change the signature of it. You could, however, add or remove
|
||||
* RUN_TEST_GROUP statements.
|
||||
*/
|
||||
static void RunTests( void )
|
||||
{
|
||||
RUN_TEST_GROUP( Full_TCP );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void TEST_RUNNER_RunTests_task( void * pvParameters )
|
||||
{
|
||||
/* Disable unused parameter warning. */
|
||||
( void ) pvParameters;
|
||||
|
||||
/* Initialize unity. */
|
||||
UnityFixture.Verbose = 1;
|
||||
UnityFixture.GroupFilter = 0;
|
||||
UnityFixture.NameFilter = testrunnerTEST_FILTER;
|
||||
UnityFixture.RepeatCount = 1;
|
||||
|
||||
UNITY_BEGIN();
|
||||
|
||||
/* Give the print buffer time to empty */
|
||||
vTaskDelay( pdMS_TO_TICKS( 500 ) );
|
||||
/* Measure the heap size before any tests are run. */
|
||||
#if ( testrunnerFULL_MEMORYLEAK_ENABLED == 1 )
|
||||
xHeapBefore = xPortGetFreeHeapSize();
|
||||
#endif
|
||||
|
||||
RunTests();
|
||||
|
||||
#if ( testrunnerFULL_MEMORYLEAK_ENABLED == 1 )
|
||||
|
||||
/* Measure the heap size after tests are done running.
|
||||
* This test must run last. */
|
||||
|
||||
/* Perform any global resource cleanup necessary to avoid memory leaks. */
|
||||
#ifdef testrunnerMEMORYLEAK_CLEANUP
|
||||
testrunnerMEMORYLEAK_CLEANUP();
|
||||
#endif
|
||||
|
||||
/* Give the print buffer time to empty */
|
||||
vTaskDelay( pdMS_TO_TICKS( 500 ) );
|
||||
xHeapAfter = xPortGetFreeHeapSize();
|
||||
RUN_TEST_GROUP( Full_MemoryLeak );
|
||||
#endif /* if ( testrunnerFULL_MEMORYLEAK_ENABLED == 1 ) */
|
||||
|
||||
/* Currently disabled. Will be enabled after cleanup. */
|
||||
UNITY_END();
|
||||
|
||||
#ifdef CODE_COVERAGE
|
||||
exit( 0 );
|
||||
#endif
|
||||
|
||||
/* This task has finished. FreeRTOS does not allow a task to run off the
|
||||
* end of its implementing function, so the task must be deleted. */
|
||||
vTaskDelete( NULL );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* FreeRTOS V1.1.4
|
||||
* Copyright (C) 2020 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
|
||||
*/
|
||||
|
||||
#ifndef AWS_TEST_RUNNER_CONFIG_H
|
||||
#define AWS_TEST_RUNNER_CONFIG_H
|
||||
|
||||
/* Uncomment this line if you want to run DQP_FR tests only. */
|
||||
/* #define testrunnerAFQP_ENABLED */
|
||||
|
||||
#define testrunnerUNSUPPORTED 0
|
||||
|
||||
/* Unsupported tests. */
|
||||
#define testrunnerFULL_WIFI_ENABLED testrunnerUNSUPPORTED
|
||||
#define testrunnerFULL_BLE_ENABLED testrunnerUNSUPPORTED
|
||||
#define testrunnerFULL_BLE_END_TO_END_TEST_ENABLED testrunnerUNSUPPORTED
|
||||
|
||||
/* Supported tests. 0 = Disabled, 1 = Enabled */
|
||||
#define testrunnerFULL_TASKPOOL_ENABLED 0
|
||||
#define testrunnerFULL_CRYPTO_ENABLED 0
|
||||
#define testrunnerFULL_FREERTOS_TCP_ENABLED 0
|
||||
#define testrunnerFULL_DEFENDER_ENABLED 0
|
||||
#define testrunnerFULL_GGD_ENABLED 0
|
||||
#define testrunnerFULL_GGD_HELPER_ENABLED 0
|
||||
#define testrunnerFULL_MQTT_AGENT_ENABLED 0
|
||||
#define testrunnerFULL_MQTT_ALPN_ENABLED 0
|
||||
#define testrunnerFULL_MQTT_STRESS_TEST_ENABLED 0
|
||||
#define testrunnerFULL_MQTTv4_ENABLED 0
|
||||
#define testrunnerFULL_PKCS11_ENABLED 0
|
||||
#define testrunnerFULL_PKCS11_MODEL_ENABLED 0
|
||||
#define testrunnerFULL_POSIX_ENABLED 0
|
||||
#define testrunnerFULL_SHADOW_ENABLED 0
|
||||
#define testrunnerFULL_SHADOWv4_ENABLED 0
|
||||
#define testrunnerFULL_TCP_ENABLED 1
|
||||
#define testrunnerFULL_TLS_ENABLED 0
|
||||
#define testrunnerFULL_MEMORYLEAK_ENABLED 0
|
||||
#define testrunnerFULL_OTA_CBOR_ENABLED 0
|
||||
#define testrunnerFULL_OTA_AGENT_ENABLED 0
|
||||
#define testrunnerFULL_OTA_PAL_ENABLED 0
|
||||
#define testrunnerFULL_SERIALIZER_ENABLED 0
|
||||
#define testrunnerUTIL_PLATFORM_CLOCK_ENABLED 0
|
||||
#define testrunnerUTIL_PLATFORM_THREADS_ENABLED 0
|
||||
#define testrunnerFULL_HTTPS_CLIENT_ENABLED 0
|
||||
|
||||
/* On systems using FreeRTOS+TCP (such as this one) the TCP segments must be
|
||||
* cleaned up before running the memory leak check. */
|
||||
#if ( testrunnerFULL_MEMORYLEAK_ENABLED == 1 )
|
||||
extern void vTCPSegmentCleanup();
|
||||
#define testrunnerMEMORYLEAK_CLEANUP() vTCPSegmentCleanup()
|
||||
#endif
|
||||
|
||||
#endif /* AWS_TEST_RUNNER_CONFIG_H */
|
Loading…
Add table
Add a link
Reference in a new issue