feat(unity): upgrade to 2.6.0-RC1

This commit is contained in:
Ivan Grokhotkov 2023-11-27 14:21:49 +01:00
parent 4b0da52aa8
commit 88fa79fcc7
No known key found for this signature in database
GPG Key ID: 1E050E141B280628
13 changed files with 78 additions and 16 deletions

4
.gitmodules vendored
View File

@ -81,11 +81,11 @@
[submodule "components/unity/unity"]
path = components/unity/unity
url = ../../ThrowTheSwitch/Unity.git
sbom-version = v2.4.3-51-g7d2bf62b7e6a
sbom-version = v2.6.0-RC1
sbom-supplier = Organization: ThrowTheSwitch community <http://www.throwtheswitch.org>
sbom-url = https://github.com/ThrowTheSwitch/Unity
sbom-description = Simple Unit Testing for C
sbom-hash = 7d2bf62b7e6afaf38153041a9d53c21aeeca9a25
sbom-hash = bf560290f6020737eafaa8b5cbd2177c3956c03f
[submodule "components/bt/host/nimble/nimble"]
path = components/bt/host/nimble/nimble

View File

@ -303,7 +303,7 @@ TEST_CASE("ethernet io speed/duplex/autonegotiation", "[ethernet]")
static SemaphoreHandle_t loopback_test_case_data_received;
static esp_err_t loopback_test_case_incoming_handler(esp_eth_handle_t eth_handle, uint8_t *buffer, uint32_t length, void *priv)
{
TEST_ASSERT(memcmp(priv, buffer, LOOPBACK_TEST_PACKET_SIZE) == 0)
TEST_ASSERT(memcmp(priv, buffer, LOOPBACK_TEST_PACKET_SIZE) == 0);
xSemaphoreGive(loopback_test_case_data_received);
free(buffer);
return ESP_OK;

View File

@ -92,7 +92,7 @@ httpd_handle_t test_httpd_start(uint16_t id)
config.max_uri_handlers = HTTPD_TEST_MAX_URI_HANDLERS;
config.server_port += id;
config.ctrl_port += id;
TEST_ASSERT(httpd_start(&hd, &config) == ESP_OK)
TEST_ASSERT(httpd_start(&hd, &config) == ESP_OK);
return hd;
}

View File

@ -184,7 +184,7 @@ TEST_CASE("Test FreeRTOS static task allocation", "[freertos]")
(StaticTask_t *)&task_buffer, core);
vTaskDelay(5); //Allow for static task to run, delete, and idle to clean up
TEST_ASSERT_NOT_EQUAL(NULL, handle); //Check static task was successfully allocated
TEST_ASSERT_TRUE(has_run[core]) //Check static task has run
TEST_ASSERT_TRUE(has_run[core]); //Check static task has run
}
}

View File

@ -77,7 +77,7 @@ TEST_CASE("Test FreeRTOS Queue Registry", "[freertos]")
}
for(int i = 0; i < NO_OF_QUEUES_TOTAL; i++){
const char *addr = pcQueueGetName(handles[i]);
TEST_ASSERT(addr == names[i]) //Check vQueueAddToRegistry was successful
TEST_ASSERT(addr == names[i]); //Check vQueueAddToRegistry was successful
}
portDISABLE_INTERRUPTS();
@ -90,7 +90,7 @@ TEST_CASE("Test FreeRTOS Queue Registry", "[freertos]")
}
for(int i = 0; i < NO_OF_QUEUES_TOTAL; i++){
const char *addr = pcQueueGetName(handles[i]);
TEST_ASSERT(addr == NULL) //Check vQueueUnregisterQueue was successful
TEST_ASSERT(addr == NULL); //Check vQueueUnregisterQueue was successful
handles[i] = NULL;
}

View File

@ -47,13 +47,13 @@ void task_test_trace_utilities(void *arg)
//Tests on this core
TEST_ASSERT(uxTaskGetTaskNumber(task_handles[core]) == (0x0F << (core)));
TEST_ASSERT(uxQueueGetQueueNumber(test_queues[core]) == (0x0F << (core)));
TEST_ASSERT(ucQueueGetQueueType(test_queues[core]) == BIN_SEM_QUEUE_TYPE)
TEST_ASSERT(ucQueueGetQueueType(test_queues[core]) == BIN_SEM_QUEUE_TYPE);
//Test on other core
#ifndef CONFIG_FREERTOS_UNICORE
TEST_ASSERT(uxTaskGetTaskNumber(task_handles[!core]) == (0x0F << (!core)));
TEST_ASSERT(uxQueueGetQueueNumber(test_queues[!core]) == (0x0F << (!core)));
TEST_ASSERT(ucQueueGetQueueType(test_queues[!core]) == BIN_SEM_QUEUE_TYPE)
TEST_ASSERT(ucQueueGetQueueType(test_queues[!core]) == BIN_SEM_QUEUE_TYPE);
#endif
xSemaphoreGive(test_queues[core]); //Signal done

View File

@ -1,7 +1,9 @@
idf_build_get_property(target IDF_TARGET)
set(srcs
"unity/src/unity.c")
"unity/src/unity.c"
"unity_compat.c"
)
set(includes
"include"

View File

@ -7,6 +7,7 @@
#include <esp_err.h>
#include <stddef.h>
#include <math.h>
#include "sdkconfig.h"
#ifdef CONFIG_UNITY_ENABLE_FLOAT
@ -29,6 +30,18 @@
#define UNITY_OUTPUT_COLOR
#endif
#ifndef __cplusplus
#define UNITY_IS_NAN isnan
#define UNITY_IS_INF isinf
#else
#define UNITY_IS_NAN std::isnan
#define UNITY_IS_INF std::isinf
#endif
// Note, using __noreturn__ rather than noreturn
// https://github.com/espressif/esp-idf/issues/11339
#define UNITY_NORETURN __attribute__((__noreturn__))
#define UNITY_EXCLUDE_TIME_H
void unity_flush(void);
@ -51,6 +64,10 @@ uint32_t unity_exec_time_get_ms(void);
#endif //CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER
#ifdef CONFIG_UNITY_ENABLE_FIXTURE
// Two separate "extras" options here:
// 1. Disable memory allocation wrappers in Unity Fixture
#define UNITY_FIXTURE_NO_EXTRAS
// 2. Add IDF-specific additions to Unity Fixture
#include "unity_fixture_extras.h"
#endif // CONFIG_UNITY_ENABLE_FIXTURE

@ -1 +1 @@
Subproject commit 7d2bf62b7e6afaf38153041a9d53c21aeeca9a25
Subproject commit bf560290f6020737eafaa8b5cbd2177c3956c03f

View File

@ -0,0 +1,28 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "unity.h"
// Unity 2.6.0 has removed weak definitions of setUp, tearDown, suiteSetUp and suiteTearDown.
// (https://github.com/ThrowTheSwitch/Unity/pull/454)
// We need to provide them here to avoid breaking the existing test applications.
__attribute__((weak)) void setUp(void)
{
}
__attribute__((weak)) void tearDown(void)
{
}
__attribute__((weak)) void suiteSetUp(void)
{
}
__attribute__((weak)) int suiteTearDown(int num_failures)
{
return num_failures;
}

View File

@ -162,7 +162,7 @@ TEST_CASE("Test SAE functionality with ECC group", "[wpa3_sae]")
TEST_ASSERT(sae.tmp->sae_rand != NULL);
TEST_ASSERT(mask != NULL);
TEST_ASSERT(crypto_bignum_add(sae.tmp->sae_rand, mask, sae.tmp->own_commit_scalar) == 0)
TEST_ASSERT(crypto_bignum_add(sae.tmp->sae_rand, mask, sae.tmp->own_commit_scalar) == 0);
TEST_ASSERT(crypto_bignum_mod(sae.tmp->own_commit_scalar, sae.tmp->order, sae.tmp->own_commit_scalar) == 0);
TEST_ASSERT(crypto_ec_point_mul(sae.tmp->ec, sae.tmp->pwe_ecc, mask, sae.tmp->own_commit_element_ecc) == 0);
TEST_ASSERT(crypto_ec_point_invert(sae.tmp->ec, sae.tmp->own_commit_element_ecc) == 0);
@ -176,7 +176,7 @@ TEST_CASE("Test SAE functionality with ECC group", "[wpa3_sae]")
TEST_ASSERT(os_memcmp(wpabuf_head(buf), local_commit, sizeof(local_commit)) == 0);
TEST_ASSERT(sae_parse_commit(&sae, peer_commit, sizeof(peer_commit), NULL, NULL, NULL, 0) == 0);
TEST_ASSERT(sae_process_commit(&sae) == 0)
TEST_ASSERT(sae_process_commit(&sae) == 0);
ESP_LOGI("SAE TEST", "### Compare derived KCK,PMK,PMKID with predefined vectors ###");
ESP_LOG_BUFFER_HEXDUMP("SAE: Derived KCK ", sae.tmp->kck, SAE_KCK_LEN, ESP_LOG_INFO);
@ -214,7 +214,7 @@ TEST_CASE("Test SAE functionality with ECC group", "[wpa3_sae]")
ESP_LOG_BUFFER_HEXDUMP("SAE: Derived SAE: PT.y ", bin + prime_len, prime_len, ESP_LOG_INFO);
ESP_LOG_BUFFER_HEXDUMP("SAE: Predefined SAE: PT.y ", pwe_19_y, prime_len, ESP_LOG_INFO);
TEST_ASSERT(os_memcmp(pwe_19_y, bin + prime_len, prime_len) == 0)
TEST_ASSERT(os_memcmp(pwe_19_y, bin + prime_len, prime_len) == 0);
crypto_ec_point_deinit(pwe, 1);
sae_deinit_pt(pt_info);

View File

@ -71,7 +71,7 @@ These third party libraries can be included into the application (firmware) prod
* `CMock`_ Mock/stub generator for C, Copyright (c) 2007-14 Mike Karlesky, Mark VanderVoord, Greg Williams, is licensed under MIT license as described in :component_file:`LICENSE file <cmock/CMock/LICENSE.txt>`.
* `Unity`_ Simple Unit Testing library, Copyright (c) <year> 2007-23 Mike Karlesky, Mark VanderVoord, Greg Williams, is licensed under MIT license as described in :component_file:`LICENSE file <unity/unity/docs/license.txt>`.
* `Unity`_ Simple Unit Testing library, Copyright (c) 2007-23 Mike Karlesky, Mark VanderVoord, Greg Williams, is licensed under MIT license as described in :component_file:`LICENSE file <unity/unity/LICENSE.txt>`.
Documentation
-------------

View File

@ -6,4 +6,19 @@ System
Power Management
-----------------------
* ``esp_sleep_enable_ext1_wakeup_with_level_mask`` is deprecated, use ``esp_sleep_enable_ext1_wakeup_io`` and ``esp_sleep_disable_ext1_wakeup_io`` instead.
* ``esp_sleep_enable_ext1_wakeup_with_level_mask`` is deprecated, use :cpp:func:`esp_sleep_enable_ext1_wakeup_io` and :cpp:func:`esp_sleep_disable_ext1_wakeup_io` instead.
Unit Testing
-----------------------
In the past versions of Unity framework, it was possible to omit a semicolon at the end of a ``TEST_ASSERT_*`` macro statement. This is no longer the case in the newer version of Unity, used in IDF v5.3.
For example, the following code:
.. code-block:: c
TEST_ASSERT(some_func() == ESP_OK)
will now result in a compilation error. To fix this, add a semicolon at the end of the statement:
TEST_ASSERT(some_func() == ESP_OK);