mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #11894 from ARMmbed/release-candidate
Release candidate for mbed-os-5.14.2mbed-os-5.14 mbed-os-5.14.2
commit
cf4f12a123
|
@ -31,3 +31,4 @@
|
|||
^TESTS/mbed_hal/trng/pithy
|
||||
^TESTS/mbed_hal/trng/pithy
|
||||
^tools
|
||||
^UNITTESTS
|
||||
|
|
|
@ -1,13 +1,20 @@
|
|||
### Description
|
||||
<!--
|
||||
For more information on the requirements for pull requests, please see [the contributing guidelines](https://os.mbed.com/docs/mbed-os/latest/contributing/workflow.html#pull-request-types).
|
||||
-->
|
||||
### Description (*required*)
|
||||
|
||||
<!--
|
||||
Required
|
||||
Add here detailed changes summary, testing results, dependencies
|
||||
Good example: https://os.mbed.com/docs/mbed-os/latest/contributing/workflow.html (Pull request template)
|
||||
-->
|
||||
##### Summary of change (*What the change is for and why*)
|
||||
|
||||
|
||||
### Pull request type
|
||||
##### Documentation (*Details of any document updates required*)
|
||||
|
||||
----------------------------------------------------------------------------------------------------------------
|
||||
### Pull request type (*required*)
|
||||
|
||||
<!--
|
||||
Required
|
||||
|
@ -16,25 +23,44 @@
|
|||
of them would change the meaning incorrectly. The only changes to be made are to add a description text under the
|
||||
description heading and to add a 'x' to the correct box.
|
||||
-->
|
||||
[ ] Fix
|
||||
[ ] Refactor
|
||||
[ ] Target update
|
||||
[ ] Functionality change
|
||||
[ ] Docs update
|
||||
[ ] Test update
|
||||
[ ] Breaking change
|
||||
[] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
|
||||
[] Feature update (New feature / Functionality change / New API)
|
||||
[] Major update (Breaking change E.g. Return code change / API behaviour change)
|
||||
|
||||
### Reviewers
|
||||
----------------------------------------------------------------------------------------------------------------
|
||||
### Test results (*required*)
|
||||
|
||||
<!--
|
||||
Required
|
||||
For example, add test results for new target
|
||||
-->
|
||||
[] No Tests required for this change (E.g docs only update)
|
||||
[] Covered by existing mbed-os tests (Greentea or Unittest)
|
||||
[] Tests / results supplied as part of this PR
|
||||
|
||||
|
||||
----------------------------------------------------------------------------------------------------------------
|
||||
### Reviewers (*optional*)
|
||||
|
||||
<!--
|
||||
Optional
|
||||
Request additional reviewers with @username
|
||||
-->
|
||||
|
||||
### Release Notes
|
||||
----------------------------------------------------------------------------------------------------------------
|
||||
### Release Notes (*required for feature/major PRs*)
|
||||
|
||||
<!--
|
||||
Optional
|
||||
In case of breaking changes, functionality changes or refactors, please add release notes here.
|
||||
All 3 sections are compulsory for Major PR types. For Feature PRs only the summary section is required.
|
||||
This section is automatically added to release notes. Please fill in each sub-section with sufficient detail for a user.
|
||||
For more information, please see [the contributing guidelines](https://os.mbed.com/docs/mbed-os/latest/contributing/workflow.html#pull-request-types).
|
||||
-->
|
||||
|
||||
##### Summary of changes
|
||||
|
||||
##### Impact of changes
|
||||
|
||||
##### Migration actions required
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ limitations under the License.
|
|||
"""
|
||||
import time
|
||||
from mbed_host_tests import BaseHostTest
|
||||
from mbed_host_tests.host_tests_runner.host_test_default import DefaultTestSelector
|
||||
|
||||
DEFAULT_SYNC_DELAY = 4.0
|
||||
|
||||
|
@ -32,6 +31,7 @@ MSG_KEY_RESET_REASON_RAW = 'reason_raw'
|
|||
MSG_KEY_RESET_REASON = 'reason'
|
||||
MSG_KEY_DEVICE_RESET = 'reset'
|
||||
MSG_KEY_SYNC = '__sync'
|
||||
MSG_KEY_RESET_COMPLETE = 'reset_complete'
|
||||
|
||||
RESET_REASONS = {
|
||||
'POWER_ON': '0',
|
||||
|
@ -80,6 +80,7 @@ class ResetReasonTest(BaseHostTest):
|
|||
self.register_callback(MSG_KEY_RESET_REASON_RAW, self.cb_reset_reason_raw)
|
||||
self.register_callback(MSG_KEY_RESET_REASON, self.cb_reset_reason)
|
||||
self.register_callback(MSG_KEY_DEVICE_RESET, self.cb_reset_reason)
|
||||
self.register_callback(MSG_KEY_RESET_COMPLETE, self.cb_reset_reason)
|
||||
|
||||
def cb_device_ready(self, key, value, timestamp):
|
||||
"""Request a raw value of the reset_reason register.
|
||||
|
@ -142,7 +143,10 @@ class ResetReasonTest(BaseHostTest):
|
|||
__ignored_clear_ack = yield
|
||||
|
||||
# Reset the device using DAP.
|
||||
self.reset_dut(DefaultTestSelector.RESET_TYPE_SW_RST)
|
||||
self.reset()
|
||||
__ignored_reset_ack = yield # 'reset_complete'
|
||||
time.sleep(self.sync_delay)
|
||||
self.send_kv(MSG_KEY_SYNC, MSG_VALUE_DUMMY)
|
||||
reset_reason = yield
|
||||
raise_if_different(RESET_REASONS['PIN_RESET'], reset_reason, 'Wrong reset reason. ')
|
||||
self.send_kv(MSG_KEY_RESET_REASON, MSG_VALUE_RESET_REASON_CLEAR)
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "mbed_trace.h"
|
||||
|
||||
#define TRACE_GROUP "GRNT"
|
||||
|
||||
#define ETHERNET 1
|
||||
#define WIFI 2
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "unity/unity.h"
|
||||
#include "greentea-client/test_env.h"
|
||||
#include <string>
|
||||
#include "common_defines_test.h"
|
||||
|
||||
#define MAX_THREADS 5
|
||||
|
||||
|
@ -91,7 +92,7 @@ size_t download_test(NetworkInterface *interface, const unsigned char *data, siz
|
|||
break;
|
||||
}
|
||||
ThisThread::sleep_for(1000);
|
||||
printf("[NET-%d] Connection failed. Retry %d of %d\r\n", thread_id, tries, MAX_RETRIES);
|
||||
tr_info("[NET-%d] Connection failed. Retry %d of %d", thread_id, tries, MAX_RETRIES);
|
||||
}
|
||||
TEST_ASSERT_EQUAL_INT_MESSAGE(0, result, "failed to connect");
|
||||
|
||||
|
@ -109,7 +110,7 @@ size_t download_test(NetworkInterface *interface, const unsigned char *data, siz
|
|||
} else {
|
||||
TEST_ASSERT_MESSAGE(0, "wrong thread id");
|
||||
}
|
||||
printf("[NET-%d] Registered socket callback function\r\n", thread_id);
|
||||
tr_info("[NET-%d] Registered socket callback function", thread_id);
|
||||
event_fired[thread_id] = false;
|
||||
|
||||
/* setup request */
|
||||
|
@ -118,7 +119,7 @@ size_t download_test(NetworkInterface *interface, const unsigned char *data, siz
|
|||
/* construct request */
|
||||
size_t req_len = snprintf(request, REQ_BUF_SIZE - 1, req_template, dl_path, dl_host);
|
||||
request[req_len] = 0;
|
||||
printf("[NET-%d] Request header (%u): %s\r\n", thread_id, req_len, request);
|
||||
tr_info("[NET-%d] Request header (%u): %s", thread_id, req_len, request);
|
||||
|
||||
/* send request to server */
|
||||
result = tcpsocket.send(request, req_len);
|
||||
|
@ -128,7 +129,7 @@ size_t download_test(NetworkInterface *interface, const unsigned char *data, siz
|
|||
char *receive_buffer = &g_receive_buffer[thread_id * RECV_BUF_SIZE];
|
||||
|
||||
tcpsocket.set_blocking(false);
|
||||
printf("[NET-%d] Non-blocking socket mode set\r\n", thread_id);
|
||||
tr_info("[NET-%d] Non-blocking socket mode set", thread_id);
|
||||
|
||||
size_t received_bytes = 0;
|
||||
int body_index = -1;
|
||||
|
@ -164,7 +165,7 @@ size_t download_test(NetworkInterface *interface, const unsigned char *data, siz
|
|||
if (body_index < 0) {
|
||||
continue;
|
||||
} else {
|
||||
printf("[NET-%d] Found body index: %d\r\n", thread_id, body_index);
|
||||
tr_info("[NET-%d] Found body index: %d", thread_id, body_index);
|
||||
|
||||
/* remove header before comparison */
|
||||
memmove(receive_buffer, &receive_buffer[body_index + 4], result - body_index - 4);
|
||||
|
@ -184,9 +185,9 @@ size_t download_test(NetworkInterface *interface, const unsigned char *data, siz
|
|||
speed = float(received_bytes) / timer.read();
|
||||
percent = float(received_bytes) * 100 / float(data_length);
|
||||
time_left = (data_length - received_bytes) / speed;
|
||||
printf("[NET-%d] Received bytes: %u, (%.2f%%, %.2fKB/s, ETA: %02d:%02d:%02d)\r\n",
|
||||
thread_id, received_bytes, percent, speed / 1024,
|
||||
time_left / 3600, (time_left / 60) % 60, time_left % 60);
|
||||
tr_info("[NET-%d] Received bytes: %u, (%.2f%%, %.2fKB/s, ETA: %02d:%02d:%02d)",
|
||||
thread_id, received_bytes, percent, speed / 1024,
|
||||
time_left / 3600, (time_left / 60) % 60, time_left % 60);
|
||||
}
|
||||
} while ((result > 0) && (received_bytes < data_length));
|
||||
}
|
||||
|
@ -195,10 +196,10 @@ size_t download_test(NetworkInterface *interface, const unsigned char *data, siz
|
|||
|
||||
timer.stop();
|
||||
float f_received_bytes = float(received_bytes);
|
||||
printf("[NET-%d] Downloaded: %.2fKB (%.2fKB/s, %.2f secs)\r\n", thread_id,
|
||||
f_received_bytes / 1024.,
|
||||
f_received_bytes / (timer.read() * 1024.),
|
||||
timer.read());
|
||||
tr_info("[NET-%d] Downloaded: %.2fKB (%.2fKB/s, %.2f secs)", thread_id,
|
||||
f_received_bytes / 1024.,
|
||||
f_received_bytes / (timer.read() * 1024.),
|
||||
timer.read());
|
||||
|
||||
return received_bytes;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include "mbed.h"
|
||||
#include "unity/unity.h"
|
||||
#include "common_defines_test.h"
|
||||
|
||||
void file_test_write(const char *file, size_t offset, const unsigned char *data, size_t data_length, size_t block_size)
|
||||
{
|
||||
|
@ -57,8 +58,8 @@ void file_test_write(const char *file, size_t offset, const unsigned char *data,
|
|||
TEST_ASSERT_EQUAL_INT_MESSAGE(0, result, "could not close file");
|
||||
|
||||
timer.stop();
|
||||
printf("[FS] Wrote: \"%s\" %.2fKB (%.2fKB/s, %.2f secs)\r\n", file,
|
||||
float(data_length) / 1024, float(data_length) / timer.read() / 1024, timer.read());
|
||||
tr_info("[FS] Wrote: \"%s\" %.2fKB (%.2fKB/s, %.2f secs)", file,
|
||||
float(data_length) / 1024, float(data_length) / timer.read() / 1024, timer.read());
|
||||
}
|
||||
|
||||
void file_test_read(const char *file, size_t offset, const unsigned char *data, size_t data_length, size_t block_size)
|
||||
|
@ -99,7 +100,7 @@ void file_test_read(const char *file, size_t offset, const unsigned char *data,
|
|||
|
||||
free(buffer);
|
||||
|
||||
printf("[FS] Read : \"%s\" %.2fKB (%.2fKB/s, %.2f secs)\r\n", file,
|
||||
float(data_length) / 1024, float(data_length) / timer.read() / 1024, timer.read());
|
||||
tr_info("[FS] Read : \"%s\" %.2fKB (%.2fKB/s, %.2f secs)", file,
|
||||
float(data_length) / 1024, float(data_length) / timer.read() / 1024, timer.read());
|
||||
}
|
||||
|
||||
|
|
|
@ -68,12 +68,12 @@ static control_t setup_network(const size_t call_count)
|
|||
if (err == NSAPI_ERROR_OK) {
|
||||
break;
|
||||
} else {
|
||||
printf("[ERROR] Connecting to network. Retrying %d of %d.\r\n", tries, MAX_RETRIES);
|
||||
tr_error("[ERROR] Connecting to network. Retrying %d of %d.", tries, MAX_RETRIES);
|
||||
}
|
||||
}
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);
|
||||
printf("[NET] IP address is '%s'\n", interface->get_ip_address());
|
||||
printf("[NET] MAC address is '%s'\n", interface->get_mac_address());
|
||||
tr_info("[NET] IP address is '%s'", interface->get_ip_address());
|
||||
tr_info("[NET] MAC address is '%s'", interface->get_mac_address());
|
||||
return CaseNext;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,12 +68,12 @@ static control_t setup_network(const size_t call_count)
|
|||
if (err == NSAPI_ERROR_OK) {
|
||||
break;
|
||||
} else {
|
||||
printf("[ERROR] Connecting to network. Retrying %d of %d.\r\n", tries, MAX_RETRIES);
|
||||
tr_error("[ERROR] Connecting to network. Retrying %d of %d.", tries, MAX_RETRIES);
|
||||
}
|
||||
}
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);
|
||||
printf("[NET] IP address is '%s'\n", net->get_ip_address());
|
||||
printf("[NET] MAC address is '%s'\n", net->get_mac_address());
|
||||
tr_info("[NET] IP address is '%s'", net->get_ip_address());
|
||||
tr_info("[NET] MAC address is '%s'", net->get_mac_address());
|
||||
return CaseNext;
|
||||
}
|
||||
|
||||
|
|
|
@ -72,12 +72,12 @@ static control_t setup_network(const size_t call_count)
|
|||
if (err == NSAPI_ERROR_OK) {
|
||||
break;
|
||||
} else {
|
||||
printf("[ERROR] Connecting to network. Retrying %d of %d...\r\n", tries, MAX_RETRIES);
|
||||
tr_error("[ERROR] Connecting to network. Retrying %d of %d...", tries, MAX_RETRIES);
|
||||
}
|
||||
}
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);
|
||||
printf("[NET] IP address is '%s'\n", interface->get_ip_address());
|
||||
printf("[NET] MAC address is '%s'\n", interface->get_mac_address());
|
||||
tr_info("[NET] IP address is '%s'", interface->get_ip_address());
|
||||
tr_info("[NET] MAC address is '%s'", interface->get_mac_address());
|
||||
return CaseNext;
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,7 @@ void test_malloc()
|
|||
|
||||
void *bufferTest = NULL;
|
||||
TEST_ASSERT_MESSAGE(size > 0, "Size must not be zero for test");
|
||||
printf("Allocating %d bytes", (int)size);
|
||||
tr_info("Allocating %d bytes", (int)size);
|
||||
bufferTest = malloc(size);
|
||||
TEST_ASSERT(bufferTest != NULL);
|
||||
free(bufferTest);
|
||||
|
|
|
@ -143,6 +143,7 @@ void flashiap_cross_sector_program_test()
|
|||
TEST_ASSERT_EQUAL_INT32(0, ret);
|
||||
|
||||
uint32_t page_size = flash_device.get_page_size();
|
||||
uint8_t erase_value = flash_device.get_erase_value();
|
||||
|
||||
// Erase last two sectors
|
||||
uint32_t address = flash_device.get_flash_start() + flash_device.get_flash_size();
|
||||
|
@ -170,7 +171,7 @@ void flashiap_cross_sector_program_test()
|
|||
data[i] = rand() % 256;
|
||||
}
|
||||
for (uint32_t i = prog_size; i < aligned_prog_size; i++) {
|
||||
data[i] = 0xFF;
|
||||
data[i] = erase_value;
|
||||
}
|
||||
|
||||
ret = flash_device.program(data, address, prog_size);
|
||||
|
|
|
@ -23,4 +23,6 @@
|
|||
#define QSPI_SECTOR_COUNT 1024 // for MX25R3235F
|
||||
#endif
|
||||
|
||||
#define QSPI_MIN_FREQUENCY 2000000
|
||||
|
||||
#endif // MBED_QSPI_FLASH_CONFIG_H
|
||||
|
|
|
@ -82,7 +82,7 @@
|
|||
#include "S25FL512S_config.h"
|
||||
|
||||
#elif defined(TARGET_CYW9P62S1_43012EVB_01)
|
||||
#include "S25FS128S_config.h"
|
||||
#include "S25FS512S_config.h"
|
||||
|
||||
#elif defined(TARGET_CY8CPROTO_064_SB)
|
||||
#include "S25FL128S_config.h"
|
||||
|
|
|
@ -42,7 +42,9 @@ using namespace utest::v1;
|
|||
|
||||
|
||||
|
||||
#ifndef QSPI_MIN_FREQUENCY
|
||||
#define QSPI_MIN_FREQUENCY 1000000
|
||||
#endif
|
||||
|
||||
// max write size is usually page size
|
||||
#define DATA_SIZE_256 (QSPI_PAGE_SIZE)
|
||||
|
@ -82,6 +84,7 @@ static uint32_t gen_flash_address()
|
|||
{
|
||||
srand(ticker_read(get_us_ticker_data()));
|
||||
uint32_t address = (((uint32_t)rand()) % QSPI_SECTOR_COUNT) * QSPI_SECTOR_SIZE;
|
||||
address &= 0xFFFFFF; // Ensure address is within 24 bits so as to not have to deal with 4-byte addressing
|
||||
return address;
|
||||
}
|
||||
|
||||
|
@ -344,18 +347,17 @@ void qspi_frequency_test(void)
|
|||
ret = qspi_init(&qspi.handle, QPIN_0, QPIN_1, QPIN_2, QPIN_3, QSCK, QCSN, freq, 0);
|
||||
TEST_ASSERT_EQUAL(QSPI_STATUS_OK, ret);
|
||||
|
||||
do {
|
||||
while (ret == QSPI_STATUS_OK && freq >= QSPI_MIN_FREQUENCY) {
|
||||
// check if the memory is working properly
|
||||
qspi.cmd.configure(MODE_1_1_1, ADDR_SIZE_24, ALT_SIZE_8);
|
||||
|
||||
ret = qspi_frequency(&qspi.handle, freq);
|
||||
flash_init(qspi);
|
||||
_qspi_write_read_test(qspi, WRITE_1_1_1, ADDR_SIZE_24, ALT_SIZE_8, WRITE_SINGLE, READ_1_1_1, ADDR_SIZE_24, ALT_SIZE_8, READ_SINGLE, TEST_REPEAT_SINGLE, DATA_SIZE_256, TEST_FLASH_ADDRESS);
|
||||
|
||||
utest_printf("frequency setting %d [Hz] - OK\r\n", freq);
|
||||
|
||||
freq /= 2;
|
||||
ret = qspi_frequency(&qspi.handle, freq);
|
||||
} while (ret == QSPI_STATUS_OK && freq >= QSPI_MIN_FREQUENCY);
|
||||
}
|
||||
|
||||
qspi_free(&qspi.handle);
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ void QspiCommand::set_dummy_cycles(int dummy_cycles)
|
|||
|
||||
void QspiCommand::build(int instruction, int address, int alt)
|
||||
{
|
||||
_cmd.instruction.disabled = (instruction == QSPI_NONE);
|
||||
_cmd.instruction.disabled = (instruction == QSPI_NO_INST);
|
||||
if (!_cmd.instruction.disabled) {
|
||||
_cmd.instruction.value = instruction;
|
||||
}
|
||||
|
@ -127,17 +127,33 @@ void flash_init(Qspi &qspi)
|
|||
ret = qspi_command_transfer(&qspi.handle, qspi.cmd.get(), NULL, 0, status, QSPI_STATUS_REG_SIZE);
|
||||
TEST_ASSERT_EQUAL(QSPI_STATUS_OK, ret);
|
||||
|
||||
qspi.cmd.build(QSPI_CMD_RSTEN);
|
||||
ret = qspi_command_transfer(&qspi.handle, qspi.cmd.get(), NULL, 0, NULL, 0);
|
||||
TEST_ASSERT_EQUAL(QSPI_STATUS_OK, ret);
|
||||
// Only do reset enable if device needs it
|
||||
if (QSPI_CMD_RSTEN != 0) {
|
||||
qspi.cmd.build(QSPI_CMD_RSTEN);
|
||||
ret = qspi_command_transfer(&qspi.handle, qspi.cmd.get(), NULL, 0, NULL, 0);
|
||||
TEST_ASSERT_EQUAL(QSPI_STATUS_OK, ret);
|
||||
|
||||
WAIT_FOR(WRSR_MAX_TIME, qspi);
|
||||
WAIT_FOR(WRSR_MAX_TIME, qspi);
|
||||
}
|
||||
|
||||
qspi.cmd.build(QSPI_CMD_RST);
|
||||
ret = qspi_command_transfer(&qspi.handle, qspi.cmd.get(), NULL, 0, NULL, 0);
|
||||
TEST_ASSERT_EQUAL(QSPI_STATUS_OK, ret);
|
||||
|
||||
WAIT_FOR(WAIT_MAX_TIME, qspi);
|
||||
|
||||
// Zero out status register to attempt to clear block protection bits
|
||||
uint8_t blanks[QSPI_STATUS_REG_SIZE] = {0};
|
||||
|
||||
qspi.cmd.build(QSPI_CMD_WREN);
|
||||
ret = qspi_command_transfer(&qspi.handle, qspi.cmd.get(), NULL, 0, NULL, 0);
|
||||
TEST_ASSERT_EQUAL(QSPI_STATUS_OK, ret);
|
||||
|
||||
qspi.cmd.build(QSPI_CMD_WRSR);
|
||||
ret = qspi_command_transfer(&qspi.handle, qspi.cmd.get(), blanks, 1, NULL, 0);
|
||||
TEST_ASSERT_EQUAL(QSPI_STATUS_OK, ret);
|
||||
|
||||
WAIT_FOR(WRSR_MAX_TIME, qspi);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -102,10 +102,10 @@ struct Qspi {
|
|||
#define ADDR_SIZE_24 QSPI_CFG_ADDR_SIZE_24
|
||||
#define ADDR_SIZE_32 QSPI_CFG_ADDR_SIZE_32
|
||||
|
||||
#define ALT_SIZE_8 8u
|
||||
#define ALT_SIZE_16 16u
|
||||
#define ALT_SIZE_24 24u
|
||||
#define ALT_SIZE_32 32u
|
||||
#define ALT_SIZE_8 QSPI_CFG_ALT_SIZE_8
|
||||
#define ALT_SIZE_16 QSPI_CFG_ALT_SIZE_16
|
||||
#define ALT_SIZE_24 QSPI_CFG_ALT_SIZE_24
|
||||
#define ALT_SIZE_32 QSPI_CFG_ALT_SIZE_32
|
||||
|
||||
#define STATUS_REG QSPI_CMD_RDSR
|
||||
#define CONFIG_REG0 QSPI_CMD_RDCR0
|
||||
|
|
|
@ -437,11 +437,11 @@ void i2c_test_byte_read(PinName sda, PinName scl)
|
|||
}
|
||||
|
||||
Case cases[] = {
|
||||
Case("i2c - init/free test all pins", all_ports<I2CPort, DefaultFormFactor, test_i2c_init_free>),
|
||||
Case("i2c - test write i2c API", all_peripherals<I2CPort, DefaultFormFactor, i2c_test_write>),
|
||||
Case("i2c - test read i2c API", all_peripherals<I2CPort, DefaultFormFactor, i2c_test_read>),
|
||||
Case("i2c - test single byte write i2c API", all_peripherals<I2CPort, DefaultFormFactor, i2c_test_byte_write>),
|
||||
Case("i2c - test single byte read i2c API", all_peripherals<I2CPort, DefaultFormFactor, i2c_test_byte_read>)
|
||||
Case("i2c - init/free test all pins", one_peripheral<I2CPort, DefaultFormFactor, test_i2c_init_free>),
|
||||
Case("i2c - test write i2c API", one_peripheral<I2CPort, DefaultFormFactor, i2c_test_write>),
|
||||
Case("i2c - test read i2c API", one_peripheral<I2CPort, DefaultFormFactor, i2c_test_read>),
|
||||
Case("i2c - test single byte write i2c API", one_peripheral<I2CPort, DefaultFormFactor, i2c_test_byte_write>),
|
||||
Case("i2c - test single byte read i2c API", one_peripheral<I2CPort, DefaultFormFactor, i2c_test_byte_read>)
|
||||
};
|
||||
|
||||
utest::v1::status_t greentea_test_setup(const size_t number_of_cases)
|
||||
|
|
|
@ -404,6 +404,21 @@ static control_t test_printf_x(const size_t call_count)
|
|||
return CaseNext;
|
||||
}
|
||||
|
||||
static control_t test_printf_percent(const size_t call_count)
|
||||
{
|
||||
int result_baseline;
|
||||
int result_minimal;
|
||||
int result_file;
|
||||
|
||||
result_minimal = mbed_printf("%% \r\n");
|
||||
result_file = mbed_fprintf(stderr, "%% \r\n");
|
||||
result_baseline = printf("%% \r\n");
|
||||
TEST_ASSERT_EQUAL_INT(result_baseline, result_minimal);
|
||||
TEST_ASSERT_EQUAL_INT(result_baseline, result_file);
|
||||
|
||||
return CaseNext;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* */
|
||||
/* SNPRINTF */
|
||||
|
@ -721,6 +736,34 @@ static control_t test_snprintf_x(const size_t call_count)
|
|||
return CaseNext;
|
||||
}
|
||||
|
||||
static control_t test_snprintf_percent(const size_t call_count)
|
||||
{
|
||||
char buffer_baseline[100];
|
||||
char buffer_minimal[100];
|
||||
int result_baseline;
|
||||
int result_minimal;
|
||||
|
||||
result_minimal = mbed_snprintf(buffer_minimal, sizeof(buffer_minimal), "%% \r\n");
|
||||
result_baseline = snprintf(buffer_baseline, sizeof(buffer_baseline), "%% \r\n");
|
||||
TEST_ASSERT_EQUAL_STRING(buffer_baseline, buffer_minimal);
|
||||
TEST_ASSERT_EQUAL_INT(result_baseline, result_minimal);
|
||||
|
||||
return CaseNext;
|
||||
}
|
||||
|
||||
static control_t test_snprintf_unsupported_specifier(const size_t call_count)
|
||||
{
|
||||
char buffer_minimal[100];
|
||||
|
||||
TEST_ASSERT_NOT_EQUAL(
|
||||
0,
|
||||
mbed_snprintf(buffer_minimal, sizeof(buffer_minimal), "%a \r\n", 5)
|
||||
);
|
||||
TEST_ASSERT_EQUAL_STRING("%a \r\n", buffer_minimal);
|
||||
|
||||
return CaseNext;
|
||||
}
|
||||
|
||||
#if MBED_CONF_PLATFORM_MINIMAL_PRINTF_ENABLE_FLOATING_POINT
|
||||
static control_t test_printf_f(const size_t call_count)
|
||||
{
|
||||
|
@ -902,6 +945,9 @@ Case cases[] = {
|
|||
Case("snprintf %u", test_snprintf_u),
|
||||
Case("printf %x", test_printf_x),
|
||||
Case("snprintf %x", test_snprintf_x),
|
||||
Case("printf %%", test_printf_percent),
|
||||
Case("snprintf %%", test_snprintf_percent),
|
||||
Case("snprintf unsupported specifier", test_snprintf_unsupported_specifier),
|
||||
#if MBED_CONF_PLATFORM_MINIMAL_PRINTF_ENABLE_FLOATING_POINT
|
||||
Case("printf %f", test_printf_f),
|
||||
Case("snprintf %f", test_snprintf_f),
|
||||
|
|
|
@ -56,11 +56,11 @@ void ASYNCHRONOUS_DNS_CACHE()
|
|||
int delay_ms = (ticker_us - started_us) / 1000;
|
||||
|
||||
static int delay_first = delay_ms / 2;
|
||||
printf("Delays: first: %i, delay_ms: %i\n", delay_first, delay_ms);
|
||||
tr_info("Delays: first: %i, delay_ms: %i", delay_first, delay_ms);
|
||||
// Check that cached accesses are at least twice as fast as the first one
|
||||
TEST_ASSERT_TRUE(i == 0 || delay_ms <= delay_first);
|
||||
|
||||
printf("DNS: query \"%s\" => \"%s\", time %i ms\n",
|
||||
dns_test_hosts[0], data.addr.get_ip_address(), delay_ms);
|
||||
tr_info("DNS: query \"%s\" => \"%s\", time %i ms",
|
||||
dns_test_hosts[0], data.addr.get_ip_address(), delay_ms);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ void ASYNCHRONOUS_DNS_CANCEL()
|
|||
count++;
|
||||
} else {
|
||||
// No memory to initiate DNS query, callback will not be called
|
||||
printf("Error: No resources to initiate DNS query for %s\n", dns_test_hosts[i]);
|
||||
tr_error("Error: No resources to initiate DNS query for %s", dns_test_hosts[i]);
|
||||
data[i].result = data[i].req_result;
|
||||
data[i].value_set = true;
|
||||
}
|
||||
|
@ -63,21 +63,21 @@ void ASYNCHRONOUS_DNS_CANCEL()
|
|||
|
||||
for (unsigned int i = 0; i < MBED_CONF_APP_DNS_TEST_HOSTS_NUM; i++) {
|
||||
if (!data[i].value_set) {
|
||||
printf("DNS: query \"%s\" => cancel\n", dns_test_hosts[i]);
|
||||
tr_info("DNS: query \"%s\" => cancel", dns_test_hosts[i]);
|
||||
continue;
|
||||
}
|
||||
TEST_ASSERT(data[i].result == NSAPI_ERROR_OK || data[i].result == NSAPI_ERROR_NO_MEMORY || data[i].result == NSAPI_ERROR_BUSY || data[i].result == NSAPI_ERROR_DNS_FAILURE || data[i].result == NSAPI_ERROR_TIMEOUT);
|
||||
if (data[i].result == NSAPI_ERROR_OK) {
|
||||
printf("DNS: query \"%s\" => \"%s\"\n",
|
||||
dns_test_hosts[i], data[i].addr.get_ip_address());
|
||||
tr_info("DNS: query \"%s\" => \"%s\"",
|
||||
dns_test_hosts[i], data[i].addr.get_ip_address());
|
||||
} else if (data[i].result == NSAPI_ERROR_DNS_FAILURE) {
|
||||
printf("DNS: query \"%s\" => DNS failure\n", dns_test_hosts[i]);
|
||||
tr_error("DNS: query \"%s\" => DNS failure", dns_test_hosts[i]);
|
||||
} else if (data[i].result == NSAPI_ERROR_TIMEOUT) {
|
||||
printf("DNS: query \"%s\" => timeout\n", dns_test_hosts[i]);
|
||||
tr_error("DNS: query \"%s\" => timeout", dns_test_hosts[i]);
|
||||
} else if (data[i].result == NSAPI_ERROR_NO_MEMORY) {
|
||||
printf("DNS: query \"%s\" => no memory\n", dns_test_hosts[i]);
|
||||
tr_error("DNS: query \"%s\" => no memory", dns_test_hosts[i]);
|
||||
} else if (data[i].result == NSAPI_ERROR_BUSY) {
|
||||
printf("DNS: query \"%s\" => busy\n", dns_test_hosts[i]);
|
||||
tr_error("DNS: query \"%s\" => busy", dns_test_hosts[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@ void ASYNCHRONOUS_DNS_NON_ASYNC_AND_ASYNC()
|
|||
for (unsigned int i = 0; i < MBED_CONF_APP_DNS_TEST_HOSTS_NUM; i++) {
|
||||
SocketAddress addr;
|
||||
int err = get_interface()->gethostbyname(dns_test_hosts[i], &addr);
|
||||
printf("DNS: query \"%s\" => \"%s\"\n",
|
||||
dns_test_hosts[i], addr.get_ip_address());
|
||||
tr_info("DNS: query \"%s\" => \"%s\"",
|
||||
dns_test_hosts[i], addr.get_ip_address());
|
||||
|
||||
TEST_ASSERT_EQUAL(0, err);
|
||||
TEST_ASSERT((bool)addr);
|
||||
|
@ -49,8 +49,8 @@ void ASYNCHRONOUS_DNS_NON_ASYNC_AND_ASYNC()
|
|||
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, data.result);
|
||||
|
||||
printf("DNS: query \"%s\" => \"%s\"\n",
|
||||
dns_test_hosts_second[0], data.addr.get_ip_address());
|
||||
tr_info("DNS: query \"%s\" => \"%s\"",
|
||||
dns_test_hosts_second[0], data.addr.get_ip_address());
|
||||
|
||||
TEST_ASSERT(strlen(data.addr.get_ip_address()) > 1);
|
||||
}
|
||||
|
|
|
@ -18,6 +18,10 @@
|
|||
#ifndef DNS_TESTS_H
|
||||
#define DNS_TESTS_H
|
||||
|
||||
#include "mbed_trace.h"
|
||||
|
||||
#define TRACE_GROUP "GRNT"
|
||||
|
||||
#ifndef MBED_CONF_APP_DNS_SIMULT_QUERIES
|
||||
#ifdef MBED_CONF_CELLULAR_OFFLOAD_DNS_QUERIES
|
||||
#define MBED_CONF_APP_DNS_SIMULT_QUERIES MBED_CONF_CELLULAR_OFFLOAD_DNS_QUERIES
|
||||
|
|
|
@ -90,20 +90,20 @@ void do_asynchronous_gethostbyname(const char hosts[][DNS_TEST_HOST_LEN], unsign
|
|||
TEST_ASSERT(data[i].result == NSAPI_ERROR_OK || data[i].result == NSAPI_ERROR_NO_MEMORY || data[i].result == NSAPI_ERROR_BUSY || data[i].result == NSAPI_ERROR_DNS_FAILURE || data[i].result == NSAPI_ERROR_TIMEOUT);
|
||||
if (data[i].result == NSAPI_ERROR_OK) {
|
||||
(*exp_ok)++;
|
||||
printf("DNS: query \"%s\" => \"%s\"\n",
|
||||
hosts[i], data[i].addr.get_ip_address());
|
||||
tr_info("DNS: query \"%s\" => \"%s\"",
|
||||
hosts[i], data[i].addr.get_ip_address());
|
||||
} else if (data[i].result == NSAPI_ERROR_DNS_FAILURE) {
|
||||
(*exp_dns_failure)++;
|
||||
printf("DNS: query \"%s\" => DNS failure\n", hosts[i]);
|
||||
tr_error("DNS: query \"%s\" => DNS failure", hosts[i]);
|
||||
} else if (data[i].result == NSAPI_ERROR_TIMEOUT) {
|
||||
(*exp_timeout)++;
|
||||
printf("DNS: query \"%s\" => timeout\n", hosts[i]);
|
||||
tr_error("DNS: query \"%s\" => timeout", hosts[i]);
|
||||
} else if (data[i].result == NSAPI_ERROR_NO_MEMORY) {
|
||||
(*exp_no_mem)++;
|
||||
printf("DNS: query \"%s\" => no memory\n", hosts[i]);
|
||||
tr_error("DNS: query \"%s\" => no memory", hosts[i]);
|
||||
} else if (data[i].result == NSAPI_ERROR_BUSY) {
|
||||
(*exp_no_mem)++;
|
||||
printf("DNS: query \"%s\" => busy\n", hosts[i]);
|
||||
tr_error("DNS: query \"%s\" => busy", hosts[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,22 +127,22 @@ void do_gethostbyname(const char hosts[][DNS_TEST_HOST_LEN], unsigned int op_cou
|
|||
|
||||
if (err == NSAPI_ERROR_OK) {
|
||||
(*exp_ok)++;
|
||||
printf("DNS: query \"%s\" => \"%s\"\n",
|
||||
hosts[i], address.get_ip_address());
|
||||
tr_info("DNS: query \"%s\" => \"%s\"",
|
||||
hosts[i], address.get_ip_address());
|
||||
} else if (err == NSAPI_ERROR_DNS_FAILURE) {
|
||||
(*exp_dns_failure)++;
|
||||
printf("DNS: query \"%s\" => DNS failure\n", hosts[i]);
|
||||
tr_error("DNS: query \"%s\" => DNS failure", hosts[i]);
|
||||
} else if (err == NSAPI_ERROR_TIMEOUT) {
|
||||
(*exp_timeout)++;
|
||||
printf("DNS: query \"%s\" => timeout\n", hosts[i]);
|
||||
tr_error("DNS: query \"%s\" => timeout", hosts[i]);
|
||||
} else if (err == NSAPI_ERROR_NO_MEMORY) {
|
||||
(*exp_no_mem)++;
|
||||
printf("DNS: query \"%s\" => no memory\n", hosts[i]);
|
||||
tr_error("DNS: query \"%s\" => no memory", hosts[i]);
|
||||
} else if (err == NSAPI_ERROR_BUSY) {
|
||||
(*exp_no_mem)++;
|
||||
printf("DNS: query \"%s\" => busy\n", hosts[i]);
|
||||
tr_error("DNS: query \"%s\" => busy", hosts[i]);
|
||||
} else {
|
||||
printf("DNS: query \"%s\" => %d, unexpected answer\n", hosts[i], err);
|
||||
tr_error("DNS: query \"%s\" => %d, unexpected answer", hosts[i], err);
|
||||
TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_NO_MEMORY || err == NSAPI_ERROR_BUSY || err == NSAPI_ERROR_DNS_FAILURE || err == NSAPI_ERROR_TIMEOUT);
|
||||
}
|
||||
}
|
||||
|
@ -160,13 +160,13 @@ static void net_bringup()
|
|||
net = NetworkInterface::get_default_instance();
|
||||
nsapi_error_t err = net->connect();
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);
|
||||
printf("MBED: IP address is '%s'\n", net->get_ip_address() ? net->get_ip_address() : "null");
|
||||
tr_info("MBED: IP address is '%s'", net->get_ip_address() ? net->get_ip_address() : "null");
|
||||
}
|
||||
|
||||
static void net_bringdown()
|
||||
{
|
||||
NetworkInterface::get_default_instance()->disconnect();
|
||||
printf("MBED: ifdown\n");
|
||||
tr_info("MBED: ifdown");
|
||||
}
|
||||
|
||||
// Test setup
|
||||
|
|
|
@ -49,7 +49,7 @@ void SYNCHRONOUS_DNS_CACHE()
|
|||
// Check that cached accesses are at least twice as fast as the first one
|
||||
TEST_ASSERT_TRUE(i == 0 || delay_ms <= delay_first);
|
||||
|
||||
printf("DNS: query \"%s\" => \"%s\", time %i ms\n",
|
||||
dns_test_hosts[0], address.get_ip_address(), delay_ms);
|
||||
tr_info("DNS: query \"%s\" => \"%s\", time %i ms",
|
||||
dns_test_hosts[0], address.get_ip_address(), delay_ms);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,13 +72,13 @@ static void _ifup()
|
|||
NetworkInterface *net = NetworkInterface::get_default_instance();
|
||||
nsapi_error_t err = net->connect();
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);
|
||||
printf("MBED: TCPClient IP address is '%s'\n", net->get_ip_address() ? net->get_ip_address() : "null");
|
||||
tr_info("MBED: TCPClient IP address is '%s'", net->get_ip_address() ? net->get_ip_address() : "null");
|
||||
}
|
||||
|
||||
static void _ifdown()
|
||||
{
|
||||
NetworkInterface::get_default_instance()->disconnect();
|
||||
printf("MBED: ifdown\n");
|
||||
tr_info("MBED: ifdown");
|
||||
}
|
||||
|
||||
nsapi_error_t tcpsocket_connect_to_srv(TCPSocket &sock, uint16_t port)
|
||||
|
@ -88,17 +88,17 @@ nsapi_error_t tcpsocket_connect_to_srv(TCPSocket &sock, uint16_t port)
|
|||
NetworkInterface::get_default_instance()->gethostbyname(ECHO_SERVER_ADDR, &tcp_addr);
|
||||
tcp_addr.set_port(port);
|
||||
|
||||
printf("MBED: Server '%s', port %d\n", tcp_addr.get_ip_address(), tcp_addr.get_port());
|
||||
tr_info("MBED: Server '%s', port %d", tcp_addr.get_ip_address(), tcp_addr.get_port());
|
||||
|
||||
nsapi_error_t err = sock.open(NetworkInterface::get_default_instance());
|
||||
if (err != NSAPI_ERROR_OK) {
|
||||
printf("Error from sock.open: %d\n", err);
|
||||
tr_error("Error from sock.open: %d", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
err = sock.connect(tcp_addr);
|
||||
if (err != NSAPI_ERROR_OK) {
|
||||
printf("Error from sock.connect: %d\n", err);
|
||||
tr_error("Error from sock.connect: %d", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
#define TCP_TESTS_H
|
||||
|
||||
#include "../test_params.h"
|
||||
#include "mbed_trace.h"
|
||||
|
||||
#define TRACE_GROUP "GRNT"
|
||||
|
||||
NetworkInterface *get_interface();
|
||||
void drop_bad_packets(TCPSocket &sock, int orig_timeout);
|
||||
|
|
|
@ -72,11 +72,11 @@ void TCPSOCKET_ECHOTEST()
|
|||
fill_tx_buffer_ascii(tcp_global::tx_buffer, BUFF_SIZE);
|
||||
sent = sock.send(tcp_global::tx_buffer, pkt_s);
|
||||
if (sent < 0) {
|
||||
printf("[Round#%02d] network error %d\n", s_idx, sent);
|
||||
tr_error("[Round#%02d] network error %d", s_idx, sent);
|
||||
TEST_FAIL();
|
||||
break;
|
||||
} else if (sent != pkt_s) {
|
||||
printf("[%02d] sock.send return size %d does not match the expectation %d\n", s_idx, sent, pkt_s);
|
||||
tr_error("[%02d] sock.send return size %d does not match the expectation %d", s_idx, sent, pkt_s);
|
||||
TEST_FAIL();
|
||||
break;
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ void TCPSOCKET_ECHOTEST()
|
|||
while (bytes2recv) {
|
||||
recvd = sock.recv(&(tcp_global::rx_buffer[sent - bytes2recv]), bytes2recv);
|
||||
if (recvd < 0) {
|
||||
printf("[Round#%02d] network error %d\n", s_idx, recvd);
|
||||
tr_error("[Round#%02d] network error %d", s_idx, recvd);
|
||||
TEST_FAIL();
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.close());
|
||||
return;
|
||||
|
@ -110,7 +110,7 @@ void tcpsocket_echotest_nonblock_receive()
|
|||
}
|
||||
return;
|
||||
} else if (recvd < 0) {
|
||||
printf("sock.recv returned an error %d", recvd);
|
||||
tr_error("sock.recv returned an error %d", recvd);
|
||||
TEST_FAIL();
|
||||
receive_error = true;
|
||||
} else {
|
||||
|
@ -171,7 +171,7 @@ void TCPSOCKET_ECHOTEST_NONBLOCK()
|
|||
}
|
||||
continue;
|
||||
} else if (sent <= 0) {
|
||||
printf("[Sender#%02d] network error %d\n", s_idx, sent);
|
||||
tr_error("[Sender#%02d] network error %d", s_idx, sent);
|
||||
TEST_FAIL();
|
||||
goto END;
|
||||
}
|
||||
|
|
|
@ -52,11 +52,11 @@ void TCPSOCKET_ECHOTEST_BURST()
|
|||
for (int i = 0; i < BURST_CNT; i++) {
|
||||
sent = sock.send(tcp_global::tx_buffer, BURST_SIZE);
|
||||
if (sent < 0) {
|
||||
printf("[%02d] network error %d\n", i, sent);
|
||||
tr_error("[%02d] network error %d", i, sent);
|
||||
TEST_FAIL();
|
||||
break;
|
||||
} else if (sent != BURST_SIZE) {
|
||||
printf("[%02d] sock.send return size %d does not match the expectation %d\n", i, sent, BURST_SIZE);
|
||||
tr_error("[%02d] sock.send return size %d does not match the expectation %d", i, sent, BURST_SIZE);
|
||||
TEST_FAIL();
|
||||
break;
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ void TCPSOCKET_ECHOTEST_BURST()
|
|||
while (bytes2recv) {
|
||||
recvd = sock.recv(&(tcp_global::rx_buffer[sent - bytes2recv]), bytes2recv);
|
||||
if (recvd < 0) {
|
||||
printf("[Round#%02d] network error %d\n", i, recvd);
|
||||
tr_error("[Round#%02d] network error %d", i, recvd);
|
||||
TEST_FAIL();
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.close());
|
||||
return;
|
||||
|
@ -103,7 +103,7 @@ void TCPSOCKET_ECHOTEST_BURST_NONBLOCK()
|
|||
}
|
||||
continue;
|
||||
} else if (sent < 0) {
|
||||
printf("[%02d] network error %d\n", i, sent);
|
||||
tr_error("[%02d] network error %d", i, sent);
|
||||
TEST_FAIL();
|
||||
goto END;
|
||||
}
|
||||
|
@ -119,19 +119,19 @@ void TCPSOCKET_ECHOTEST_BURST_NONBLOCK()
|
|||
recvd = sock.recv(&(tcp_global::rx_buffer[BURST_SIZE - bt_left]), BURST_SIZE);
|
||||
if (recvd == NSAPI_ERROR_WOULD_BLOCK) {
|
||||
if (osSignalWait(SIGNAL_SIGIO, SIGIO_TIMEOUT).status == osEventTimeout) {
|
||||
printf("[bt#%02d] packet timeout...", i);
|
||||
tr_error("[bt#%02d] packet timeout...", i);
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
} else if (recvd < 0) {
|
||||
printf("[%02d] network error %d\n", i, recvd);
|
||||
tr_error("[%02d] network error %d", i, recvd);
|
||||
break;
|
||||
}
|
||||
bt_left -= recvd;
|
||||
}
|
||||
|
||||
if (bt_left != 0) {
|
||||
printf("network error %d, missing %d bytes from a burst\n", recvd, bt_left);
|
||||
tr_error("network error %d, missing %d bytes from a burst", recvd, bt_left);
|
||||
TEST_FAIL();
|
||||
goto END;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ void TCPSOCKET_OPEN_LIMIT()
|
|||
}
|
||||
ret = sock->open(NetworkInterface::get_default_instance());
|
||||
if (ret == NSAPI_ERROR_NO_MEMORY || ret == NSAPI_ERROR_NO_SOCKET) {
|
||||
printf("[round#%02d] unable to open new socket, error: %d\n", i, ret);
|
||||
tr_error("[round#%02d] unable to open new socket, error: %d", i, ret);
|
||||
delete sock;
|
||||
break;
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ void TCPSOCKET_OPEN_LIMIT()
|
|||
delete tmp->sock;
|
||||
delete tmp;
|
||||
}
|
||||
printf("[round#%02d] %d sockets opened\n", i, open_sockets[i]);
|
||||
tr_info("[round#%02d] %d sockets opened", i, open_sockets[i]);
|
||||
}
|
||||
TEST_ASSERT_EQUAL(open_sockets[0], open_sockets[1]);
|
||||
TEST_ASSERT(open_sockets[0] >= 4);
|
||||
|
|
|
@ -113,7 +113,7 @@ void rcv_n_chk_against_rfc864_pattern(TCPSocket &sock)
|
|||
recvd_size += rd;
|
||||
}
|
||||
timer.stop();
|
||||
printf("MBED: Time taken: %fs\n", timer.read());
|
||||
tr_info("MBED: Time taken: %fs", timer.read());
|
||||
}
|
||||
|
||||
void TCPSOCKET_RECV_100K()
|
||||
|
@ -163,7 +163,7 @@ void rcv_n_chk_against_rfc864_pattern_nonblock(TCPSocket &sock)
|
|||
}
|
||||
}
|
||||
timer.stop();
|
||||
printf("MBED: Time taken: %fs\n", timer.read());
|
||||
tr_info("MBED: Time taken: %fs", timer.read());
|
||||
}
|
||||
|
||||
static void _sigio_handler(osThreadId id)
|
||||
|
|
|
@ -68,7 +68,7 @@ void TCPSOCKET_RECV_TIMEOUT()
|
|||
goto CLEANUP;
|
||||
}
|
||||
int recv_time_ms = (timer.read_us() + 500) / 1000;
|
||||
printf("MBED: recv() took: %dus\n", recv_time_ms);
|
||||
tr_info("MBED: recv() took: %dus", recv_time_ms);
|
||||
if (recv_time_ms > 150) {
|
||||
TEST_ASSERT(150 - recv_time_ms < 51);
|
||||
} else {
|
||||
|
@ -76,7 +76,7 @@ void TCPSOCKET_RECV_TIMEOUT()
|
|||
}
|
||||
continue;
|
||||
} else if (recvd < 0) {
|
||||
printf("[pkt#%02d] network error %d\n", i, recvd);
|
||||
tr_error("[pkt#%02d] network error %d", i, recvd);
|
||||
TEST_FAIL();
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ void TCPSOCKET_SEND_TIMEOUT()
|
|||
(timer.read_ms() <= 800)) {
|
||||
continue;
|
||||
}
|
||||
printf("send: err %d, time %d", err, timer.read_ms());
|
||||
tr_error("send: err %d, time %d", err, timer.read_ms());
|
||||
TEST_FAIL();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ static void check_const_len_rand_sequence()
|
|||
}
|
||||
continue;
|
||||
} else if (sent < 0) {
|
||||
printf("network error %d\n", sent);
|
||||
tr_error("network error %d", sent);
|
||||
TEST_FAIL();
|
||||
goto END;
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ static void check_const_len_rand_sequence()
|
|||
if (recvd == NSAPI_ERROR_WOULD_BLOCK) {
|
||||
continue;
|
||||
} else if (recvd < 0) {
|
||||
printf("network error %d\n", recvd);
|
||||
tr_error("network error %d", recvd);
|
||||
TEST_FAIL();
|
||||
goto END;
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ static void check_var_len_rand_sequence()
|
|||
}
|
||||
continue;
|
||||
} else if (sent < 0) {
|
||||
printf("[%02d] network error %d\n", i, sent);
|
||||
tr_error("[%02d] network error %d", i, sent);
|
||||
TEST_FAIL();
|
||||
goto END;
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ static void check_var_len_rand_sequence()
|
|||
if (recvd == NSAPI_ERROR_WOULD_BLOCK) {
|
||||
continue;
|
||||
} else if (recvd < 0) {
|
||||
printf("[%02d] network error %d\n", i, recvd);
|
||||
tr_error("[%02d] network error %d", i, recvd);
|
||||
TEST_FAIL();
|
||||
goto END;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "utest/utest_stack_trace.h"
|
||||
#include "tls_tests.h"
|
||||
#include "cert.h"
|
||||
#include "CellularDevice.h"
|
||||
|
||||
#ifndef ECHO_SERVER_ADDR
|
||||
#error [NOT_SUPPORTED] Requires parameters for echo server
|
||||
|
@ -66,13 +67,13 @@ static void _ifup()
|
|||
NetworkInterface *net = NetworkInterface::get_default_instance();
|
||||
nsapi_error_t err = net->connect();
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);
|
||||
printf("MBED: TLSClient IP address is '%s'\n", net->get_ip_address() ? net->get_ip_address() : "null");
|
||||
tr_info("MBED: TLSClient IP address is '%s'\n", net->get_ip_address() ? net->get_ip_address() : "null");
|
||||
}
|
||||
|
||||
static void _ifdown()
|
||||
{
|
||||
NetworkInterface::get_default_instance()->disconnect();
|
||||
printf("MBED: ifdown\n");
|
||||
tr_info("MBED: ifdown\n");
|
||||
}
|
||||
|
||||
nsapi_error_t tlssocket_connect_to_srv(TLSSocket &sock, uint16_t port)
|
||||
|
@ -82,23 +83,23 @@ nsapi_error_t tlssocket_connect_to_srv(TLSSocket &sock, uint16_t port)
|
|||
NetworkInterface::get_default_instance()->gethostbyname(ECHO_SERVER_ADDR, &tls_addr);
|
||||
tls_addr.set_port(port);
|
||||
|
||||
printf("MBED: Server '%s', port %d\n", tls_addr.get_ip_address(), tls_addr.get_port());
|
||||
tr_info("MBED: Server '%s', port %d\n", tls_addr.get_ip_address(), tls_addr.get_port());
|
||||
|
||||
nsapi_error_t err = sock.set_root_ca_cert(tls_global::cert);
|
||||
if (err != NSAPI_ERROR_OK) {
|
||||
printf("Error from sock.set_root_ca_cert: %d\n", err);
|
||||
tr_error("Error from sock.open: %d\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
err = sock.open(NetworkInterface::get_default_instance());
|
||||
if (err != NSAPI_ERROR_OK) {
|
||||
printf("Error from sock.open: %d\n", err);
|
||||
tr_error("Error from sock.set_root_ca_cert: %d\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
err = sock.connect(tls_addr);
|
||||
if (err != NSAPI_ERROR_OK) {
|
||||
printf("Error from sock.connect: %d\n", err);
|
||||
tr_error("Error from sock.connect: %d\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -150,6 +151,11 @@ utest::v1::status_t greentea_setup(const size_t number_of_cases)
|
|||
{
|
||||
GREENTEA_SETUP(tls_global::TESTS_TIMEOUT, "default_auto");
|
||||
_ifup();
|
||||
|
||||
#ifdef MBED_CONF_APP_BAUD_RATE
|
||||
CellularDevice::get_default_instance()->set_baud_rate(MBED_CONF_APP_BAUD_RATE);
|
||||
#endif
|
||||
|
||||
tc_bucket.start();
|
||||
return greentea_test_setup_handler(number_of_cases);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,9 @@
|
|||
|
||||
#include "../test_params.h"
|
||||
#include "TLSSocket.h"
|
||||
#include "mbed_trace.h"
|
||||
|
||||
#define TRACE_GROUP "GRNT"
|
||||
|
||||
#if defined(MBEDTLS_SSL_CLI_C) || defined(DOXYGEN_ONLY)
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ void TLSSOCKET_ECHOTEST()
|
|||
SKIP_IF_TCP_UNSUPPORTED();
|
||||
sock = new TLSSocket;
|
||||
if (tlssocket_connect_to_echo_srv(*sock) != NSAPI_ERROR_OK) {
|
||||
printf("Error from tlssocket_connect_to_echo_srv\n");
|
||||
tr_error("Error from tlssocket_connect_to_echo_srv\n");
|
||||
TEST_FAIL();
|
||||
delete sock;
|
||||
return;
|
||||
|
@ -76,11 +76,11 @@ void TLSSOCKET_ECHOTEST()
|
|||
|
||||
sent = sock->send(tls_global::tx_buffer, pkt_s);
|
||||
if (sent < 0) {
|
||||
printf("[Round#%02d] network error %d\n", s_idx, sent);
|
||||
tr_error("[Round#%02d] network error %d\n", s_idx, sent);
|
||||
TEST_FAIL();
|
||||
break;
|
||||
} else if (sent != pkt_s) {
|
||||
printf("[%02d] sock.send return size %d does not match the expectation %d\n", s_idx, sent, pkt_s);
|
||||
tr_error("[%02d] sock.send return size %d does not match the expectation %d\n", s_idx, sent, pkt_s);
|
||||
TEST_FAIL();
|
||||
break;
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ void TLSSOCKET_ECHOTEST()
|
|||
while (bytes2recv) {
|
||||
recvd = sock->recv(&(tls_global::rx_buffer[sent - bytes2recv]), bytes2recv);
|
||||
if (recvd < 0) {
|
||||
printf("[Round#%02d] network error %d\n", s_idx, recvd);
|
||||
tr_error("[Round#%02d] network error %d\n", s_idx, recvd);
|
||||
TEST_FAIL();
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->close());
|
||||
return;
|
||||
|
@ -115,7 +115,7 @@ void tlssocket_echotest_nonblock_receive()
|
|||
}
|
||||
return;
|
||||
} else if (recvd < 0) {
|
||||
printf("sock.recv returned an error %d", recvd);
|
||||
tr_error("sock.recv returned an error %d", recvd);
|
||||
TEST_FAIL();
|
||||
receive_error = true;
|
||||
} else {
|
||||
|
@ -176,7 +176,7 @@ void TLSSOCKET_ECHOTEST_NONBLOCK()
|
|||
}
|
||||
continue;
|
||||
} else if (sent <= 0) {
|
||||
printf("[Sender#%02d] network error %d\n", s_idx, sent);
|
||||
tr_error("[Sender#%02d] network error %d\n", s_idx, sent);
|
||||
TEST_FAIL();
|
||||
goto END;
|
||||
}
|
||||
|
|
|
@ -54,11 +54,11 @@ void TLSSOCKET_ECHOTEST_BURST()
|
|||
for (int i = 0; i < BURST_CNT; i++) {
|
||||
sent = sock->send(tls_global::tx_buffer, BURST_SIZE);
|
||||
if (sent < 0) {
|
||||
printf("[%02d] network error %d\n", i, sent);
|
||||
tr_error("[%02d] network error %d\n", i, sent);
|
||||
TEST_FAIL();
|
||||
break;
|
||||
} else if (sent != BURST_SIZE) {
|
||||
printf("[%02d] sock.send return size %d does not match the expectation %d\n", i, sent, BURST_SIZE);
|
||||
tr_error("[%02d] sock.send return size %d does not match the expectation %d\n", i, sent, BURST_SIZE);
|
||||
TEST_FAIL();
|
||||
break;
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ void TLSSOCKET_ECHOTEST_BURST()
|
|||
while (bytes2recv) {
|
||||
recvd = sock->recv(&(tls_global::rx_buffer[sent - bytes2recv]), bytes2recv);
|
||||
if (recvd < 0) {
|
||||
printf("[Round#%02d] network error %d\n", i, recvd);
|
||||
tr_error("[Round#%02d] network error %d\n", i, recvd);
|
||||
TEST_FAIL();
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->close());
|
||||
return;
|
||||
|
@ -106,7 +106,7 @@ void TLSSOCKET_ECHOTEST_BURST_NONBLOCK()
|
|||
}
|
||||
continue;
|
||||
} else if (sent < 0) {
|
||||
printf("[%02d] network error %d\n", i, sent);
|
||||
tr_error("[%02d] network error %d\n", i, sent);
|
||||
TEST_FAIL();
|
||||
goto END;
|
||||
}
|
||||
|
@ -122,19 +122,19 @@ void TLSSOCKET_ECHOTEST_BURST_NONBLOCK()
|
|||
recvd = sock->recv(&(tls_global::rx_buffer[BURST_SIZE - bt_left]), BURST_SIZE);
|
||||
if (recvd == NSAPI_ERROR_WOULD_BLOCK) {
|
||||
if (osSignalWait(SIGNAL_SIGIO, SIGIO_TIMEOUT).status == osEventTimeout) {
|
||||
printf("[bt#%02d] packet timeout...", i);
|
||||
tr_error("[bt#%02d] packet timeout...", i);
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
} else if (recvd < 0) {
|
||||
printf("[%02d] network error %d\n", i, recvd);
|
||||
tr_error("[%02d] network error %d\n", i, recvd);
|
||||
break;
|
||||
}
|
||||
bt_left -= recvd;
|
||||
}
|
||||
|
||||
if (bt_left != 0) {
|
||||
printf("network error %d, missing %d bytes from a burst\n", recvd, bt_left);
|
||||
tr_error("network error %d, missing %d bytes from a burst\n", recvd, bt_left);
|
||||
TEST_FAIL();
|
||||
goto END;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,14 @@ using namespace utest::v1;
|
|||
void TLSSOCKET_HANDSHAKE_INVALID()
|
||||
{
|
||||
SKIP_IF_TCP_UNSUPPORTED();
|
||||
|
||||
#if (MBED_CONF_NSAPI_DEFAULT_STACK == NANOSTACK || (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP && defined(MBED_CONF_LWIP_PPP_IPV6_ENABLED)))
|
||||
SocketAddress address;
|
||||
nsapi_error_t result = NetworkInterface::get_default_instance()->gethostbyname("expired.badssl.com", &address);
|
||||
if (result != NSAPI_ERROR_OK) {
|
||||
TEST_SKIP_MESSAGE(" badssl.com not supported IP6 AAA records");
|
||||
}
|
||||
#endif
|
||||
TLSSocket sock;
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.open(NetworkInterface::get_default_instance()));
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.set_root_ca_cert(tls_global::cert));
|
||||
|
|
|
@ -51,7 +51,7 @@ void TLSSOCKET_OPEN_LIMIT()
|
|||
}
|
||||
ret = sock->open(NetworkInterface::get_default_instance());
|
||||
if (ret == NSAPI_ERROR_NO_MEMORY || ret == NSAPI_ERROR_NO_SOCKET) {
|
||||
printf("[round#%02d] unable to open new socket, error: %d\n", i, ret);
|
||||
tr_error("[round#%02d] unable to open new socket, error: %d\n", i, ret);
|
||||
delete sock;
|
||||
break;
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ void TLSSOCKET_OPEN_LIMIT()
|
|||
delete tmp->sock;
|
||||
delete tmp;
|
||||
}
|
||||
printf("[round#%02d] %d sockets opened\n", i, open_sockets[i]);
|
||||
tr_info("[round#%02d] %d sockets opened\n", i, open_sockets[i]);
|
||||
}
|
||||
TEST_ASSERT_EQUAL(open_sockets[0], open_sockets[1]);
|
||||
TEST_ASSERT(open_sockets[0] >= 4);
|
||||
|
|
|
@ -69,10 +69,10 @@ void TLSSOCKET_RECV_TIMEOUT()
|
|||
TEST_FAIL();
|
||||
goto CLEANUP;
|
||||
}
|
||||
printf("MBED: recv() took: %dus\n", timer.read_us());
|
||||
tr_info("MBED: recv() took: %dus\n", timer.read_us());
|
||||
continue;
|
||||
} else if (recvd < 0) {
|
||||
printf("[pkt#%02d] network error %d\n", i, recvd);
|
||||
tr_error("[pkt#%02d] network error %d\n", i, recvd);
|
||||
TEST_FAIL();
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
|
|
@ -59,13 +59,13 @@ static void _ifup()
|
|||
NetworkInterface *net = NetworkInterface::get_default_instance();
|
||||
nsapi_error_t err = net->connect();
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);
|
||||
printf("MBED: UDPClient IP address is '%s'\n", net->get_ip_address() ? net->get_ip_address() : "null");
|
||||
tr_info("MBED: UDPClient IP address is '%s'", net->get_ip_address() ? net->get_ip_address() : "null");
|
||||
}
|
||||
|
||||
static void _ifdown()
|
||||
{
|
||||
NetworkInterface::get_default_instance()->disconnect();
|
||||
printf("MBED: ifdown\n");
|
||||
tr_info("MBED: ifdown");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
#define UDP_TESTS_H
|
||||
|
||||
#include "../test_params.h"
|
||||
#include "mbed_trace.h"
|
||||
|
||||
#define TRACE_GROUP "GRNT"
|
||||
|
||||
NetworkInterface *get_interface();
|
||||
void drop_bad_packets(UDPSocket &sock, int orig_timeout);
|
||||
|
|
|
@ -29,6 +29,7 @@ namespace {
|
|||
static const int SIGNAL_SIGIO_RX = 0x1;
|
||||
static const int SIGNAL_SIGIO_TX = 0x2;
|
||||
static const int SIGIO_TIMEOUT = 5000; //[ms]
|
||||
static const int SOCKET_TIMEOUT = (10 * 1000); //[ms]
|
||||
static const int RETRIES = 2;
|
||||
|
||||
static const double EXPECTED_LOSS_RATIO = 0.0;
|
||||
|
@ -46,6 +47,11 @@ static const int pkt_sizes[PKTS] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, \
|
|||
100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, \
|
||||
1100, 1200
|
||||
};
|
||||
static bool pkt_received[PKTS] = {false, false, false, false, false, false, false, false, false, false, \
|
||||
false, false, false, false, false, false, false, false, false, false, \
|
||||
false, false
|
||||
};
|
||||
|
||||
Timer tc_exec_time;
|
||||
int time_allotted;
|
||||
}
|
||||
|
@ -58,16 +64,19 @@ static void _sigio_handler()
|
|||
void UDPSOCKET_ECHOTEST()
|
||||
{
|
||||
SocketAddress udp_addr;
|
||||
SocketAddress recv_addr;
|
||||
NetworkInterface::get_default_instance()->gethostbyname(ECHO_SERVER_ADDR, &udp_addr);
|
||||
udp_addr.set_port(ECHO_SERVER_PORT);
|
||||
|
||||
UDPSocket sock;
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.open(NetworkInterface::get_default_instance()));
|
||||
|
||||
sock.set_timeout(SOCKET_TIMEOUT);
|
||||
int recvd;
|
||||
int sent;
|
||||
int packets_sent = 0;
|
||||
int packets_recv = 0;
|
||||
bool received_duplicate_packet = false;
|
||||
for (unsigned int s_idx = 0; s_idx < sizeof(pkt_sizes) / sizeof(*pkt_sizes); ++s_idx) {
|
||||
int pkt_s = pkt_sizes[s_idx];
|
||||
|
||||
|
@ -82,18 +91,36 @@ void UDPSOCKET_ECHOTEST()
|
|||
} else if (sent == pkt_s) {
|
||||
packets_sent++;
|
||||
} else {
|
||||
printf("[Round#%02d - Sender] error, returned %d\n", s_idx, sent);
|
||||
tr_error("[Round#%02d - Sender] error, returned %d", s_idx, sent);
|
||||
continue;
|
||||
}
|
||||
recvd = sock.recvfrom(NULL, rx_buffer, pkt_s);
|
||||
|
||||
do {
|
||||
received_duplicate_packet = false;
|
||||
recvd = sock.recvfrom(&recv_addr, rx_buffer, pkt_s);
|
||||
//Check if received duplicated packet
|
||||
for (unsigned int d_idx = 0; d_idx < PKTS; ++d_idx) {
|
||||
if (pkt_received[d_idx] && d_idx != s_idx && recvd == pkt_sizes[d_idx]) {
|
||||
printf("[Round#%02d - Receiver] info, received duplicate packet %d\n", s_idx, d_idx);
|
||||
received_duplicate_packet = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (received_duplicate_packet);
|
||||
|
||||
if (recvd == pkt_s) {
|
||||
break;
|
||||
} else {
|
||||
printf("[Round#%02d - Receiver] error, returned %d\n", s_idx, recvd);
|
||||
tr_error("[Round#%02d - Receiver] error, returned %d", s_idx, recvd);
|
||||
}
|
||||
}
|
||||
// Verify received address is correct
|
||||
TEST_ASSERT(udp_addr == recv_addr);
|
||||
TEST_ASSERT_EQUAL(udp_addr.get_port(), recv_addr.get_port());
|
||||
|
||||
if (memcmp(tx_buffer, rx_buffer, pkt_s) == 0) {
|
||||
packets_recv++;
|
||||
pkt_received[s_idx] = true;
|
||||
}
|
||||
// Make sure that at least one packet of every size was sent.
|
||||
TEST_ASSERT_TRUE(packets_sent > packets_sent_prev);
|
||||
|
@ -102,7 +129,7 @@ void UDPSOCKET_ECHOTEST()
|
|||
// Packet loss up to 30% tolerated
|
||||
if (packets_sent > 0) {
|
||||
double loss_ratio = 1 - ((double)packets_recv / (double)packets_sent);
|
||||
printf("Packets sent: %d, packets received %d, loss ratio %.2lf\r\n", packets_sent, packets_recv, loss_ratio);
|
||||
tr_info("Packets sent: %d, packets received %d, loss ratio %.2lf", packets_sent, packets_recv, loss_ratio);
|
||||
TEST_ASSERT_DOUBLE_WITHIN(TOLERATED_LOSS_RATIO, EXPECTED_LOSS_RATIO, loss_ratio);
|
||||
}
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.close());
|
||||
|
@ -143,7 +170,7 @@ void UDPSOCKET_ECHOTEST_NONBLOCK()
|
|||
}
|
||||
--retry_cnt;
|
||||
} else {
|
||||
printf("[Round#%02d - Sender] error, returned %d\n", s_idx, sent);
|
||||
tr_error("[Round#%02d - Sender] error, returned %d", s_idx, sent);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -158,7 +185,7 @@ void UDPSOCKET_ECHOTEST_NONBLOCK()
|
|||
--retry_recv;
|
||||
continue;
|
||||
} else if (recvd < 0) {
|
||||
printf("sock.recvfrom returned %d\n", recvd);
|
||||
tr_error("sock.recvfrom returned %d", recvd);
|
||||
TEST_FAIL();
|
||||
break;
|
||||
} else if (recvd == pkt_s) {
|
||||
|
@ -180,7 +207,7 @@ void UDPSOCKET_ECHOTEST_NONBLOCK()
|
|||
// Packet loss up to 30% tolerated
|
||||
if (packets_sent > 0) {
|
||||
double loss_ratio = 1 - ((double)packets_recv / (double)packets_sent);
|
||||
printf("Packets sent: %d, packets received %d, loss ratio %.2lf\r\n", packets_sent, packets_recv, loss_ratio);
|
||||
tr_info("Packets sent: %d, packets received %d, loss ratio %.2lf", packets_sent, packets_recv, loss_ratio);
|
||||
TEST_ASSERT_DOUBLE_WITHIN(TOLERATED_LOSS_RATIO, EXPECTED_LOSS_RATIO, loss_ratio);
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
|
@ -194,7 +221,7 @@ void UDPSOCKET_ECHOTEST_NONBLOCK()
|
|||
}
|
||||
}
|
||||
loss_ratio = 1 - ((double)udp_stats[j].recv_bytes / (double)udp_stats[j].sent_bytes);
|
||||
printf("Bytes sent: %d, bytes received %d, loss ratio %.2lf\r\n", udp_stats[j].sent_bytes, udp_stats[j].recv_bytes, loss_ratio);
|
||||
tr_info("Bytes sent: %d, bytes received %d, loss ratio %.2lf", udp_stats[j].sent_bytes, udp_stats[j].recv_bytes, loss_ratio);
|
||||
TEST_ASSERT_DOUBLE_WITHIN(TOLERATED_LOSS_RATIO, EXPECTED_LOSS_RATIO, loss_ratio);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "unity/unity.h"
|
||||
#include "utest.h"
|
||||
#include "udp_tests.h"
|
||||
#include "CellularDevice.h"
|
||||
|
||||
using namespace utest::v1;
|
||||
|
||||
|
@ -70,6 +71,10 @@ static void _sigio_handler(osThreadId id)
|
|||
|
||||
void UDPSOCKET_ECHOTEST_BURST()
|
||||
{
|
||||
#ifdef MBED_CONF_APP_BAUD_RATE
|
||||
CellularDevice::get_default_instance()->set_baud_rate(MBED_CONF_APP_BAUD_RATE);
|
||||
#endif
|
||||
|
||||
SocketAddress udp_addr;
|
||||
NetworkInterface::get_default_instance()->gethostbyname(ECHO_SERVER_ADDR, &udp_addr);
|
||||
udp_addr.set_port(ECHO_SERVER_PORT);
|
||||
|
@ -109,12 +114,12 @@ void UDPSOCKET_ECHOTEST_BURST()
|
|||
}
|
||||
} else if (recvd < 0) {
|
||||
pkg_fail += BURST_PKTS - j; // Assume all the following packets of the burst to be lost
|
||||
printf("[%02d] network error %d\n", i, recvd);
|
||||
tr_error("[%02d] network error %d", i, recvd);
|
||||
ThisThread::sleep_for(recv_timeout * 1000);
|
||||
recv_timeout *= 2; // Back off,
|
||||
break;
|
||||
} else if (temp_addr != udp_addr) {
|
||||
printf("[%02d] packet from wrong address\n", i);
|
||||
tr_info("[%02d] packet from wrong address", i);
|
||||
--j;
|
||||
continue;
|
||||
}
|
||||
|
@ -134,15 +139,15 @@ void UDPSOCKET_ECHOTEST_BURST()
|
|||
ok_bursts++;
|
||||
} else {
|
||||
drop_bad_packets(sock, TIMEOUT);
|
||||
printf("[%02d] burst failure, rcv %d\n", i, bt_total);
|
||||
tr_error("[%02d] burst failure, rcv %d", i, bt_total);
|
||||
}
|
||||
}
|
||||
|
||||
free_tx_buffers();
|
||||
|
||||
double loss_ratio = 1 - ((double)(BURST_CNT * BURST_PKTS - pkg_fail) / (double)(BURST_CNT * BURST_PKTS));
|
||||
printf("Packets sent: %d, packets received %d, loss ratio %.2lf\r\n",
|
||||
BURST_CNT * BURST_PKTS, BURST_CNT * BURST_PKTS - pkg_fail, loss_ratio);
|
||||
tr_info("Packets sent: %d, packets received %d, loss ratio %.2lf",
|
||||
BURST_CNT * BURST_PKTS, BURST_CNT * BURST_PKTS - pkg_fail, loss_ratio);
|
||||
// Packet loss up to 30% tolerated
|
||||
TEST_ASSERT_DOUBLE_WITHIN(TOLERATED_LOSS_RATIO, EXPECTED_LOSS_RATIO, loss_ratio);
|
||||
// 70% of the bursts need to be successful
|
||||
|
@ -153,6 +158,10 @@ void UDPSOCKET_ECHOTEST_BURST()
|
|||
|
||||
void UDPSOCKET_ECHOTEST_BURST_NONBLOCK()
|
||||
{
|
||||
#ifdef MBED_CONF_APP_BAUD_RATE
|
||||
CellularDevice::get_default_instance()->set_baud_rate(MBED_CONF_APP_BAUD_RATE);
|
||||
#endif
|
||||
|
||||
SocketAddress udp_addr;
|
||||
NetworkInterface::get_default_instance()->gethostbyname(ECHO_SERVER_ADDR, &udp_addr);
|
||||
udp_addr.set_port(ECHO_SERVER_PORT);
|
||||
|
@ -206,7 +215,7 @@ void UDPSOCKET_ECHOTEST_BURST_NONBLOCK()
|
|||
goto PKT_OK;
|
||||
}
|
||||
}
|
||||
printf("[bt#%02d] corrupted packet...", i);
|
||||
tr_error("[bt#%02d] corrupted packet...", i);
|
||||
pkg_fail++;
|
||||
break;
|
||||
PKT_OK:
|
||||
|
@ -224,8 +233,8 @@ PKT_OK:
|
|||
free_tx_buffers();
|
||||
|
||||
double loss_ratio = 1 - ((double)(BURST_CNT * BURST_PKTS - pkg_fail) / (double)(BURST_CNT * BURST_PKTS));
|
||||
printf("Packets sent: %d, packets received %d, loss ratio %.2lf\r\n",
|
||||
BURST_CNT * BURST_PKTS, BURST_CNT * BURST_PKTS - pkg_fail, loss_ratio);
|
||||
tr_info("Packets sent: %d, packets received %d, loss ratio %.2lf",
|
||||
BURST_CNT * BURST_PKTS, BURST_CNT * BURST_PKTS - pkg_fail, loss_ratio);
|
||||
// Packet loss up to 30% tolerated
|
||||
TEST_ASSERT_DOUBLE_WITHIN(TOLERATED_LOSS_RATIO, EXPECTED_LOSS_RATIO, loss_ratio);
|
||||
// 70% of the bursts need to be successful
|
||||
|
|
|
@ -49,7 +49,7 @@ void UDPSOCKET_OPEN_LIMIT()
|
|||
}
|
||||
ret = sock->open(NetworkInterface::get_default_instance());
|
||||
if (ret == NSAPI_ERROR_NO_MEMORY || ret == NSAPI_ERROR_NO_SOCKET) {
|
||||
printf("[round#%02d] unable to open new socket, error: %d\n", i, ret);
|
||||
tr_error("[round#%02d] unable to open new socket, error: %d", i, ret);
|
||||
delete sock;
|
||||
break;
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ void UDPSOCKET_OPEN_LIMIT()
|
|||
delete tmp->sock;
|
||||
delete tmp;
|
||||
}
|
||||
printf("[round#%02d] %d sockets opened\n", i, open_sockets[i]);
|
||||
tr_info("[round#%02d] %d sockets opened", i, open_sockets[i]);
|
||||
}
|
||||
TEST_ASSERT_EQUAL(open_sockets[0], open_sockets[1]);
|
||||
// In case of lwIP one is taken by DHCP -> reduction by one to three
|
||||
|
|
|
@ -62,7 +62,7 @@ void UDPSOCKET_RECV_TIMEOUT()
|
|||
|
||||
if (recvd == NSAPI_ERROR_WOULD_BLOCK) {
|
||||
osSignalWait(SIGNAL_SIGIO, SIGIO_TIMEOUT);
|
||||
printf("MBED: recvfrom() took: %dms\n", timer.read_ms());
|
||||
tr_info("MBED: recvfrom() took: %dms", timer.read_ms());
|
||||
if (timer.read_ms() > 150) {
|
||||
TEST_ASSERT(150 - timer.read_ms() < 51);
|
||||
} else {
|
||||
|
@ -70,16 +70,16 @@ void UDPSOCKET_RECV_TIMEOUT()
|
|||
}
|
||||
continue;
|
||||
} else if (recvd < 0) {
|
||||
printf("[bt#%02d] network error %d\n", i, recvd);
|
||||
tr_error("[bt#%02d] network error %d", i, recvd);
|
||||
continue;
|
||||
} else if (temp_addr != udp_addr) {
|
||||
printf("[bt#%02d] packet from wrong address\n", i);
|
||||
tr_info("[bt#%02d] packet from wrong address", i);
|
||||
continue;
|
||||
}
|
||||
TEST_ASSERT_EQUAL(DATA_LEN, recvd);
|
||||
pkt_success++;
|
||||
}
|
||||
|
||||
printf("MBED: %d out of %d packets were received.\n", pkt_success, PKT_NUM);
|
||||
tr_info("MBED: %d out of %d packets were received.", pkt_success, PKT_NUM);
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.close());
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ void UDPSOCKET_SENDTO_TIMEOUT()
|
|||
int sent = sock.sendto(udp_addr, tx_buffer, sizeof(tx_buffer));
|
||||
timer.stop();
|
||||
TEST_ASSERT_EQUAL(sizeof(tx_buffer), sent);
|
||||
printf("MBED: Time taken: %fs\n", timer.read());
|
||||
tr_info("MBED: Time taken: %fs", timer.read());
|
||||
sock.set_timeout(1000);
|
||||
|
||||
timer.reset();
|
||||
|
@ -49,7 +49,7 @@ void UDPSOCKET_SENDTO_TIMEOUT()
|
|||
sent = sock.sendto(udp_addr, tx_buffer, sizeof(tx_buffer));
|
||||
timer.stop();
|
||||
TEST_ASSERT_EQUAL(sizeof(tx_buffer), sent);
|
||||
printf("MBED: Time taken: %fs\n", timer.read());
|
||||
tr_info("MBED: Time taken: %fs", timer.read());
|
||||
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.close());
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ using namespace utest::v1;
|
|||
void test_emac_multicast_filter_cb(int opt)
|
||||
{
|
||||
static bool multicasts_are_filtered = true;
|
||||
unsigned char forward_addr[ETH_MAC_ADDR_LEN];
|
||||
static unsigned char forward_addr[ETH_MAC_ADDR_LEN];
|
||||
static bool send_request = true;
|
||||
static bool receive = true;
|
||||
static int no_response_cnt = 0;
|
||||
|
@ -71,7 +71,6 @@ void test_emac_multicast_filter_cb(int opt)
|
|||
receive = true;
|
||||
break;
|
||||
|
||||
|
||||
case 3:
|
||||
printf("STEP 3: set ipv4 multicast filter, test if input message is filtered\r\n\r\n");
|
||||
{
|
||||
|
@ -145,7 +144,15 @@ void test_emac_multicast_filter_cb(int opt)
|
|||
|
||||
if (next_step) {
|
||||
RESET_OUTGOING_MSG_DATA;
|
||||
#if (MBED_CONF_NETWORK_EMAC_NO_SUPPORT_FOR_IPV4_MULTICAST_FILTER == 1)
|
||||
if (test_step == 2) {
|
||||
test_step = 5;
|
||||
} else {
|
||||
test_step++;
|
||||
}
|
||||
#else
|
||||
test_step++;
|
||||
#endif
|
||||
retries = 0;
|
||||
send_request = true;
|
||||
}
|
||||
|
|
|
@ -72,7 +72,10 @@ Case cases[] = {
|
|||
Case("EMAC unicast frame length", test_emac_unicast_frame_len),
|
||||
Case("EMAC unicast burst", test_emac_unicast_burst),
|
||||
Case("EMAC unicast long", test_emac_unicast_long),
|
||||
#if !((MBED_CONF_NETWORK_EMAC_NO_SUPPORT_FOR_MULTICAST_FILTER == 1) && \
|
||||
(MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE == WIFI))
|
||||
Case("EMAC multicast filter", test_emac_multicast_filter),
|
||||
#endif // !(MBED_CONF_NETWORK_EMAC_NO_SUPPORT_FOR_MULTICAST_FILTER == 1)
|
||||
Case("EMAC memory", test_emac_memory)
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"name": "network-emac",
|
||||
"config": {
|
||||
"NO_SUPPORT_FOR_MULTICAST_FILTER": false,
|
||||
"NO_SUPPORT_FOR_IPV4_MULTICAST_FILTER": false
|
||||
},
|
||||
"target_overrides": {
|
||||
"MTB_UBLOX_ODIN_W2": {
|
||||
"NO_SUPPORT_FOR_MULTICAST_FILTER": true
|
||||
},
|
||||
"UBLOX_EVK_ODIN_W2": {
|
||||
"NO_SUPPORT_FOR_MULTICAST_FILTER": true
|
||||
},
|
||||
"MTB_MXCHIP_EMW3166": {
|
||||
"NO_SUPPORT_FOR_IPV4_MULTICAST_FILTER": true
|
||||
},
|
||||
"MTB_ADV_WISE_1530": {
|
||||
"NO_SUPPORT_FOR_IPV4_MULTICAST_FILTER": true
|
||||
},
|
||||
"MTB_USI_WM_BN_BM_22": {
|
||||
"NO_SUPPORT_FOR_IPV4_MULTICAST_FILTER": true
|
||||
}
|
||||
}
|
||||
}
|
|
@ -155,10 +155,14 @@ Test `NetworkInterface::get_connection_status()`.
|
|||
1. Check that `get_connection_status()` returns status `NSAPI_STATUS_DISCONNECTED`.
|
||||
2. Connect interface.
|
||||
3. Poll the `get_connection_status()` until it returns status `NSAPI_STATUS_GLOBAL_UP`.
|
||||
4. Disconnect interface.
|
||||
5. Check that `get_connection_status()` returns status `NSAPI_STATUS_DISCONNECTED`.
|
||||
6. Repeat connect and disconnect steps 2 to 5 four times.
|
||||
4. (IPv6 only) Get IPv6 link local address using `get_ipv6_link_local_address` API.
|
||||
5. (IPv6 only) Check that `get_ipv6_link_local_address` returned status `NSAPI_ERROR_OK`.
|
||||
6. (IPv6 only) Check that the IP address associated with the Socket Address is not `NULL`.
|
||||
7. (IPv6 only) Check that the IP version of the IPv6 link local address is `NSAPI_IPv6`.
|
||||
8. Disconnect interface.
|
||||
9. Check that `get_connection_status()` returns status `NSAPI_STATUS_DISCONNECTED`.
|
||||
10. Repeat connect and disconnect steps 2 to 5 four times.
|
||||
|
||||
**Expected result:**
|
||||
|
||||
`Connect()` and `disconnect()` calls return `NSAPI_ERROR_OK`. The right status is returned by `get_connection_status()`.
|
||||
`Connect()`, `get_ipv6_link_local_address` and `disconnect()` calls return `NSAPI_ERROR_OK`. The right status is returned by `get_connection_status()`. And the right IPv6 link local address is returned by `get_ipv6_link_local_address`.
|
||||
|
|
|
@ -156,6 +156,15 @@ void NETWORKINTERFACE_STATUS_GET()
|
|||
ThisThread::sleep_for(500);
|
||||
}
|
||||
|
||||
#if MBED_CONF_LWIP_IPV6_ENABLED
|
||||
/* if IPv6 is enabled, validate ipv6_link_local_address API*/
|
||||
SocketAddress ipv6_link_local_address = NULL;
|
||||
err = net->get_ipv6_link_local_address(&ipv6_link_local_address);
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);
|
||||
TEST_ASSERT_NOT_NULL(ipv6_link_local_address.get_ip_address());
|
||||
TEST_ASSERT_EQUAL(NSAPI_IPv6, ipv6_link_local_address.get_ip_version());
|
||||
#endif
|
||||
|
||||
err = net->disconnect();
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);
|
||||
|
||||
|
|
|
@ -34,15 +34,15 @@
|
|||
!defined(MBED_CONF_APP_WIFI_CH_SECURE) || \
|
||||
!defined(MBED_CONF_APP_WIFI_PASSWORD) || \
|
||||
!defined(MBED_CONF_APP_WIFI_SECURE_SSID) || \
|
||||
!defined MBED_CONF_APP_WIFI_SECURE_PROTOCOL)
|
||||
!defined(MBED_CONF_APP_WIFI_SECURE_PROTOCOL))
|
||||
#error [NOT_SUPPORTED] Requires parameters from mbed_app.json (for secure connections)
|
||||
#else
|
||||
|
||||
#if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) && \
|
||||
!defined(MBED_CONF_APP_AP_MAC_UNSECURE) || \
|
||||
(!defined(MBED_CONF_APP_AP_MAC_UNSECURE) || \
|
||||
!defined(MBED_CONF_APP_MAX_SCAN_SIZE) || \
|
||||
!defined(MBED_CONF_APP_WIFI_CH_UNSECURE) || \
|
||||
!defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)
|
||||
!defined(MBED_CONF_APP_WIFI_UNSECURE_SSID))
|
||||
#error [NOT_SUPPORTED] Requires parameters from mbed_app.json (for unsecure connections)
|
||||
#else
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ if (COVERAGE)
|
|||
endif()
|
||||
|
||||
# Append coverage compiler flags
|
||||
set(COVERAGE_COMPILER_FLAGS "-g -O0 --coverage -fprofile-arcs -ftest-coverage")
|
||||
set(COVERAGE_COMPILER_FLAGS "-g -O0 --coverage")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COVERAGE_COMPILER_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COVERAGE_COMPILER_FLAGS}")
|
||||
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
/* Copyright (c) 2019 ARM Limited
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
/*
|
||||
* Purpose of this test is just to be empty baseline
|
||||
* that does nothing, but includes all source files
|
||||
* in the build.
|
||||
* Do not add any tests here
|
||||
*/
|
||||
|
||||
class EmptyBaseline : public testing::Test {
|
||||
virtual void SetUp()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void TearDown()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(EmptyBaseline, constructor)
|
||||
{
|
||||
EXPECT_TRUE(true);
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
|
||||
####################
|
||||
# UNIT TESTS
|
||||
####################
|
||||
|
||||
set(unittest-includes ${unittest-includes}
|
||||
.
|
||||
..
|
||||
../features/mbedtls/mbed-crypto/inc/mbedtls/
|
||||
../features/mbedtls/platform/inc/
|
||||
../features/frameworks/mbed-trace/mbed-trace/
|
||||
)
|
||||
|
||||
set(unittest-sources
|
||||
../features/device_key/source/DeviceKey.cpp
|
||||
../components/storage/blockdevice/COMPONENT_SPIF/SPIFBlockDevice.cpp
|
||||
../components/storage/blockdevice/COMPONENT_I2CEE/I2CEEBlockDevice.cpp
|
||||
../components/storage/blockdevice/COMPONENT_DATAFLASH/DataFlashBlockDevice.cpp
|
||||
../components/storage/blockdevice/COMPONENT_FLASHIAP/FlashIAPBlockDevice.cpp
|
||||
../components/storage/blockdevice/COMPONENT_RSPIF/SPIFReducedBlockDevice.cpp
|
||||
../components/storage/blockdevice/COMPONENT_SD/SDBlockDevice.cpp
|
||||
../components/storage/blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.cpp
|
||||
../features/storage/filesystem/Dir.cpp
|
||||
../features/storage/filesystem/FileSystem.cpp
|
||||
../features/storage/filesystem/File.cpp
|
||||
../features/storage/kvstore/global_api/kvstore_global_api.cpp
|
||||
../features/storage/kvstore/securestore/SecureStore.cpp
|
||||
../features/storage/kvstore/kv_map/KVMap.cpp
|
||||
../features/storage/kvstore/tdbstore/TDBStore.cpp
|
||||
../features/storage/kvstore/direct_access_devicekey/DirectAccessDevicekey.cpp
|
||||
../features/storage/kvstore/conf/kv_config.cpp
|
||||
../features/storage/kvstore/filesystemstore/FileSystemStore.cpp
|
||||
../features/storage/system_storage/SystemStorage.cpp
|
||||
../features/storage/nvstore/source/nvstore.cpp
|
||||
../features/storage/blockdevice/ChainingBlockDevice.cpp
|
||||
../features/storage/blockdevice/ReadOnlyBlockDevice.cpp
|
||||
../features/storage/blockdevice/SlicingBlockDevice.cpp
|
||||
../features/storage/blockdevice/MBRBlockDevice.cpp
|
||||
../features/storage/blockdevice/HeapBlockDevice.cpp
|
||||
../features/storage/blockdevice/FlashSimBlockDevice.cpp
|
||||
../features/storage/blockdevice/ObservingBlockDevice.cpp
|
||||
../features/storage/blockdevice/ProfilingBlockDevice.cpp
|
||||
../features/storage/blockdevice/BufferedBlockDevice.cpp
|
||||
../features/storage/blockdevice/ExhaustibleBlockDevice.cpp
|
||||
)
|
||||
|
||||
set(unittest-test-sources
|
||||
empty_baseline/empty_baseline.cpp
|
||||
)
|
||||
|
||||
set(DEVICE_FLAGS "-DDEVICE_ANALOGIN -DDEVICE_ANALOGOUT -DDEVICE_CAN -DDEVICE_CRC -DDEVICE_ETHERNET -DDEVICE_FLASH -DDEVICE_I2C -DDEVICE_I2CSLAVE -DDEVICE_I2C_ASYNCH -DDEVICE_INTERRUPTIN -DDEVICE_LPTICKER -DDEVICE_PORTIN -DDEVICE_PORTINOUT -DDEVICE_PORTOUT -DDEVICE_PWMOUT -DDEVICE_QSPI -DDEVICE_SERIAL -DDEVICE_SERIAL_ASYNCH -DDEVICE_SERIAL_FC -DDEVICE_SPI -DDEVICE_SPISLAVE -DDEVICE_SPI_ASYNCH -DDEVICE_FLASH -DCOMPONENT_FLASHIAP")
|
||||
set(CONF_FLAGS "-DMBED_CONF_PLATFORM_CTHUNK_COUNT_MAX=10 -DMBED_CONF_DATAFLASH_SPI_FREQ=1 -DMBED_CONF_FLASHIAP_BLOCK_DEVICE_BASE_ADDRESS=0 -DMBED_CONF_FLASHIAP_BLOCK_DEVICE_SIZE=0 -DMBED_CONF_QSPIF_QSPI_FREQ=1 -DMBED_CONF_QSPIF_QSPI_MIN_READ_SIZE=1 -DMBED_CONF_QSPIF_QSPI_MIN_PROG_SIZE=1 -DMBED_LFS_READ_SIZE=64 -DMBED_LFS_PROG_SIZE=64 -DMBED_LFS_BLOCK_SIZE=512 -DMBED_LFS_LOOKAHEAD=512 -DFLASHIAP_APP_ROM_END_ADDR=0x80000 -DMBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_SIZE=1024 -DMBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_BASE_ADDRESS=0x80000 -DMBED_CONF_STORAGE_STORAGE_TYPE=default")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${DEVICE_FLAGS} ${CONF_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DEVICE_FLAGS} ${CONF_FLAGS}")
|
|
@ -43,5 +43,5 @@ set(unittest-test-sources
|
|||
)
|
||||
|
||||
# defines
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMDMRTS=PTC0 -DMDMCTS=PTC1 -DMDMTXD=NC -DMDMRXD=NC -DMBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200 -DCELLULAR_DEVICE=myCellularDevice -DDEVICE_SERIAL_FC=1")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMDMRTS=PTC0 -DMDMCTS=PTC1 -DMDMTXD=NC -DMDMRXD=NC -DMBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200 -DCELLULAR_DEVICE=myCellularDevice -DDEVICE_SERIAL_FC=1")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMDMRTS=PTC0 -DMDMCTS=PTC1 -DMDMTXD=NC -DMDMRXD=NC -DMBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200 -DCELLULAR_DEVICE=myCellularDevice -DDEVICE_SERIAL_FC=1 -DMBED_CONF_RTOS_PRESENT=1")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMDMRTS=PTC0 -DMDMCTS=PTC1 -DMDMTXD=NC -DMDMRXD=NC -DMBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200 -DCELLULAR_DEVICE=myCellularDevice -DDEVICE_SERIAL_FC=1 -DMBED_CONF_RTOS_PRESENT=1")
|
||||
|
|
|
@ -94,6 +94,7 @@ public:
|
|||
MOCK_CONST_METHOD0(get_connection_status, nsapi_connection_status_t());
|
||||
MOCK_METHOD2(get_mac_address, char *(char *buf, nsapi_size_t buflen));
|
||||
MOCK_METHOD2(get_ip_address, char *(char *buf, nsapi_size_t buflen));
|
||||
MOCK_METHOD1(get_ipv6_link_local_address, nsapi_error_t(SocketAddress *address));
|
||||
MOCK_METHOD2(get_netmask, char *(char *buf, nsapi_size_t buflen));
|
||||
MOCK_METHOD2(get_gateway, char *(char *buf, nsapi_size_t buflen));
|
||||
};
|
||||
|
|
|
@ -0,0 +1,120 @@
|
|||
/* Copyright (c) 2019 ARM Limited
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "features/storage/blockdevice/HeapBlockDevice.h"
|
||||
#include <string.h>
|
||||
#include "mbed_assert.h"
|
||||
|
||||
#define BLOCK_SIZE (512)
|
||||
#define DEVICE_SIZE (BLOCK_SIZE*10)
|
||||
|
||||
class HeapBlockDeviceTest : public testing::Test {
|
||||
protected:
|
||||
virtual void SetUp()
|
||||
{
|
||||
bd.init();
|
||||
}
|
||||
|
||||
virtual void TearDown()
|
||||
{
|
||||
bd.deinit();
|
||||
}
|
||||
|
||||
mbed::HeapBlockDevice bd{DEVICE_SIZE};
|
||||
};
|
||||
|
||||
TEST_F(HeapBlockDeviceTest, constructor)
|
||||
{
|
||||
// HeapBlockDevice(bd_size_t size, bd_size_t read, bd_size_t program, bd_size_t erase);
|
||||
mbed::HeapBlockDevice one{3000, 100, 200, 300};
|
||||
EXPECT_EQ(one.init(), BD_ERROR_OK);
|
||||
EXPECT_EQ(one.size(), 3000);
|
||||
EXPECT_EQ(one.get_read_size(), 100);
|
||||
EXPECT_EQ(one.get_program_size(), 200);
|
||||
EXPECT_EQ(one.get_erase_size(), 300);
|
||||
EXPECT_EQ(one.get_erase_size(0), 300);
|
||||
EXPECT_EQ(one.deinit(), BD_ERROR_OK);
|
||||
}
|
||||
|
||||
TEST_F(HeapBlockDeviceTest, double_init)
|
||||
{
|
||||
mbed::HeapBlockDevice one{DEVICE_SIZE};
|
||||
EXPECT_EQ(one.init(), BD_ERROR_OK);
|
||||
EXPECT_EQ(one.init(), BD_ERROR_OK);
|
||||
EXPECT_EQ(one.deinit(), BD_ERROR_OK); // First de-init does only decrement the counter
|
||||
EXPECT_EQ(one.deinit(), BD_ERROR_OK);
|
||||
EXPECT_EQ(one.deinit(), BD_ERROR_OK); //Third one does not de-init, but return immediately
|
||||
}
|
||||
|
||||
TEST_F(HeapBlockDeviceTest, get_type)
|
||||
{
|
||||
EXPECT_EQ(0, strcmp(bd.get_type(), "HEAP"));
|
||||
}
|
||||
|
||||
TEST_F(HeapBlockDeviceTest, erase_program_read)
|
||||
{
|
||||
uint8_t *block = new uint8_t[BLOCK_SIZE] {0xaa,0xbb,0xcc};
|
||||
uint8_t *buf = new uint8_t[BLOCK_SIZE];
|
||||
EXPECT_EQ(bd.erase(0, BLOCK_SIZE), BD_ERROR_OK);
|
||||
EXPECT_EQ(bd.program(block, 0, BLOCK_SIZE), BD_ERROR_OK);
|
||||
EXPECT_EQ(bd.read(buf, 0, BLOCK_SIZE), BD_ERROR_OK);
|
||||
EXPECT_EQ(0, memcmp(block, buf, BLOCK_SIZE));
|
||||
delete[] block;
|
||||
delete[] buf;
|
||||
}
|
||||
|
||||
TEST_F(HeapBlockDeviceTest, use_uninitialized)
|
||||
{
|
||||
mbed::HeapBlockDevice one{DEVICE_SIZE};
|
||||
uint8_t *buf = new uint8_t[BLOCK_SIZE];
|
||||
EXPECT_EQ(one.read(buf, 0, BLOCK_SIZE), BD_ERROR_DEVICE_ERROR);
|
||||
EXPECT_EQ(one.program(buf, 0, BLOCK_SIZE), BD_ERROR_DEVICE_ERROR);
|
||||
delete[] buf;
|
||||
}
|
||||
|
||||
TEST_F(HeapBlockDeviceTest, over_read)
|
||||
{
|
||||
uint8_t *buf = new uint8_t[BLOCK_SIZE];
|
||||
EXPECT_EQ(bd.read(buf, DEVICE_SIZE, BLOCK_SIZE), BD_ERROR_DEVICE_ERROR);
|
||||
delete[] buf;
|
||||
}
|
||||
|
||||
TEST_F(HeapBlockDeviceTest, over_write)
|
||||
{
|
||||
uint8_t *buf = new uint8_t[BLOCK_SIZE] {0xaa,0xbb,0xcc};
|
||||
EXPECT_EQ(bd.program(buf, DEVICE_SIZE, BLOCK_SIZE), BD_ERROR_DEVICE_ERROR);
|
||||
delete[] buf;
|
||||
}
|
||||
|
||||
TEST_F(HeapBlockDeviceTest, over_erase)
|
||||
{
|
||||
EXPECT_EQ(bd.erase(DEVICE_SIZE, BLOCK_SIZE), BD_ERROR_DEVICE_ERROR);
|
||||
}
|
||||
|
||||
TEST_F(HeapBlockDeviceTest, erase_uninitialized)
|
||||
{
|
||||
mbed::HeapBlockDevice one{DEVICE_SIZE};
|
||||
EXPECT_EQ(one.erase(DEVICE_SIZE, BLOCK_SIZE), BD_ERROR_DEVICE_ERROR);
|
||||
}
|
||||
|
||||
TEST_F(HeapBlockDeviceTest, read_unprogrammed)
|
||||
{
|
||||
uint8_t *buf = new uint8_t[BLOCK_SIZE];
|
||||
EXPECT_EQ(bd.read(buf, DEVICE_SIZE - BLOCK_SIZE, BLOCK_SIZE), BD_ERROR_OK);
|
||||
// Ignore the content, it is now zero, but does not need to be.
|
||||
delete[] buf;
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
|
||||
####################
|
||||
# UNIT TESTS
|
||||
####################
|
||||
|
||||
set(unittest-includes ${unittest-includes}
|
||||
.
|
||||
..
|
||||
)
|
||||
|
||||
set(unittest-sources
|
||||
../features/storage/blockdevice/HeapBlockDevice.cpp
|
||||
stubs/mbed_atomic_stub.c
|
||||
stubs/mbed_assert_stub.c
|
||||
)
|
||||
|
||||
set(unittest-test-sources
|
||||
features/storage/blockdevice/HeapBlockDevice/test.cpp
|
||||
)
|
|
@ -0,0 +1,161 @@
|
|||
/* Copyright (c) 2019 ARM Limited
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "features/storage/blockdevice/HeapBlockDevice.h"
|
||||
#include "features/storage/blockdevice/SlicingBlockDevice.h"
|
||||
|
||||
#define BLOCK_SIZE (512)
|
||||
#define DEVICE_SIZE (BLOCK_SIZE*10)
|
||||
|
||||
class VerifyBorders_HeapBlockDevice : public mbed::HeapBlockDevice {
|
||||
public:
|
||||
mutable bool borders_crossed;
|
||||
mutable bd_size_t lower_limit;
|
||||
mutable bd_size_t upper_limit;
|
||||
|
||||
VerifyBorders_HeapBlockDevice(bd_size_t size)
|
||||
: HeapBlockDevice(size)
|
||||
{
|
||||
borders_crossed = false;
|
||||
lower_limit = 0;
|
||||
upper_limit = size;
|
||||
}
|
||||
|
||||
virtual bool is_valid_read(bd_addr_t addr, bd_size_t size) const
|
||||
{
|
||||
borders_crossed |= addr < lower_limit;
|
||||
borders_crossed |= addr + size > upper_limit;
|
||||
return BlockDevice::is_valid_read(addr, size);
|
||||
}
|
||||
|
||||
virtual bool is_valid_program(bd_addr_t addr, bd_size_t size) const
|
||||
{
|
||||
borders_crossed |= addr < lower_limit;
|
||||
borders_crossed |= addr + size > upper_limit;
|
||||
return BlockDevice::is_valid_program(addr, size);
|
||||
}
|
||||
|
||||
virtual bool is_valid_erase(bd_addr_t addr, bd_size_t size) const
|
||||
{
|
||||
borders_crossed |= addr < lower_limit;
|
||||
borders_crossed |= addr + size > upper_limit;
|
||||
return BlockDevice::is_valid_erase(addr, size);
|
||||
}
|
||||
};
|
||||
|
||||
class SlicingBlockModuleTest : public testing::Test {
|
||||
protected:
|
||||
VerifyBorders_HeapBlockDevice bd{DEVICE_SIZE};
|
||||
uint8_t *magic;
|
||||
uint8_t *buf;
|
||||
virtual void SetUp()
|
||||
{
|
||||
bd.init();
|
||||
magic = new uint8_t[BLOCK_SIZE];
|
||||
buf = new uint8_t[BLOCK_SIZE];
|
||||
// Generate simple pattern to verify against
|
||||
for (int i = 0; i < BLOCK_SIZE; i++) {
|
||||
magic[i] = 0xaa + i;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void TearDown()
|
||||
{
|
||||
bd.deinit();
|
||||
delete[] magic;
|
||||
delete[] buf;
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(SlicingBlockModuleTest, constructor)
|
||||
{
|
||||
mbed::SlicingBlockDevice slice(&bd, 0, bd.size());
|
||||
EXPECT_EQ(slice.init(), BD_ERROR_OK);
|
||||
EXPECT_EQ(slice.get_read_size(), bd.get_read_size());
|
||||
EXPECT_EQ(slice.get_program_size(), bd.get_read_size());
|
||||
EXPECT_EQ(slice.get_erase_size(), bd.get_read_size());
|
||||
EXPECT_EQ(slice.get_erase_size(0), bd.get_read_size());
|
||||
EXPECT_EQ(slice.deinit(), BD_ERROR_OK);
|
||||
}
|
||||
|
||||
TEST_F(SlicingBlockModuleTest, slice_in_middle)
|
||||
{
|
||||
uint8_t *program = new uint8_t[BLOCK_SIZE] {0xbb,0xbb,0xbb};
|
||||
|
||||
//Write magic value to heap block before and after the space for slice
|
||||
bd.program(magic, 0, BLOCK_SIZE);
|
||||
bd.program(magic, BLOCK_SIZE * 3, BLOCK_SIZE);
|
||||
|
||||
bd.upper_limit = BLOCK_SIZE * 3;
|
||||
bd.lower_limit = BLOCK_SIZE;
|
||||
bd.borders_crossed = false;
|
||||
|
||||
//Skip first block, then create sclicing device, with size of 2 blocks
|
||||
mbed::SlicingBlockDevice slice(&bd, BLOCK_SIZE, BLOCK_SIZE * 3);
|
||||
EXPECT_EQ(slice.init(), BD_ERROR_OK);
|
||||
EXPECT_EQ(BLOCK_SIZE * 2, slice.size());
|
||||
EXPECT_EQ(bd.borders_crossed, false);
|
||||
|
||||
//Program a test value
|
||||
EXPECT_EQ(slice.program(program, 0, BLOCK_SIZE), BD_ERROR_OK);
|
||||
EXPECT_EQ(slice.program(program, BLOCK_SIZE, BLOCK_SIZE), BD_ERROR_OK);
|
||||
EXPECT_EQ(bd.borders_crossed, false);
|
||||
|
||||
//Verify that blocks before and after the slicing blocks are not touched
|
||||
bd.read(buf, 0, BLOCK_SIZE);
|
||||
EXPECT_EQ(0, memcmp(buf, magic, BLOCK_SIZE));
|
||||
bd.read(buf, BLOCK_SIZE * 3, BLOCK_SIZE);
|
||||
EXPECT_EQ(0, memcmp(buf, magic, BLOCK_SIZE));
|
||||
}
|
||||
|
||||
TEST_F(SlicingBlockModuleTest, slice_at_the_end)
|
||||
{
|
||||
uint8_t *program = new uint8_t[BLOCK_SIZE] {0xbb,0xbb,0xbb};
|
||||
|
||||
//Write magic value to heap block before the space for slice
|
||||
// our bd is 10*BLOCK_SIZE, so sector 7
|
||||
bd.program(magic, BLOCK_SIZE * 7, BLOCK_SIZE);
|
||||
|
||||
//Screate sclicing device, with size of 2 blocks
|
||||
// Use negative index
|
||||
mbed::SlicingBlockDevice slice(&bd, -BLOCK_SIZE*2);
|
||||
EXPECT_EQ(slice.init(), BD_ERROR_OK);
|
||||
EXPECT_EQ(BLOCK_SIZE * 2, slice.size());
|
||||
|
||||
//Program a test value
|
||||
EXPECT_EQ(slice.program(program, 0, BLOCK_SIZE), BD_ERROR_OK);
|
||||
EXPECT_EQ(slice.program(program, BLOCK_SIZE, BLOCK_SIZE), BD_ERROR_OK);
|
||||
|
||||
//Verify that blocks before and after the slicing blocks are not touched
|
||||
bd.read(buf, BLOCK_SIZE * 7, BLOCK_SIZE);
|
||||
EXPECT_EQ(0, memcmp(buf, magic, BLOCK_SIZE));
|
||||
}
|
||||
|
||||
TEST_F(SlicingBlockModuleTest, over_write)
|
||||
{
|
||||
uint8_t *program = new uint8_t[BLOCK_SIZE] {0xbb,0xbb,0xbb};
|
||||
|
||||
//Screate sclicing device, with size of 2 blocks
|
||||
mbed::SlicingBlockDevice slice(&bd, BLOCK_SIZE, BLOCK_SIZE * 3);
|
||||
EXPECT_EQ(slice.init(), BD_ERROR_OK);
|
||||
|
||||
EXPECT_EQ(slice.program(program, 0, BLOCK_SIZE), BD_ERROR_OK);
|
||||
EXPECT_EQ(slice.program(program, BLOCK_SIZE, BLOCK_SIZE), BD_ERROR_OK);
|
||||
//Program a test value to address that is one pass the device size
|
||||
EXPECT_EQ(slice.program(program, 2 * BLOCK_SIZE, BLOCK_SIZE), BD_ERROR_DEVICE_ERROR);
|
||||
delete[] program;
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
####################
|
||||
# UNIT TESTS
|
||||
####################
|
||||
|
||||
set(unittest-includes ${unittest-includes}
|
||||
.
|
||||
..
|
||||
)
|
||||
|
||||
set(unittest-sources
|
||||
../features/storage/blockdevice/SlicingBlockDevice.cpp
|
||||
../features/storage/blockdevice/HeapBlockDevice.cpp
|
||||
stubs/mbed_atomic_stub.c
|
||||
stubs/mbed_assert_stub.c
|
||||
)
|
||||
|
||||
set(unittest-test-sources
|
||||
moduletests/storage/blockdevice/SlicingBlockDevice/moduletest.cpp
|
||||
)
|
|
@ -31,6 +31,11 @@ const char *NetworkInterface::get_ip_address()
|
|||
return 0;
|
||||
}
|
||||
|
||||
nsapi_error_t NetworkInterface::get_ipv6_link_local_address(SocketAddress *address)
|
||||
{
|
||||
return NSAPI_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
const char *NetworkInterface::get_netmask()
|
||||
{
|
||||
return 0;
|
||||
|
|
|
@ -93,6 +93,12 @@ const char *NetworkStack::get_ip_address()
|
|||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
nsapi_error_t NetworkStack::get_ipv6_link_local_address(SocketAddress *address)
|
||||
{
|
||||
return NSAPI_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
const char *NetworkStack::get_ip_address_if(const char *interface_name)
|
||||
{
|
||||
return NULL;
|
||||
|
|
|
@ -57,113 +57,143 @@ uint32_t core_util_atomic_exchange_u32(volatile uint32_t *ptr, uint32_t desiredV
|
|||
|
||||
uint8_t core_util_atomic_incr_u8(volatile uint8_t *valuePtr, uint8_t delta)
|
||||
{
|
||||
return 0;
|
||||
return *valuePtr += delta;
|
||||
}
|
||||
|
||||
uint16_t core_util_atomic_incr_u16(volatile uint16_t *valuePtr, uint16_t delta)
|
||||
{
|
||||
return 0;
|
||||
return *valuePtr += delta;
|
||||
}
|
||||
|
||||
uint32_t core_util_atomic_incr_u32(volatile uint32_t *valuePtr, uint32_t delta)
|
||||
{
|
||||
return 0;
|
||||
return *valuePtr += delta;
|
||||
}
|
||||
|
||||
|
||||
uint8_t core_util_atomic_decr_u8(volatile uint8_t *valuePtr, uint8_t delta)
|
||||
{
|
||||
return 0;
|
||||
return *valuePtr -= delta;
|
||||
}
|
||||
|
||||
uint16_t core_util_atomic_decr_u16(volatile uint16_t *valuePtr, uint16_t delta)
|
||||
{
|
||||
return 0;
|
||||
return *valuePtr -= delta;
|
||||
}
|
||||
|
||||
uint32_t core_util_atomic_decr_u32(volatile uint32_t *valuePtr, uint32_t delta)
|
||||
{
|
||||
return 0;
|
||||
return *valuePtr -= delta;
|
||||
}
|
||||
|
||||
|
||||
uint8_t core_util_atomic_fetch_add_u8(volatile uint8_t *valuePtr, uint8_t arg)
|
||||
{
|
||||
return 0;
|
||||
uint8_t v = *valuePtr;
|
||||
*valuePtr += arg;
|
||||
return v;
|
||||
}
|
||||
|
||||
uint16_t core_util_atomic_fetch_add_u16(volatile uint16_t *valuePtr, uint16_t arg)
|
||||
{
|
||||
return 0;
|
||||
uint16_t v = *valuePtr;
|
||||
*valuePtr += arg;
|
||||
return v;
|
||||
}
|
||||
|
||||
uint32_t core_util_atomic_fetch_add_u32(volatile uint32_t *valuePtr, uint32_t arg)
|
||||
{
|
||||
return 0;
|
||||
uint32_t v = *valuePtr;
|
||||
*valuePtr += arg;
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
uint8_t core_util_atomic_fetch_sub_u8(volatile uint8_t *valuePtr, uint8_t arg)
|
||||
{
|
||||
return 0;
|
||||
uint8_t v = *valuePtr;
|
||||
*valuePtr -= arg;
|
||||
return v;
|
||||
}
|
||||
|
||||
uint16_t core_util_atomic_fetch_sub_u16(volatile uint16_t *valuePtr, uint16_t arg)
|
||||
{
|
||||
return 0;
|
||||
uint16_t v = *valuePtr;
|
||||
*valuePtr -= arg;
|
||||
return v;
|
||||
}
|
||||
|
||||
uint32_t core_util_atomic_fetch_sub_u32(volatile uint32_t *valuePtr, uint32_t arg)
|
||||
{
|
||||
return 0;
|
||||
uint32_t v = *valuePtr;
|
||||
*valuePtr -= arg;
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
uint8_t core_util_atomic_fetch_and_u8(volatile uint8_t *valuePtr, uint8_t arg)
|
||||
{
|
||||
return 0;
|
||||
uint8_t v = *valuePtr;
|
||||
*valuePtr &= arg;
|
||||
return v;
|
||||
}
|
||||
|
||||
uint16_t core_util_atomic_fetch_and_u16(volatile uint16_t *valuePtr, uint16_t arg)
|
||||
{
|
||||
return 0;
|
||||
uint16_t v = *valuePtr;
|
||||
*valuePtr &= arg;
|
||||
return v;
|
||||
}
|
||||
|
||||
uint32_t core_util_atomic_fetch_and_u32(volatile uint32_t *valuePtr, uint32_t arg)
|
||||
{
|
||||
return 0;
|
||||
uint32_t v = *valuePtr;
|
||||
*valuePtr &= arg;
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
uint8_t core_util_atomic_fetch_or_u8(volatile uint8_t *valuePtr, uint8_t arg)
|
||||
{
|
||||
return 0;
|
||||
uint8_t v = *valuePtr;
|
||||
*valuePtr |= arg;
|
||||
return v;
|
||||
}
|
||||
|
||||
uint16_t core_util_atomic_fetch_or_u16(volatile uint16_t *valuePtr, uint16_t arg)
|
||||
{
|
||||
return 0;
|
||||
uint16_t v = *valuePtr;
|
||||
*valuePtr |= arg;
|
||||
return v;
|
||||
}
|
||||
|
||||
uint32_t core_util_atomic_fetch_or_u32(volatile uint32_t *valuePtr, uint32_t arg)
|
||||
{
|
||||
return 0;
|
||||
uint32_t v = *valuePtr;
|
||||
*valuePtr |= arg;
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
uint8_t core_util_atomic_fetch_xor_u8(volatile uint8_t *valuePtr, uint8_t arg)
|
||||
{
|
||||
return 0;
|
||||
uint8_t v = *valuePtr;
|
||||
*valuePtr ^= arg;
|
||||
return v;
|
||||
}
|
||||
|
||||
uint16_t core_util_atomic_fetch_xor_u16(volatile uint16_t *valuePtr, uint16_t arg)
|
||||
{
|
||||
return 0;
|
||||
uint16_t v = *valuePtr;
|
||||
*valuePtr ^= arg;
|
||||
return v;
|
||||
}
|
||||
|
||||
uint32_t core_util_atomic_fetch_xor_u32(volatile uint32_t *valuePtr, uint32_t arg)
|
||||
{
|
||||
return 0;
|
||||
uint32_t v = *valuePtr;
|
||||
*valuePtr ^= arg;
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -36,8 +36,13 @@ typedef enum {
|
|||
typedef enum {
|
||||
} PinMode;
|
||||
|
||||
typedef enum {
|
||||
PortA = 0,
|
||||
} PortName;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "pinmap.h"
|
||||
|
||||
#endif
|
||||
|
|
|
@ -64,6 +64,7 @@ typedef void *osEventFlagsId_t;
|
|||
|
||||
/// Attributes structure for thread.
|
||||
typedef struct {
|
||||
int unused;
|
||||
} osThreadAttr_t;
|
||||
|
||||
#define osWaitForever 0xFFFFFFFFU ///< Wait forever timeout value.
|
||||
|
|
|
@ -19,5 +19,6 @@
|
|||
#define MBED_DEVICE_H
|
||||
|
||||
#include "objects.h"
|
||||
#include "PinNames.h"
|
||||
|
||||
#endif
|
||||
|
|
|
@ -27,6 +27,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
typedef struct {
|
||||
int unused;
|
||||
} gpio_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -33,6 +33,42 @@ struct serial_s {
|
|||
int x;
|
||||
};
|
||||
|
||||
struct dac_s {
|
||||
int unused;
|
||||
};
|
||||
|
||||
struct i2c_s {
|
||||
int unused;
|
||||
};
|
||||
|
||||
struct qspi_s {
|
||||
int unused;
|
||||
};
|
||||
|
||||
struct spi_s {
|
||||
int unused;
|
||||
};
|
||||
|
||||
struct analogin_s {
|
||||
int unused;
|
||||
};
|
||||
|
||||
struct port_s {
|
||||
int unused;
|
||||
};
|
||||
|
||||
struct pwmout_s {
|
||||
int unused;
|
||||
};
|
||||
|
||||
struct flash_s {
|
||||
int unused;
|
||||
};
|
||||
|
||||
struct can_s {
|
||||
int unused;
|
||||
};
|
||||
|
||||
#include "gpio_object.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
/* Copyright (c) 2019 ARM Limited
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __CTHUNK_H__
|
||||
#define __CTHUNK_H__
|
||||
|
||||
/**
|
||||
* Class for created a pointer with data bound to it
|
||||
*
|
||||
* @note Synchronization level: Not protected
|
||||
*/
|
||||
template<class T>
|
||||
class CThunk {
|
||||
public:
|
||||
typedef void (T::*CCallbackSimple)(void);
|
||||
typedef void (T::*CCallback)(void *context);
|
||||
CThunk()
|
||||
{}
|
||||
CThunk(T *instance)
|
||||
{}
|
||||
CThunk(T &instance)
|
||||
{}
|
||||
void callback(CCallback callback)
|
||||
{}
|
||||
|
||||
void callback(CCallbackSimple callback)
|
||||
{
|
||||
}
|
||||
uint32_t entry(void)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif/*__CTHUNK_H__*/
|
||||
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
#define MBED_POWER_MGMT_H
|
||||
extern void mock_system_reset();
|
||||
|
||||
MBED_NORETURN static inline void system_reset(void)
|
||||
static inline void system_reset(void)
|
||||
{
|
||||
mock_system_reset();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/*
|
||||
* Copyright (c) , Arm Limited and affiliates.
|
||||
/* Copyright (c) 2019 ARM Limited
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
@ -15,4 +14,23 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
typedef void *Semaphore;
|
||||
#ifndef SEMAPHORE_H
|
||||
#define SEMAPHORE_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "cmsis_os2.h"
|
||||
|
||||
namespace rtos {
|
||||
class Semaphore {
|
||||
public:
|
||||
Semaphore(int32_t count = 0) {};
|
||||
Semaphore(int32_t count, uint16_t max_count) {};
|
||||
void acquire() {};
|
||||
bool try_acquire() { return false; };
|
||||
bool try_acquire_for(uint32_t millisec) { return false; };
|
||||
bool try_acquire_until(uint64_t millisec) { return false; };
|
||||
osStatus release(void) {return 0;};
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
* Copyright (c) 2019 ARM Limited
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef THREAD_H
|
||||
#define THREAD_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "cmsis_os.h"
|
||||
|
||||
namespace rtos {
|
||||
|
||||
class Thread {
|
||||
public:
|
||||
|
||||
Thread(osPriority priority = osPriorityNormal,
|
||||
uint32_t stack_size = OS_STACK_SIZE,
|
||||
unsigned char *stack_mem = nullptr, const char *name = nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
Thread(uint32_t tz_module, osPriority priority = osPriorityNormal,
|
||||
uint32_t stack_size = OS_STACK_SIZE,
|
||||
unsigned char *stack_mem = nullptr, const char *name = nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
osStatus start(mbed::Callback<void()> task) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
osStatus join() {return 0;};
|
||||
osStatus terminate(){return 0;};
|
||||
osStatus set_priority(osPriority priority){return 0;};
|
||||
osPriority get_priority() const{return osPriorityNormal;};
|
||||
uint32_t flags_set(uint32_t flags){return 0;};
|
||||
|
||||
/** State of the Thread */
|
||||
enum State {
|
||||
Inactive, /**< NOT USED */
|
||||
Ready, /**< Ready to run */
|
||||
Running, /**< Running */
|
||||
WaitingDelay, /**< Waiting for a delay to occur */
|
||||
WaitingJoin, /**< Waiting for thread to join. Only happens when using RTX directly. */
|
||||
WaitingThreadFlag, /**< Waiting for a thread flag to be set */
|
||||
WaitingEventFlag, /**< Waiting for a event flag to be set */
|
||||
WaitingMutex, /**< Waiting for a mutex event to occur */
|
||||
WaitingSemaphore, /**< Waiting for a semaphore event to occur */
|
||||
WaitingMemoryPool, /**< Waiting for a memory pool */
|
||||
WaitingMessageGet, /**< Waiting for message to arrive */
|
||||
WaitingMessagePut, /**< Waiting for message to be send */
|
||||
WaitingInterval, /**< NOT USED */
|
||||
WaitingOr, /**< NOT USED */
|
||||
WaitingAnd, /**< NOT USED */
|
||||
WaitingMailbox, /**< NOT USED (Mail is implemented as MemoryPool and Queue) */
|
||||
|
||||
/* Not in sync with RTX below here */
|
||||
Deleted, /**< The task has been deleted or not started */
|
||||
};
|
||||
|
||||
State get_state() const {
|
||||
return Ready;
|
||||
};
|
||||
uint32_t stack_size() const {
|
||||
return 0;
|
||||
};
|
||||
uint32_t free_stack() const {
|
||||
return 0;
|
||||
};
|
||||
uint32_t used_stack() const {
|
||||
return 0;
|
||||
};
|
||||
uint32_t max_stack() const {
|
||||
return 0;
|
||||
};
|
||||
const char *get_name() const {
|
||||
return "";
|
||||
};
|
||||
osThreadId_t get_id() const {
|
||||
return 0;
|
||||
};
|
||||
};
|
||||
}
|
||||
#endif
|
|
@ -137,6 +137,9 @@ class CoverageAPI(object):
|
|||
coverage_path = os.path.join(build_path, "coverage")
|
||||
if not os.path.exists(coverage_path):
|
||||
os.mkdir(coverage_path)
|
||||
coverage_output = os.path.join(coverage_path, "index.html")
|
||||
else:
|
||||
coverage_output = os.path.join(build_path, "coverage.xml")
|
||||
|
||||
# Generate the command
|
||||
args = self._gen_cmd(output, excludes, filter_regex)
|
||||
|
@ -145,4 +148,4 @@ class CoverageAPI(object):
|
|||
execute_program(
|
||||
args,
|
||||
"%s code coverage report generation failed." % output.upper(),
|
||||
"%s code coverage report created." % output.upper())
|
||||
"%s code coverage report created in %s" % (output.upper(), coverage_output))
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,68 @@
|
|||
/* Copyright (c) 2017-2019 ARM Limited
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
* THIS FILE IS AN AUTO-GENERATED FILE - DO NOT MODIFY IT.
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
* Template Version 1.0
|
||||
* Generated by tools/psa/generate_partition_code.py Version 1.1
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __TFM_PARTITION_DEFS_INC__
|
||||
#define __TFM_PARTITION_DEFS_INC__
|
||||
|
||||
/*************************** Service Partitions *******************************/
|
||||
|
||||
#define ATTEST_SRV_ID (TFM_SP_BASE + 0)
|
||||
#define CRYPTO_SRV_ID (TFM_SP_BASE + 1)
|
||||
#define PLATFORM_ID (TFM_SP_BASE + 2)
|
||||
#define ITS_ID (TFM_SP_BASE + 3)
|
||||
|
||||
/*************************** Test Partitions **********************************/
|
||||
|
||||
#ifdef USE_PSA_TEST_PARTITIONS
|
||||
|
||||
#ifdef USE_CRYPTO_ACL_TEST
|
||||
#define CRYPTO_ACL_TEST_ID (TFM_SP_BASE + 4 + 0)
|
||||
#endif
|
||||
|
||||
#ifdef USE_CLIENT_TESTS_PART1
|
||||
#define CLIENT_TESTS_PART1_ID (TFM_SP_BASE + 4 + 1)
|
||||
#endif
|
||||
|
||||
#ifdef USE_SERVER_TESTS_PART1
|
||||
#define SERVER_TESTS_PART1_ID (TFM_SP_BASE + 4 + 2)
|
||||
#endif
|
||||
|
||||
#ifdef USE_SERVER_TESTS_PART2
|
||||
#define SERVER_TESTS_PART2_ID (TFM_SP_BASE + 4 + 3)
|
||||
#endif
|
||||
|
||||
#ifdef USE_SMOKE_TESTS_PART1
|
||||
#define SMOKE_TESTS_PART1_ID (TFM_SP_BASE + 4 + 4)
|
||||
#endif
|
||||
|
||||
#endif // USE_PSA_TEST_PARTITIONS
|
||||
|
||||
#ifdef USE_PSA_TEST_PARTITIONS
|
||||
#define TFM_MAX_USER_PARTITIONS (4 + 5)
|
||||
#else
|
||||
#define TFM_MAX_USER_PARTITIONS (4)
|
||||
#endif
|
||||
|
||||
#endif // __TFM_PARTITION_DEFS_INC__
|
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2019, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
* THIS FILE IS AN AUTO-GENERATED FILE - DO NOT MODIFY IT.
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
* Template Version 1.0
|
||||
* Generated by tools/psa/generate_partition_code.py Version 1.1
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __TFM_PARTITION_LIST_INC__
|
||||
#define __TFM_PARTITION_LIST_INC__
|
||||
|
||||
/*************************** Service Partitions *******************************/
|
||||
/* -----------------------------------------------------------------------------
|
||||
* ATTEST_SRV
|
||||
* -------------------------------------------------------------------------- */
|
||||
PARTITION_DECLARE(ATTEST_SRV, 0
|
||||
| SPM_PART_FLAG_IPC
|
||||
, "APPLICATION-ROT", 37, NORMAL, 8192);
|
||||
PARTITION_ADD_INIT_FUNC(ATTEST_SRV, attest_main);
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* CRYPTO_SRV
|
||||
* -------------------------------------------------------------------------- */
|
||||
PARTITION_DECLARE(CRYPTO_SRV, 0
|
||||
| SPM_PART_FLAG_IPC
|
||||
, "APPLICATION-ROT", 35, NORMAL, 16384);
|
||||
PARTITION_ADD_INIT_FUNC(CRYPTO_SRV, crypto_main);
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* PLATFORM
|
||||
* -------------------------------------------------------------------------- */
|
||||
PARTITION_DECLARE(PLATFORM, 0
|
||||
| SPM_PART_FLAG_IPC
|
||||
, "APPLICATION-ROT", 8, NORMAL, 1024);
|
||||
PARTITION_ADD_INIT_FUNC(PLATFORM, platform_partition_entry);
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* ITS
|
||||
* -------------------------------------------------------------------------- */
|
||||
PARTITION_DECLARE(ITS, 0
|
||||
| SPM_PART_FLAG_IPC
|
||||
, "APPLICATION-ROT", 10, NORMAL, 2048);
|
||||
PARTITION_ADD_INIT_FUNC(ITS, its_entry);
|
||||
|
||||
/*************************** Test Partitions **********************************/
|
||||
#ifdef USE_PSA_TEST_PARTITIONS
|
||||
|
||||
#ifdef USE_CRYPTO_ACL_TEST
|
||||
/* -----------------------------------------------------------------------------
|
||||
* CRYPTO_ACL_TEST
|
||||
* -------------------------------------------------------------------------- */
|
||||
PARTITION_DECLARE(CRYPTO_ACL_TEST, 0
|
||||
| SPM_PART_FLAG_IPC
|
||||
, "APPLICATION-ROT", 128, NORMAL, 512);
|
||||
PARTITION_ADD_INIT_FUNC(CRYPTO_ACL_TEST, test_partition_main);
|
||||
#endif // USE_CRYPTO_ACL_TEST
|
||||
|
||||
#ifdef USE_CLIENT_TESTS_PART1
|
||||
/* -----------------------------------------------------------------------------
|
||||
* CLIENT_TESTS_PART1
|
||||
* -------------------------------------------------------------------------- */
|
||||
PARTITION_DECLARE(CLIENT_TESTS_PART1, 0
|
||||
| SPM_PART_FLAG_IPC
|
||||
, "APPLICATION-ROT", 1, NORMAL, 1024);
|
||||
PARTITION_ADD_INIT_FUNC(CLIENT_TESTS_PART1, client_part_main);
|
||||
#endif // USE_CLIENT_TESTS_PART1
|
||||
|
||||
#ifdef USE_SERVER_TESTS_PART1
|
||||
/* -----------------------------------------------------------------------------
|
||||
* SERVER_TESTS_PART1
|
||||
* -------------------------------------------------------------------------- */
|
||||
PARTITION_DECLARE(SERVER_TESTS_PART1, 0
|
||||
| SPM_PART_FLAG_IPC
|
||||
, "APPLICATION-ROT", 2, NORMAL, 1024);
|
||||
PARTITION_ADD_INIT_FUNC(SERVER_TESTS_PART1, server_part1_main);
|
||||
#endif // USE_SERVER_TESTS_PART1
|
||||
|
||||
#ifdef USE_SERVER_TESTS_PART2
|
||||
/* -----------------------------------------------------------------------------
|
||||
* SERVER_TESTS_PART2
|
||||
* -------------------------------------------------------------------------- */
|
||||
PARTITION_DECLARE(SERVER_TESTS_PART2, 0
|
||||
| SPM_PART_FLAG_IPC
|
||||
, "APPLICATION-ROT", 3, NORMAL, 1024);
|
||||
PARTITION_ADD_INIT_FUNC(SERVER_TESTS_PART2, server_part2_main);
|
||||
#endif // USE_SERVER_TESTS_PART2
|
||||
|
||||
#ifdef USE_SMOKE_TESTS_PART1
|
||||
/* -----------------------------------------------------------------------------
|
||||
* SMOKE_TESTS_PART1
|
||||
* -------------------------------------------------------------------------- */
|
||||
PARTITION_DECLARE(SMOKE_TESTS_PART1, 0
|
||||
| SPM_PART_FLAG_IPC
|
||||
, "APPLICATION-ROT", 4, NORMAL, 512);
|
||||
PARTITION_ADD_INIT_FUNC(SMOKE_TESTS_PART1, smoke_part_main);
|
||||
#endif // USE_SMOKE_TESTS_PART1
|
||||
|
||||
#endif // USE_PSA_TEST_PARTITIONS
|
||||
|
||||
#endif // __TFM_PARTITION_LIST_INC__
|
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2019, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
* THIS FILE IS AN AUTO-GENERATED FILE - DO NOT MODIFY IT.
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
* Template Version 1.0
|
||||
* Generated by tools/psa/generate_partition_code.py Version 1.1
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __TFM_SERVICE_LIST_INC__
|
||||
#define __TFM_SERVICE_LIST_INC__
|
||||
|
||||
/*************************** Service Partitions *******************************/
|
||||
/* -----------------------------------------------------------------------------
|
||||
* ATTEST_SRV Services
|
||||
* -------------------------------------------------------------------------- */
|
||||
{"PSA_ATTEST_GET_TOKEN_ID", ATTEST_SRV_ID, PSA_ATTEST_GET_TOKEN, 0x00000F10, true, 1, TFM_VERSION_POLICY_STRICT},
|
||||
{"PSA_ATTEST_GET_TOKEN_SIZE_ID", ATTEST_SRV_ID, PSA_ATTEST_GET_TOKEN_SIZE, 0x00000F11, true, 1, TFM_VERSION_POLICY_STRICT},
|
||||
{"PSA_ATTEST_INJECT_KEY_ID", ATTEST_SRV_ID, PSA_ATTEST_INJECT_KEY, 0x00000F12, true, 1, TFM_VERSION_POLICY_STRICT},
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* CRYPTO_SRV Services
|
||||
* -------------------------------------------------------------------------- */
|
||||
{"PSA_CRYPTO_INIT_ID", CRYPTO_SRV_ID, PSA_CRYPTO_INIT, 0x00000F00, true, 1, TFM_VERSION_POLICY_STRICT},
|
||||
{"PSA_MAC_ID", CRYPTO_SRV_ID, PSA_MAC, 0x00000F01, true, 1, TFM_VERSION_POLICY_STRICT},
|
||||
{"PSA_HASH_ID", CRYPTO_SRV_ID, PSA_HASH, 0x00000F02, true, 1, TFM_VERSION_POLICY_STRICT},
|
||||
{"PSA_ASYMMETRIC_ID", CRYPTO_SRV_ID, PSA_ASYMMETRIC, 0x00000F03, true, 1, TFM_VERSION_POLICY_STRICT},
|
||||
{"PSA_SYMMETRIC_ID", CRYPTO_SRV_ID, PSA_SYMMETRIC, 0x00000F04, true, 1, TFM_VERSION_POLICY_STRICT},
|
||||
{"PSA_AEAD_ID", CRYPTO_SRV_ID, PSA_AEAD, 0x00000F05, true, 1, TFM_VERSION_POLICY_STRICT},
|
||||
{"PSA_KEY_MNG_ID", CRYPTO_SRV_ID, PSA_KEY_MNG, 0x00000F06, true, 1, TFM_VERSION_POLICY_STRICT},
|
||||
{"PSA_RNG_ID", CRYPTO_SRV_ID, PSA_RNG, 0x00000F07, true, 1, TFM_VERSION_POLICY_STRICT},
|
||||
{"PSA_CRYPTO_FREE_ID", CRYPTO_SRV_ID, PSA_CRYPTO_FREE, 0x00000F08, true, 1, TFM_VERSION_POLICY_STRICT},
|
||||
{"PSA_KEY_DERIVATION_ID", CRYPTO_SRV_ID, PSA_KEY_DERIVATION, 0x00000F09, true, 1, TFM_VERSION_POLICY_STRICT},
|
||||
{"PSA_ENTROPY_ID", CRYPTO_SRV_ID, PSA_ENTROPY_INJECT, 0x00000F0A, true, 1, TFM_VERSION_POLICY_STRICT},
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* PLATFORM Services
|
||||
* -------------------------------------------------------------------------- */
|
||||
{"PSA_PLATFORM_LC_GET", PLATFORM_ID, PSA_PLATFORM_LC_GET_MSK, 0x00011000, true, 1, TFM_VERSION_POLICY_RELAXED},
|
||||
{"PSA_PLATFORM_LC_SET", PLATFORM_ID, PSA_PLATFORM_LC_SET_MSK, 0x00011001, true, 1, TFM_VERSION_POLICY_RELAXED},
|
||||
{"PSA_PLATFORM_SYSTEM_RESET", PLATFORM_ID, PSA_PLATFORM_SYSTEM_RESET_MSK, 0x00011002, true, 1, TFM_VERSION_POLICY_RELAXED},
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* ITS Services
|
||||
* -------------------------------------------------------------------------- */
|
||||
{"PSA_ITS_GET", ITS_ID, PSA_ITS_GET_MSK, 0x00011A00, true, 1, TFM_VERSION_POLICY_RELAXED},
|
||||
{"PSA_ITS_SET", ITS_ID, PSA_ITS_SET_MSK, 0x00011A01, true, 1, TFM_VERSION_POLICY_RELAXED},
|
||||
{"PSA_ITS_INFO", ITS_ID, PSA_ITS_INFO_MSK, 0x00011A02, true, 1, TFM_VERSION_POLICY_RELAXED},
|
||||
{"PSA_ITS_REMOVE", ITS_ID, PSA_ITS_REMOVE_MSK, 0x00011A03, true, 1, TFM_VERSION_POLICY_RELAXED},
|
||||
{"PSA_ITS_RESET", ITS_ID, PSA_ITS_RESET_MSK, 0x00011A04, false, 1, TFM_VERSION_POLICY_RELAXED},
|
||||
|
||||
/*************************** Test Partitions **********************************/
|
||||
#ifdef USE_PSA_TEST_PARTITIONS
|
||||
|
||||
#ifdef USE_CRYPTO_ACL_TEST
|
||||
/* -----------------------------------------------------------------------------
|
||||
* CRYPTO_ACL_TEST Services
|
||||
* -------------------------------------------------------------------------- */
|
||||
{"CRYPTO_GENERATE_KEY", CRYPTO_ACL_TEST_ID, CRYPTO_GENERATE_KEY_MSK, 0x00000201, true, 1, TFM_VERSION_POLICY_RELAXED},
|
||||
{"CRYPTO_OPEN_KEY", CRYPTO_ACL_TEST_ID, CRYPTO_OPEN_KEY_MSK, 0x00000202, true, 1, TFM_VERSION_POLICY_RELAXED},
|
||||
{"CRYPTO_CLOSE_KEY", CRYPTO_ACL_TEST_ID, CRYPTO_CLOSE_KEY_MSK, 0x00000203, true, 1, TFM_VERSION_POLICY_RELAXED},
|
||||
{"CRYPTO_DESTROY_KEY", CRYPTO_ACL_TEST_ID, CRYPTO_DESTROY_KEY_MSK, 0x00000205, true, 1, TFM_VERSION_POLICY_RELAXED},
|
||||
{"CRYPTO_GET_KEY_ATTRIBUTES", CRYPTO_ACL_TEST_ID, CRYPTO_GET_KEY_ATTRIBUTES_MSK, 0x00000206, true, 1, TFM_VERSION_POLICY_RELAXED},
|
||||
{"CRYPTO_IMPORT_KEY", CRYPTO_ACL_TEST_ID, CRYPTO_IMPORT_KEY_MSK, 0x00000208, true, 1, TFM_VERSION_POLICY_RELAXED},
|
||||
#endif // USE_CRYPTO_ACL_TEST
|
||||
|
||||
#ifdef USE_CLIENT_TESTS_PART1
|
||||
/* -----------------------------------------------------------------------------
|
||||
* CLIENT_TESTS_PART1 Services
|
||||
* -------------------------------------------------------------------------- */
|
||||
{"CLIENT_TESTS_PART1_ROT_SRV1", CLIENT_TESTS_PART1_ID, PART1_ROT_SRV1_MSK, 0x00001A05, true, 5, TFM_VERSION_POLICY_RELAXED},
|
||||
{"CLIENT_TESTS_PART1_DROP_CONN", CLIENT_TESTS_PART1_ID, DROP_CONN_MSK, 0x00001A06, true, 5, TFM_VERSION_POLICY_RELAXED},
|
||||
{"CLIENT_TESTS_PART1_SECURE_CLIENTS_ONLY", CLIENT_TESTS_PART1_ID, SECURE_CLIENTS_ONLY_MSK, 0x00001A07, false, 5, TFM_VERSION_POLICY_RELAXED},
|
||||
#endif // USE_CLIENT_TESTS_PART1
|
||||
|
||||
#ifdef USE_SERVER_TESTS_PART1
|
||||
/* -----------------------------------------------------------------------------
|
||||
* SERVER_TESTS_PART1 Services
|
||||
* -------------------------------------------------------------------------- */
|
||||
{"SERVER_TESTS_PART1_CONTROL", SERVER_TESTS_PART1_ID, CONTROL_MSK, 0x00001A01, true, 5, TFM_VERSION_POLICY_RELAXED},
|
||||
{"SERVER_TESTS_PART1_TEST", SERVER_TESTS_PART1_ID, TEST_MSK, 0x00001A02, true, 12, TFM_VERSION_POLICY_STRICT},
|
||||
#endif // USE_SERVER_TESTS_PART1
|
||||
|
||||
#ifdef USE_SERVER_TESTS_PART2
|
||||
/* -----------------------------------------------------------------------------
|
||||
* SERVER_TESTS_PART2 Services
|
||||
* -------------------------------------------------------------------------- */
|
||||
{"SERVER_TESTS_PART2_ROT_SRV_REVERSE", SERVER_TESTS_PART2_ID, ROT_SRV_REVERSE_MSK, 0x00001A03, false, 5, TFM_VERSION_POLICY_STRICT},
|
||||
{"SERVER_TESTS_PART2_ROT_SRV_DB_TST", SERVER_TESTS_PART2_ID, ROT_SRV_DB_TST_MSK, 0x00001A04, false, 5, TFM_VERSION_POLICY_STRICT},
|
||||
#endif // USE_SERVER_TESTS_PART2
|
||||
|
||||
#ifdef USE_SMOKE_TESTS_PART1
|
||||
/* -----------------------------------------------------------------------------
|
||||
* SMOKE_TESTS_PART1 Services
|
||||
* -------------------------------------------------------------------------- */
|
||||
{"SMOKE_TESTS_PART1_ROT_SRV1", SMOKE_TESTS_PART1_ID, ROT_SRV1_MSK, 0x00001A00, true, 5, TFM_VERSION_POLICY_RELAXED},
|
||||
#endif // USE_SMOKE_TESTS_PART1
|
||||
|
||||
#endif // USE_PSA_TEST_PARTITIONS
|
||||
|
||||
#endif // __TFM_SERVICE_LIST_INC__
|
|
@ -0,0 +1,143 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2019, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
* THIS FILE IS AN AUTO-GENERATED FILE - DO NOT MODIFY IT.
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
* Template Version 1.0
|
||||
* Generated by tools/psa/generate_partition_code.py Version 1.1
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __TFM_SPM_SIGNAL_DEFS_H__
|
||||
#define __TFM_SPM_SIGNAL_DEFS_H__
|
||||
|
||||
/*************************** Service Partitions *******************************/
|
||||
/* -----------------------------------------------------------------------------
|
||||
* ATTEST_SRV Signals
|
||||
* -------------------------------------------------------------------------- */
|
||||
#define PSA_ATTEST_GET_TOKEN_POS (4UL)
|
||||
#define PSA_ATTEST_GET_TOKEN (1UL << PSA_ATTEST_GET_TOKEN_POS)
|
||||
#define PSA_ATTEST_GET_TOKEN_SIZE_POS (5UL)
|
||||
#define PSA_ATTEST_GET_TOKEN_SIZE (1UL << PSA_ATTEST_GET_TOKEN_SIZE_POS)
|
||||
#define PSA_ATTEST_INJECT_KEY_POS (6UL)
|
||||
#define PSA_ATTEST_INJECT_KEY (1UL << PSA_ATTEST_INJECT_KEY_POS)
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* CRYPTO_SRV Signals
|
||||
* -------------------------------------------------------------------------- */
|
||||
#define PSA_CRYPTO_INIT_POS (4UL)
|
||||
#define PSA_CRYPTO_INIT (1UL << PSA_CRYPTO_INIT_POS)
|
||||
#define PSA_MAC_POS (5UL)
|
||||
#define PSA_MAC (1UL << PSA_MAC_POS)
|
||||
#define PSA_HASH_POS (6UL)
|
||||
#define PSA_HASH (1UL << PSA_HASH_POS)
|
||||
#define PSA_ASYMMETRIC_POS (7UL)
|
||||
#define PSA_ASYMMETRIC (1UL << PSA_ASYMMETRIC_POS)
|
||||
#define PSA_SYMMETRIC_POS (8UL)
|
||||
#define PSA_SYMMETRIC (1UL << PSA_SYMMETRIC_POS)
|
||||
#define PSA_AEAD_POS (9UL)
|
||||
#define PSA_AEAD (1UL << PSA_AEAD_POS)
|
||||
#define PSA_KEY_MNG_POS (10UL)
|
||||
#define PSA_KEY_MNG (1UL << PSA_KEY_MNG_POS)
|
||||
#define PSA_RNG_POS (11UL)
|
||||
#define PSA_RNG (1UL << PSA_RNG_POS)
|
||||
#define PSA_CRYPTO_FREE_POS (12UL)
|
||||
#define PSA_CRYPTO_FREE (1UL << PSA_CRYPTO_FREE_POS)
|
||||
#define PSA_KEY_DERIVATION_POS (13UL)
|
||||
#define PSA_KEY_DERIVATION (1UL << PSA_KEY_DERIVATION_POS)
|
||||
#define PSA_ENTROPY_INJECT_POS (14UL)
|
||||
#define PSA_ENTROPY_INJECT (1UL << PSA_ENTROPY_INJECT_POS)
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* PLATFORM Signals
|
||||
* -------------------------------------------------------------------------- */
|
||||
#define PSA_PLATFORM_LC_GET_MSK_POS (4UL)
|
||||
#define PSA_PLATFORM_LC_GET_MSK (1UL << PSA_PLATFORM_LC_GET_MSK_POS)
|
||||
#define PSA_PLATFORM_LC_SET_MSK_POS (5UL)
|
||||
#define PSA_PLATFORM_LC_SET_MSK (1UL << PSA_PLATFORM_LC_SET_MSK_POS)
|
||||
#define PSA_PLATFORM_SYSTEM_RESET_MSK_POS (6UL)
|
||||
#define PSA_PLATFORM_SYSTEM_RESET_MSK (1UL << PSA_PLATFORM_SYSTEM_RESET_MSK_POS)
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* ITS Signals
|
||||
* -------------------------------------------------------------------------- */
|
||||
#define PSA_ITS_GET_MSK_POS (4UL)
|
||||
#define PSA_ITS_GET_MSK (1UL << PSA_ITS_GET_MSK_POS)
|
||||
#define PSA_ITS_SET_MSK_POS (5UL)
|
||||
#define PSA_ITS_SET_MSK (1UL << PSA_ITS_SET_MSK_POS)
|
||||
#define PSA_ITS_INFO_MSK_POS (6UL)
|
||||
#define PSA_ITS_INFO_MSK (1UL << PSA_ITS_INFO_MSK_POS)
|
||||
#define PSA_ITS_REMOVE_MSK_POS (7UL)
|
||||
#define PSA_ITS_REMOVE_MSK (1UL << PSA_ITS_REMOVE_MSK_POS)
|
||||
#define PSA_ITS_RESET_MSK_POS (8UL)
|
||||
#define PSA_ITS_RESET_MSK (1UL << PSA_ITS_RESET_MSK_POS)
|
||||
|
||||
/*************************** Test Partitions **********************************/
|
||||
#ifdef USE_PSA_TEST_PARTITIONS
|
||||
|
||||
#ifdef USE_CRYPTO_ACL_TEST
|
||||
/* -----------------------------------------------------------------------------
|
||||
* CRYPTO_ACL_TEST Signals
|
||||
* -------------------------------------------------------------------------- */
|
||||
#define CRYPTO_GENERATE_KEY_MSK_POS (4UL)
|
||||
#define CRYPTO_GENERATE_KEY_MSK (1UL << CRYPTO_GENERATE_KEY_MSK_POS)
|
||||
#define CRYPTO_OPEN_KEY_MSK_POS (5UL)
|
||||
#define CRYPTO_OPEN_KEY_MSK (1UL << CRYPTO_OPEN_KEY_MSK_POS)
|
||||
#define CRYPTO_CLOSE_KEY_MSK_POS (6UL)
|
||||
#define CRYPTO_CLOSE_KEY_MSK (1UL << CRYPTO_CLOSE_KEY_MSK_POS)
|
||||
#define CRYPTO_DESTROY_KEY_MSK_POS (7UL)
|
||||
#define CRYPTO_DESTROY_KEY_MSK (1UL << CRYPTO_DESTROY_KEY_MSK_POS)
|
||||
#define CRYPTO_GET_KEY_ATTRIBUTES_MSK_POS (8UL)
|
||||
#define CRYPTO_GET_KEY_ATTRIBUTES_MSK (1UL << CRYPTO_GET_KEY_ATTRIBUTES_MSK_POS)
|
||||
#define CRYPTO_IMPORT_KEY_MSK_POS (9UL)
|
||||
#define CRYPTO_IMPORT_KEY_MSK (1UL << CRYPTO_IMPORT_KEY_MSK_POS)
|
||||
#endif // USE_CRYPTO_ACL_TEST
|
||||
|
||||
#ifdef USE_CLIENT_TESTS_PART1
|
||||
/* -----------------------------------------------------------------------------
|
||||
* CLIENT_TESTS_PART1 Signals
|
||||
* -------------------------------------------------------------------------- */
|
||||
#define PART1_ROT_SRV1_MSK_POS (4UL)
|
||||
#define PART1_ROT_SRV1_MSK (1UL << PART1_ROT_SRV1_MSK_POS)
|
||||
#define DROP_CONN_MSK_POS (5UL)
|
||||
#define DROP_CONN_MSK (1UL << DROP_CONN_MSK_POS)
|
||||
#define SECURE_CLIENTS_ONLY_MSK_POS (6UL)
|
||||
#define SECURE_CLIENTS_ONLY_MSK (1UL << SECURE_CLIENTS_ONLY_MSK_POS)
|
||||
#endif // USE_CLIENT_TESTS_PART1
|
||||
|
||||
#ifdef USE_SERVER_TESTS_PART1
|
||||
/* -----------------------------------------------------------------------------
|
||||
* SERVER_TESTS_PART1 Signals
|
||||
* -------------------------------------------------------------------------- */
|
||||
#define CONTROL_MSK_POS (4UL)
|
||||
#define CONTROL_MSK (1UL << CONTROL_MSK_POS)
|
||||
#define TEST_MSK_POS (5UL)
|
||||
#define TEST_MSK (1UL << TEST_MSK_POS)
|
||||
#endif // USE_SERVER_TESTS_PART1
|
||||
|
||||
#ifdef USE_SERVER_TESTS_PART2
|
||||
/* -----------------------------------------------------------------------------
|
||||
* SERVER_TESTS_PART2 Signals
|
||||
* -------------------------------------------------------------------------- */
|
||||
#define ROT_SRV_REVERSE_MSK_POS (4UL)
|
||||
#define ROT_SRV_REVERSE_MSK (1UL << ROT_SRV_REVERSE_MSK_POS)
|
||||
#define ROT_SRV_DB_TST_MSK_POS (5UL)
|
||||
#define ROT_SRV_DB_TST_MSK (1UL << ROT_SRV_DB_TST_MSK_POS)
|
||||
#endif // USE_SERVER_TESTS_PART2
|
||||
|
||||
#ifdef USE_SMOKE_TESTS_PART1
|
||||
/* -----------------------------------------------------------------------------
|
||||
* SMOKE_TESTS_PART1 Signals
|
||||
* -------------------------------------------------------------------------- */
|
||||
#define ROT_SRV1_MSK_POS (4UL)
|
||||
#define ROT_SRV1_MSK (1UL << ROT_SRV1_MSK_POS)
|
||||
#endif // USE_SMOKE_TESTS_PART1
|
||||
|
||||
#endif // USE_PSA_TEST_PARTITIONS
|
||||
|
||||
#endif // __TFM_SPM_SIGNAL_DEFS_H__
|
|
@ -29,7 +29,7 @@ client_test_t test_a001_attestation_list[] = {
|
|||
|
||||
static int g_test_count = 1;
|
||||
|
||||
int32_t psa_initial_attestation_get_token_test(security_t caller)
|
||||
int32_t psa_initial_attestation_get_token_test(caller_security_t caller)
|
||||
{
|
||||
int num_checks = sizeof(check1)/sizeof(check1[0]);
|
||||
uint32_t i, status, token_size;
|
||||
|
@ -75,7 +75,7 @@ int32_t psa_initial_attestation_get_token_test(security_t caller)
|
|||
return VAL_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t psa_initial_attestation_get_token_size_test(security_t caller)
|
||||
int32_t psa_initial_attestation_get_token_size_test(caller_security_t caller)
|
||||
{
|
||||
int num_checks = sizeof(check2)/sizeof(check2[0]);
|
||||
uint32_t i, status, token_size;
|
||||
|
|
|
@ -28,6 +28,6 @@ extern val_api_t *val;
|
|||
extern psa_api_t *psa;
|
||||
extern client_test_t test_a001_attestation_list[];
|
||||
|
||||
int32_t psa_initial_attestation_get_token_test(security_t caller);
|
||||
int32_t psa_initial_attestation_get_token_size_test(security_t caller);
|
||||
int32_t psa_initial_attestation_get_token_test(caller_security_t caller);
|
||||
int32_t psa_initial_attestation_get_token_size_test(caller_security_t caller);
|
||||
#endif /* _TEST_A001_CLIENT_TESTS_H_ */
|
||||
|
|
|
@ -141,7 +141,7 @@ static int32_t sst_remove_stray_uid(psa_sst_uid_t p_uid)
|
|||
return VAL_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t psa_sst_uid_not_found(security_t caller)
|
||||
int32_t psa_sst_uid_not_found(caller_security_t caller)
|
||||
{
|
||||
int32_t test_status;
|
||||
psa_sst_uid_t uid = UID_BASE_VALUE + 6;
|
||||
|
|
|
@ -31,5 +31,5 @@ extern val_api_t *val;
|
|||
extern psa_api_t *psa;
|
||||
extern client_test_t test_s001_sst_list[];
|
||||
|
||||
int32_t psa_sst_uid_not_found(security_t caller);
|
||||
int32_t psa_sst_uid_not_found(caller_security_t caller);
|
||||
#endif /* _TEST_S001_CLIENT_TESTS_H_ */
|
||||
|
|
|
@ -35,7 +35,7 @@ client_test_t test_s002_sst_list[] = {
|
|||
NULL,
|
||||
};
|
||||
|
||||
int32_t psa_sst_update_write_once_flag_after_create(security_t caller)
|
||||
int32_t psa_sst_update_write_once_flag_after_create(caller_security_t caller)
|
||||
{
|
||||
uint32_t status;
|
||||
psa_sst_uid_t uid = UID_WRITE_ONCE_1;
|
||||
|
@ -84,7 +84,7 @@ int32_t psa_sst_update_write_once_flag_after_create(security_t caller)
|
|||
}
|
||||
|
||||
|
||||
int32_t psa_sst_create_with_write_once_flag(security_t caller)
|
||||
int32_t psa_sst_create_with_write_once_flag(caller_security_t caller)
|
||||
{
|
||||
uint32_t status;
|
||||
psa_sst_uid_t uid = UID_WRITE_ONCE_2;
|
||||
|
|
|
@ -31,6 +31,6 @@ extern val_api_t *val;
|
|||
extern psa_api_t *psa;
|
||||
extern client_test_t test_s002_sst_list[];
|
||||
|
||||
int32_t psa_sst_update_write_once_flag_after_create(security_t caller);
|
||||
int32_t psa_sst_create_with_write_once_flag(security_t caller);
|
||||
int32_t psa_sst_update_write_once_flag_after_create(caller_security_t caller);
|
||||
int32_t psa_sst_create_with_write_once_flag(caller_security_t caller);
|
||||
#endif /* _TEST_S002_CLIENT_TESTS_H_ */
|
||||
|
|
|
@ -39,7 +39,7 @@ static char test_desc[2][80] = {
|
|||
"Overload storage space\n",
|
||||
"Overload storage again to verify all previous UID removed\n"};
|
||||
|
||||
int32_t psa_sst_insufficient_space(security_t caller)
|
||||
int32_t psa_sst_insufficient_space(caller_security_t caller)
|
||||
{
|
||||
uint32_t status = PSA_SST_SUCCESS;
|
||||
psa_sst_uid_t uid;
|
||||
|
|
|
@ -31,5 +31,5 @@ extern val_api_t *val;
|
|||
extern psa_api_t *psa;
|
||||
extern client_test_t test_s003_sst_list[];
|
||||
|
||||
int32_t psa_sst_insufficient_space(security_t caller);
|
||||
int32_t psa_sst_insufficient_space(caller_security_t caller);
|
||||
#endif /* _TEST_S003_CLIENT_TESTS_H_ */
|
||||
|
|
|
@ -37,7 +37,7 @@ static uint8_t read_buff[TEST_BUFF_SIZE] = {0};
|
|||
static uint8_t write_buff[TEST_BUFF_SIZE] = {0x99, 0x01, 0x30, 0x50, 0x04, 0x23, 0xF6, 0x07, 0x08, \
|
||||
0x0D, 0x70, 0xA1, 0xFF, 0xFF, 0x14, 0x73, 0x46, 0x97, 0xE8, 0xDD};
|
||||
|
||||
int32_t psa_sst_get_data_check(security_t caller)
|
||||
int32_t psa_sst_get_data_check(caller_security_t caller)
|
||||
{
|
||||
uint32_t status,j;
|
||||
|
||||
|
|
|
@ -31,5 +31,5 @@ extern val_api_t *val;
|
|||
extern psa_api_t *psa;
|
||||
extern client_test_t test_s004_sst_list[];
|
||||
|
||||
int32_t psa_sst_get_data_check(security_t caller);
|
||||
int32_t psa_sst_get_data_check(caller_security_t caller);
|
||||
#endif /* _TEST_S004_CLIENT_TESTS_H_ */
|
||||
|
|
|
@ -64,7 +64,7 @@ static int32_t psa_sst_apis_check(psa_sst_uid_t uid, uint32_t data_len,
|
|||
return VAL_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t psa_sst_apis_check_success_case(security_t caller)
|
||||
int32_t psa_sst_apis_check_success_case(caller_security_t caller)
|
||||
{
|
||||
psa_sst_uid_t uid = UID_BASE_VALUE + 4;
|
||||
uint32_t data_len = 0, status = VAL_STATUS_SUCCESS;
|
||||
|
|
|
@ -31,6 +31,6 @@ extern val_api_t *val;
|
|||
extern psa_api_t *psa;
|
||||
extern client_test_t test_s005_sst_list[];
|
||||
|
||||
int32_t psa_sst_apis_check_success_case(security_t caller);
|
||||
int32_t psa_sst_apis_check_success_case(caller_security_t caller);
|
||||
|
||||
#endif /* _TEST_S005_CLIENT_TESTS_H_ */
|
||||
|
|
|
@ -53,7 +53,7 @@ static int32_t psa_sst_remove_api(psa_sst_uid_t uid, uint32_t data_len,
|
|||
return VAL_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t psa_sst_flags_not_supported(security_t caller)
|
||||
int32_t psa_sst_flags_not_supported(caller_security_t caller)
|
||||
{
|
||||
psa_sst_create_flags_t flag = 0x80000000;
|
||||
uint32_t status = VAL_STATUS_SUCCESS;
|
||||
|
|
|
@ -31,6 +31,6 @@ extern val_api_t *val;
|
|||
extern psa_api_t *psa;
|
||||
extern client_test_t test_s006_sst_list[];
|
||||
|
||||
int32_t psa_sst_flags_not_supported(security_t caller);
|
||||
int32_t psa_sst_flags_not_supported(caller_security_t caller);
|
||||
|
||||
#endif /* _TEST_S006_CLIENT_TESTS_H_ */
|
||||
|
|
|
@ -37,7 +37,7 @@ static uint8_t write_buff[TEST_BUFF_SIZE] = {
|
|||
0x70, 0xA1, 0xFF, 0xFF, 0x14, 0x73, 0x46, 0x97, 0xE8, 0xDD, 0xCA, 0x0B, 0x3C, 0x0D, 0x2E};
|
||||
static uint8_t read_buff[TEST_BUFF_SIZE];
|
||||
|
||||
int32_t psa_sst_get_incorrect_size(security_t caller)
|
||||
int32_t psa_sst_get_incorrect_size(caller_security_t caller)
|
||||
{
|
||||
psa_sst_uid_t uid = UID_BASE_VALUE + 5;
|
||||
uint32_t status = VAL_STATUS_SUCCESS;
|
||||
|
|
|
@ -31,6 +31,6 @@ extern val_api_t *val;
|
|||
extern psa_api_t *psa;
|
||||
extern client_test_t test_s007_sst_list[];
|
||||
|
||||
int32_t psa_sst_get_incorrect_size(security_t caller);
|
||||
int32_t psa_sst_get_incorrect_size(caller_security_t caller);
|
||||
|
||||
#endif /* _TEST_S007_CLIENT_TESTS_H_ */
|
||||
|
|
|
@ -39,7 +39,7 @@ static uint8_t read_buff[TEST_BUFF_SIZE];
|
|||
static uint8_t write_buff[TEST_BUFF_SIZE] = {0x99, 0x01, 0x02, 0x03, 0x04, 0x23, 0xF6, 0x07, 0x08, \
|
||||
0x0D, 0x70, 0xA1, 0xFF, 0xFF, 0x14, 0x73, 0x46, 0x97, 0xE8, 0xDD};
|
||||
|
||||
int32_t psa_sst_invalid_offset_failure(security_t caller)
|
||||
int32_t psa_sst_invalid_offset_failure(caller_security_t caller)
|
||||
{
|
||||
uint32_t status, j;
|
||||
|
||||
|
@ -80,7 +80,7 @@ int32_t psa_sst_invalid_offset_failure(security_t caller)
|
|||
return VAL_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t psa_sst_valid_offset_success(security_t caller)
|
||||
int32_t psa_sst_valid_offset_success(caller_security_t caller)
|
||||
{
|
||||
uint32_t status, data_len, offset = TEST_BUFF_SIZE;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ extern val_api_t *val;
|
|||
extern psa_api_t *psa;
|
||||
extern client_test_t test_s008_sst_list[];
|
||||
|
||||
int32_t psa_sst_valid_offset_success(security_t caller);
|
||||
int32_t psa_sst_invalid_offset_failure(security_t caller);
|
||||
int32_t psa_sst_valid_offset_success(caller_security_t caller);
|
||||
int32_t psa_sst_invalid_offset_failure(caller_security_t caller);
|
||||
|
||||
#endif /* _TEST_S008_CLIENT_TESTS_H_ */
|
||||
|
|
|
@ -36,7 +36,7 @@ static psa_sst_uid_t uid = UID_BASE_VALUE + 5;
|
|||
static uint8_t write_buff[TEST_BUFF_SIZE] = {0x99, 0x01, 0x02, 0x03, 0x04, 0x23, 0xF6, 0x07, 0x08, \
|
||||
0x0D, 0x70, 0xA1, 0xFF, 0xFF, 0x14, 0x73, 0x46, 0x97, 0xE8, 0xDD};
|
||||
|
||||
int32_t psa_sst_zero_length_check(security_t caller)
|
||||
int32_t psa_sst_zero_length_check(caller_security_t caller)
|
||||
{
|
||||
uint32_t status;
|
||||
|
||||
|
|
|
@ -31,6 +31,6 @@ extern val_api_t *val;
|
|||
extern psa_api_t *psa;
|
||||
extern client_test_t test_s009_sst_list[];
|
||||
|
||||
int32_t psa_sst_zero_length_check(security_t caller);
|
||||
int32_t psa_sst_zero_length_check(caller_security_t caller);
|
||||
|
||||
#endif /* _TEST_S009_CLIENT_TESTS_H_ */
|
||||
|
|
|
@ -34,7 +34,7 @@ client_test_t test_s010_sst_list[] = {
|
|||
|
||||
static uint8_t write_buff[TEST_BUFF_SIZE] = {0xFF};
|
||||
|
||||
int32_t psa_sst_uid_value_zero_check(security_t caller)
|
||||
int32_t psa_sst_uid_value_zero_check(caller_security_t caller)
|
||||
{
|
||||
int32_t status;
|
||||
psa_sst_uid_t uid = 0;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue