forked from espressif/esp-protocols
CI: fixing the files to be complient with pre-commit hooks
This commit is contained in:
1 parent
9d45d505d5
commit
945bd17701
205 files changed
+3128
-3439
No files matched your search
@@ -1,3 +1,8 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
#define CATCH_CONFIG_MAIN // This tells the catch header to generate a main
|
||||
#include <memory>
|
||||
#include <future>
|
||||
@@ -7,7 +12,8 @@
|
||||
|
||||
using namespace esp_modem;
|
||||
|
||||
TEST_CASE("DTE command races", "[esp_modem]") {
|
||||
TEST_CASE("DTE command races", "[esp_modem]")
|
||||
{
|
||||
auto term = std::make_unique<LoopbackTerm>(true);
|
||||
auto loopback = term.get();
|
||||
auto dte = std::make_shared<DTE>(std::move(term));
|
||||
@@ -19,7 +25,7 @@ TEST_CASE("DTE command races", "[esp_modem]") {
|
||||
uint8_t resp[] = {'O', 'K', '\n'};
|
||||
// run many commands in succession with the timeout set exactly to the timespan of injected reply
|
||||
// (checks for potential exception, data races, recycled local variables, etc.)
|
||||
for (int i=0; i<1000; ++i) {
|
||||
for (int i = 0; i < 1000; ++i) {
|
||||
loopback->inject(&resp[0], sizeof(resp), sizeof(resp), /* 1ms before injecting reply */1, 0);
|
||||
auto ret = dce->command("AT\n", [&](uint8_t *data, size_t len) {
|
||||
return command_result::OK;
|
||||
@@ -229,13 +235,13 @@ TEST_CASE("Test CMUX protocol by injecting payloads", "[esp_modem]")
|
||||
long_payload[450] = '\n';
|
||||
long_payload[451] = 0x53; // footer
|
||||
long_payload[452] = 0xf9;
|
||||
for (int i=0; i<5; ++i) {
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
// inject the whole payload (i=0) and then per 1,2,3,4 bytes (i)
|
||||
loopback->inject(&long_payload[0], sizeof(long_payload), i==0?sizeof(long_payload):i);
|
||||
loopback->inject(&long_payload[0], sizeof(long_payload), i == 0 ? sizeof(long_payload) : i);
|
||||
auto ret = dce->command("ignore", [&](uint8_t *data, size_t len) {
|
||||
CHECK(data[0] == 0x7e);
|
||||
CHECK(data[len-2] == 0x7e);
|
||||
CHECK(data[len-1] == '\n');
|
||||
CHECK(data[len - 2] == 0x7e);
|
||||
CHECK(data[len - 1] == '\n');
|
||||
return command_result::OK;
|
||||
}, 1000);
|
||||
CHECK(ret == command_result::OK);
|
||||
|
||||
Reference in new issue
Block a user