Skip to content

Commit 6ace727

Browse files
authored
Update qualification test (#110)
* Update qualification test * Update for esp-aws-iot version 2024.06.01-LTS
2 parents cddb34a + 0c5ddd6 commit 6ace727

File tree

7 files changed

+45
-183
lines changed

7 files changed

+45
-183
lines changed

components/FreeRTOS-Libraries-Integration-Tests/config/test_param_config.h

Lines changed: 24 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -149,81 +149,42 @@
149149
*/
150150

151151

152-
#define PKCS11_TEST_RSA_KEY_SUPPORT ( 1 )
153-
#define PKCS11_TEST_EC_KEY_SUPPORT ( 0 )
154-
#define PKCS11_TEST_IMPORT_PRIVATE_KEY_SUPPORT ( 1 )
155-
#define PKCS11_TEST_GENERATE_KEYPAIR_SUPPORT ( 0 )
156-
#define PKCS11_TEST_PREPROVISIONED_SUPPORT ( 0 )
157-
#define PKCS11_TEST_LABEL_DEVICE_PRIVATE_KEY_FOR_TLS pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS
158-
#define PKCS11_TEST_LABEL_DEVICE_PUBLIC_KEY_FOR_TLS pkcs11configLABEL_DEVICE_PUBLIC_KEY_FOR_TLS
159-
#define PKCS11_TEST_LABEL_DEVICE_CERTIFICATE_FOR_TLS pkcs11configLABEL_DEVICE_CERTIFICATE_FOR_TLS
160-
161-
162-
#define OTA_RSA_SHA1 1
163-
#define OTA_RSA_SHA256 2
164-
#define OTA_ECDSA_SHA256 3
165-
166-
/**
167-
* @brief Certificate type for OTA PAL test.
168-
* Valid options are: OTA_RSA_SHA1, OTA_RSA_SHA256, OTA_ECDSA_SHA256.
169-
*
170-
* #define OTA_PAL_TEST_CERT_TYPE OTA_ECDSA_SHA256
171-
*/
172-
#define OTA_PAL_TEST_CERT_TYPE OTA_ECDSA_SHA256
173-
174-
/**
175-
* @brief Path to cert for OTA test PAL. Used to verify signature.
176-
* If applicable, the device must be pre-provisioned with this certificate. Please see
177-
* test/common/ota/test_files for the set of certificates.
178-
*/
179-
#define OTA_PAL_CERTIFICATE_FILE CONFIG_GRI_QUALIFICATION_OTA_PAL_CERTIFICATE_FILE
180-
181-
/**
182-
* @brief Some devices have a hard-coded name for the firmware image to boot.
183-
*/
184-
#define OTA_PAL_FIRMWARE_FILE CONFIG_GRI_QUALIFICATION_OTA_PAL_FIRMWARE_FILE
185-
186-
/**
187-
* @brief Some boards OTA PAL layers will use the file names passed into it for the
188-
* image and the certificates because their non-volatile memory is abstracted by a
189-
* file system. Set this to 1 if that is the case for your device.
190-
*/
191-
#define OTA_PAL_USE_FILE_SYSTEM QUALIFICATION_OTA_PAL_USE_FILE_SYSTEM_SETTING
152+
#define PKCS11_TEST_RSA_KEY_SUPPORT ( 1 )
153+
#define PKCS11_TEST_EC_KEY_SUPPORT ( 0 )
154+
#define PKCS11_TEST_IMPORT_PRIVATE_KEY_SUPPORT ( 1 )
155+
#define PKCS11_TEST_GENERATE_KEYPAIR_SUPPORT ( 0 )
156+
#define PKCS11_TEST_PREPROVISIONED_SUPPORT ( 0 )
157+
#define PKCS11_TEST_LABEL_DEVICE_PRIVATE_KEY_FOR_TLS pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS
158+
#define PKCS11_TEST_LABEL_DEVICE_PUBLIC_KEY_FOR_TLS pkcs11configLABEL_DEVICE_PUBLIC_KEY_FOR_TLS
159+
#define PKCS11_TEST_LABEL_DEVICE_CERTIFICATE_FOR_TLS pkcs11configLABEL_DEVICE_CERTIFICATE_FOR_TLS
192160

193161
/**
194162
* @brief The IoT Thing name for the device for OTA test.
195163
*
196164
* #define IOT_THING_NAME "PLACE_HOLDER"
197165
*/
198-
#define IOT_THING_NAME CONFIG_GRI_QUALIFICATION_THING_NAME
166+
#define IOT_THING_NAME CONFIG_GRI_QUALIFICATION_THING_NAME
199167

200168
/**
201-
* @brief 1 if using PKCS #11 to access the code sign certificate from NVM.
169+
* @brief Log macro for MQTT test.
202170
*/
203-
#define OTA_PAL_READ_CERTIFICATE_FROM_NVM_WITH_PKCS11 0
171+
#ifndef LogDebug
172+
#define LogDebug( x )
173+
#endif
204174

205-
/**
206-
* @brief Major version for OTA E2E test.
207-
*
208-
* #define OTA_APP_VERSION_MAJOR 0
209-
*/
210-
#define OTA_APP_VERSION_MAJOR CONFIG_GRI_QUALIFICATION_OTA_APP_VERSION_MAJOR
175+
#ifndef LogInfo
176+
#define LogInfo( x )
177+
#endif
211178

212-
/**
213-
* @brief Major version for OTA E2E test.
214-
*
215-
* #define OTA_APP_VERSION_MINOR 9
216-
*/
217-
#define OTA_APP_VERSION_MINOR CONFIG_GRI_QUALIFICATION_OTA_APP_VERSION_MINOR
179+
#ifndef LogWarn
180+
#define LogWarn( x )
181+
#endif
218182

219-
/**
220-
* @brief Major version for OTA E2E test.
221-
*
222-
* #define OTA_APP_VERSION_BUILD 1
223-
*/
224-
#define OTA_APP_VERSION_BUILD CONFIG_GRI_QUALIFICATION_OTA_APP_VERSION_BUILD
183+
#ifndef LogError
184+
#define LogError( x )
185+
#endif
225186

226-
#define OUTGOING_PUBLISH_RECORD_COUNT ( 10 )
227-
#define INCOMING_PUBLISH_RECORD_COUNT ( 10 )
187+
#define OUTGOING_PUBLISH_RECORD_COUNT ( 10 )
188+
#define INCOMING_PUBLISH_RECORD_COUNT ( 10 )
228189

229190
#endif /* TEST_PARAM_CONFIG_H */

main/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ endif()
3030
if( CONFIG_GRI_RUN_QUALIFICATION_TEST )
3131
list(APPEND MAIN_SRCS
3232
"qualification_app_main.c"
33-
"demo_tasks/ota_over_mqtt_demo/ota_over_mqtt_demo.c"
3433
"demo_tasks/sub_pub_unsub_demo/sub_pub_unsub_demo.c")
3534
endif()
3635

main/Kconfig.projbuild

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -87,33 +87,10 @@ menu "Featured FreeRTOS IoT Integration"
8787
int "Port for Echo Server to use"
8888
default 9000
8989

90-
config GRI_QUALIFICATION_OTA_PAL_CERTIFICATE_FILE
91-
string "Path to cert for OTA PAL Test."
92-
default ""
93-
94-
config GRI_QUALIFICATION_OTA_PAL_FIRMWARE_FILE
95-
string "Path to store firmware for OTA PAL Test."
96-
default "/"
97-
98-
config GRI_QUALIFICATION_OTA_PAL_USE_FILE_SYSTEM
99-
bool "Use File System for OTA PAL Test."
100-
default n
101-
10290
config GRI_QUALIFICATION_THING_NAME
10391
string "Thing Name for Device Advisor Test/OTA end-to-end Test"
10492
default "PLACE_HOLDER"
10593

106-
config GRI_QUALIFICATION_OTA_APP_VERSION_MAJOR
107-
int "Application version major for OTA end-to-end Test."
108-
default 0
109-
110-
config GRI_QUALIFICATION_OTA_APP_VERSION_MINOR
111-
int "Application version minor for OTA end-to-end Test."
112-
default 9
113-
114-
config GRI_QUALIFICATION_OTA_APP_VERSION_BUILD
115-
int "Application version build for OTA end-to-end Test."
116-
default 0
11794
endmenu # "Qualification Parameter Configurations"
11895

11996
menu "Sub pub unsub demo configurations"

main/demo_tasks/temp_sub_pub_and_led_control_demo/hardware_drivers/app_driver.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
#include "app_driver.h"
77
#include "esp_idf_version.h"
88

9-
static const char * TAG = "app_driver";
9+
#ifdef APP_SOC_TEMP_SENSOR_SUPPORTED
10+
static const char * TAG = "app_driver";
11+
#endif
1012

1113
#define GRI_LED_GPIO CONFIG_GRI_TEMPERATURE_PUB_SUB_AND_LED_CONTROL_DEMO_LED_GPIO_NUMBER
1214

main/demo_tasks/temp_sub_pub_and_led_control_demo/hardware_drivers/app_driver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#endif
2121
/* *INDENT-ON* */
2222

23-
#include "driver/temp_sensor.h"
23+
#include "driver/temperature_sensor.h"
2424
#include "driver/gpio.h"
2525
#include "led_strip.h"
2626

main/qualification_app_main.c

Lines changed: 11 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@
4545
/* SubscribePublishUnsubscribeDemo demo includes. */
4646
#include "sub_pub_unsub_demo.h"
4747

48-
/* OTACodeSigningDemo demo includes. */
49-
#include "ota_pal.h"
50-
#include "ota_over_mqtt_demo.h"
51-
5248
/* ESP Secure Certificate Manager include. */
5349
#include "esp_secure_cert_read.h"
5450

@@ -60,46 +56,29 @@
6056
#include "test_execution_config.h"
6157
#include "qualification_test.h"
6258
#include "transport_interface_test.h"
63-
#include "ota_pal_test.h"
6459
#include "mqtt_test.h"
6560

6661
#define keyCLIENT_CERTIFICATE_PEM NULL
6762
#define keyCLIENT_PRIVATE_KEY_PEM NULL
6863

64+
/* Use ROOT CA in binary. */
65+
#ifndef ECHO_SERVER_ROOT_CA
66+
#define ECHO_SERVER_ROOT_CA NULL
67+
#endif
68+
6969
/* Global variables ***********************************************************/
7070

7171
/**
7272
* @brief Logging tag for ESP-IDF logging functions.
7373
*/
7474
static const char * TAG = "qual_main";
7575

76-
/**
77-
* @brief The AWS code signing certificate passed in from ./certs/aws_codesign.crt
78-
*/
79-
extern const char pcAwsCodeSigningCertPem[] asm ( "_binary_aws_codesign_crt_start" );
80-
8176
/**
8277
* @brief The AWS RootCA1 passed in from ./certs/root_cert_auth.pem
8378
*/
8479
extern const uint8_t root_cert_auth_crt_start[] asm ( "_binary_root_cert_auth_crt_start" );
8580
extern const uint8_t root_cert_auth_crt_end[] asm ( "_binary_root_cert_auth_crt_end" );
8681

87-
/**
88-
* @brief The code signing certificate from
89-
* components/FreeRTOS-Libraries-Integration-Tests/FreeRTOS-Libraries-Integration-Tests/src/ota/test_files/ecdsa-sha256-signer.crt.pem.test
90-
*/
91-
const char pcOtaPalTestCodeSigningCertPem[] = \
92-
"-----BEGIN CERTIFICATE-----\n" \
93-
"MIIBXDCCAQOgAwIBAgIJAPMhJT8l0C6AMAoGCCqGSM49BAMCMCExHzAdBgNVBAMM\n" \
94-
"FnRlc3Rfc2lnbmVyQGFtYXpvbi5jb20wHhcNMTgwNjI3MjAwNDQyWhcNMTkwNjI3\n" \
95-
"MjAwNDQyWjAhMR8wHQYDVQQDDBZ0ZXN0X3NpZ25lckBhbWF6b24uY29tMFkwEwYH\n" \
96-
"KoZIzj0CAQYIKoZIzj0DAQcDQgAEyza/tGLVbVxhL41iYtC8D6tGEvAHu498gNtq\n" \
97-
"DtPsKaoR3t5xQx+6zdWiCi32fgFT2vkeVAmX3pf/Gl8nIP48ZqMkMCIwCwYDVR0P\n" \
98-
"BAQDAgeAMBMGA1UdJQQMMAoGCCsGAQUFBwMDMAoGCCqGSM49BAMCA0cAMEQCIDkf\n" \
99-
"83Oq8sOXhSyJCWAN63gc4vp9//RFCXh/hUXPYcTWAiBgmQ5JV2MZH01Upi2lMflN\n" \
100-
"YLbC+lYscwcSlB2tECUbJA==\n" \
101-
"-----END CERTIFICATE-----\n";
102-
10382
/**
10483
* @brief Socket send and receive timeouts to use. Specified in milliseconds.
10584
*/
@@ -155,7 +134,7 @@ static BaseType_t prvInitializeNetworkContext( char * pcServerName,
155134
/*-----------------------------------------------------------*/
156135

157136
#if ( MQTT_TEST_ENABLED == 1 ) || ( TRANSPORT_INTERFACE_TEST_ENABLED == 1 ) || \
158-
( DEVICE_ADVISOR_TEST_ENABLED == 1 ) || ( OTA_E2E_TEST_ENABLED == 1 )
137+
( DEVICE_ADVISOR_TEST_ENABLED == 1 )
159138
static NetworkContext_t xNetworkContext = { 0 };
160139

161140
static BaseType_t prvInitializeNetworkContext( char * pcServerName,
@@ -384,7 +363,7 @@ static BaseType_t prvInitializeNetworkContext( char * pcServerName,
384363
return xRet;
385364
}
386365
#endif /* ( MQTT_TEST_ENABLED == 1 ) || ( TRANSPORT_INTERFACE_TEST_ENABLED == 1 ) ||
387-
* ( DEVICE_ADVISOR_TEST_ENABLED == 1 ) || ( OTA_E2E_TEST_ENABLED == 1 ) */
366+
* ( DEVICE_ADVISOR_TEST_ENABLED == 1 ) */
388367
/*-----------------------------------------------------------*/
389368

390369
uint32_t MqttTestGetTimeMs( void )
@@ -445,12 +424,6 @@ uint32_t MqttTestGetTimeMs( void )
445424
}
446425
#endif /* if ( TRANSPORT_INTERFACE_TEST_ENABLED == 1 ) */
447426

448-
#if ( OTA_PAL_TEST_ENABLED == 1 )
449-
void SetupOtaPalTestParam( OtaPalTestParam_t * pTestParam )
450-
{
451-
pTestParam->pageSize = 1 << otaconfigLOG2_FILE_BLOCK_SIZE;
452-
}
453-
#endif /* if ( OTA_PAL_TEST_ENABLED == 1 ) */
454427
/*-----------------------------------------------------------*/
455428

456429
void runQualification( void * pvArgs )
@@ -478,9 +451,9 @@ BaseType_t xQualificationStart( void )
478451

479452
ESP_LOGE( TAG, "Run xQualificationStart" );
480453

481-
#if ( MQTT_TEST_ENABLED == 1 ) || ( DEVICE_ADVISOR_TEST_ENABLED == 1 ) || ( OTA_E2E_TEST_ENABLED == 1 )
454+
#if ( MQTT_TEST_ENABLED == 1 ) || ( DEVICE_ADVISOR_TEST_ENABLED == 1 )
482455
prvInitializeNetworkContext( MQTT_SERVER_ENDPOINT, MQTT_SERVER_PORT, NULL, keyCLIENT_CERTIFICATE_PEM, keyCLIENT_PRIVATE_KEY_PEM );
483-
#endif /* ( MQTT_TEST_ENABLED == 1 ) || ( DEVICE_ADVISOR_TEST_ENABLED == 1 ) || ( OTA_E2E_TEST_ENABLED == 1 ) */
456+
#endif /* ( MQTT_TEST_ENABLED == 1 ) || ( DEVICE_ADVISOR_TEST_ENABLED == 1 ) */
484457

485458
#if ( TRANSPORT_INTERFACE_TEST_ENABLED == 1 )
486459
#if defined( TRANSPORT_CLIENT_PRIVATE_KEY )
@@ -497,7 +470,7 @@ BaseType_t xQualificationStart( void )
497470
}
498471
#endif /* ( DEVICE_ADVISOR_TEST_ENABLED == 1 ) */
499472

500-
#if ( DEVICE_ADVISOR_TEST_ENABLED == 1 ) || ( OTA_E2E_TEST_ENABLED == 1 )
473+
#if ( DEVICE_ADVISOR_TEST_ENABLED == 1 )
501474
if( xRet == pdPASS )
502475
{
503476
xRet = xCoreMqttAgentManagerStart( &xNetworkContext );
@@ -510,55 +483,7 @@ BaseType_t xQualificationStart( void )
510483
configASSERT( xRet == pdPASS );
511484
}
512485
}
513-
#endif /* ( DEVICE_ADVISOR_TEST_ENABLED == 1 ) || ( OTA_E2E_TEST_ENABLED == 1 ) */
514-
515-
#if ( OTA_E2E_TEST_ENABLED == 1 )
516-
if( xRet == pdPASS )
517-
{
518-
#if CONFIG_GRI_OUTPUT_CERTS_KEYS
519-
ESP_LOGI( TAG, "\nCS Cert: \nLength: %d\n%s",
520-
strlen( pcAwsCodeSigningCertPem ),
521-
pcAwsCodeSigningCertPem );
522-
#endif /* CONFIG_GRI_OUTPUT_CERTS_KEYS */
523-
524-
if( otaPal_SetCodeSigningCertificate( pcAwsCodeSigningCertPem ) )
525-
{
526-
vStartOTACodeSigningDemo();
527-
}
528-
else
529-
{
530-
ESP_LOGE( TAG,
531-
"Failed to set the code signing certificate for the AWS OTA "
532-
"library. OTA demo will not be started." );
533-
534-
configASSERT( 0 );
535-
}
536-
}
537-
#endif /* OTA_E2E_TEST_ENABLED == 1 */
538-
539-
#if ( OTA_PAL_TEST_ENABLED == 1 )
540-
if( xRet == pdPASS )
541-
{
542-
#if CONFIG_GRI_OUTPUT_CERTS_KEYS
543-
ESP_LOGI( TAG, "\nCS Cert: \nLength: %d\n%s",
544-
strlen( pcOtaPalTestCodeSigningCertPem ),
545-
pcOtaPalTestCodeSigningCertPem );
546-
#endif /* CONFIG_GRI_OUTPUT_CERTS_KEYS */
547-
548-
if( otaPal_SetCodeSigningCertificate( pcOtaPalTestCodeSigningCertPem ) )
549-
{
550-
/* No need to enable OTA task for OTA PAL test. */
551-
}
552-
else
553-
{
554-
ESP_LOGE( TAG,
555-
"Failed to set the code signing certificate for the AWS OTA "
556-
"library. OTA demo will not be started." );
557-
558-
configASSERT( 0 );
559-
}
560-
}
561-
#endif /* OTA_E2E_TEST_ENABLED == 1 */
486+
#endif /* ( DEVICE_ADVISOR_TEST_ENABLED == 1 ) */
562487

563488
if( ( xRet = xTaskCreate( runQualification,
564489
"QualTask",
@@ -583,11 +508,3 @@ BaseType_t xQualificationStart( void )
583508
}
584509
#endif /* DEVICE_ADVISOR_TEST_ENABLED == 1 */
585510
/*-----------------------------------------------------------*/
586-
587-
#if ( OTA_E2E_TEST_ENABLED == 1 )
588-
int RunOtaE2eDemo( void )
589-
{
590-
return 0;
591-
}
592-
#endif /* ( OTA_E2E_TEST_ENABLED == 1) */
593-
/*-----------------------------------------------------------*/

sdkconfig.defaults

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,9 @@ CONFIG_MBEDTLS_TLS_SERVER=n
5656
CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS=n
5757
CONFIG_MBEDTLS_TLS_CLIENT=y
5858
CONFIG_MBEDTLS_TLS_ENABLED=y
59+
60+
61+
#
62+
# Unity unit testing library
63+
#
64+
CONFIG_UNITY_ENABLE_FIXTURE=y

0 commit comments

Comments
 (0)