Merge pull request #11894 from ARMmbed/release-candidate

Release candidate for mbed-os-5.14.2
mbed-os-5.14 mbed-os-5.14.2
Martin Kojtal 2019-11-20 14:13:16 +01:00 committed by GitHub
commit cf4f12a123
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
942 changed files with 223668 additions and 54517 deletions

View File

@ -31,3 +31,4 @@
^TESTS/mbed_hal/trng/pithy ^TESTS/mbed_hal/trng/pithy
^TESTS/mbed_hal/trng/pithy ^TESTS/mbed_hal/trng/pithy
^tools ^tools
^UNITTESTS

View File

@ -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 Required
Add here detailed changes summary, testing results, dependencies Add here detailed changes summary, testing results, dependencies
Good example: https://os.mbed.com/docs/mbed-os/latest/contributing/workflow.html (Pull request template) 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 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 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. description heading and to add a 'x' to the correct box.
--> -->
[ ] Fix [] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[ ] Refactor [] Feature update (New feature / Functionality change / New API)
[ ] Target update [] Major update (Breaking change E.g. Return code change / API behaviour change)
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking 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 Optional
Request additional reviewers with @username Request additional reviewers with @username
--> -->
### Release Notes ----------------------------------------------------------------------------------------------------------------
### Release Notes (*required for feature/major PRs*)
<!-- <!--
Optional All 3 sections are compulsory for Major PR types. For Feature PRs only the summary section is required.
In case of breaking changes, functionality changes or refactors, please add release notes here. 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). 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

View File

@ -16,7 +16,6 @@ limitations under the License.
""" """
import time import time
from mbed_host_tests import BaseHostTest from mbed_host_tests import BaseHostTest
from mbed_host_tests.host_tests_runner.host_test_default import DefaultTestSelector
DEFAULT_SYNC_DELAY = 4.0 DEFAULT_SYNC_DELAY = 4.0
@ -32,6 +31,7 @@ MSG_KEY_RESET_REASON_RAW = 'reason_raw'
MSG_KEY_RESET_REASON = 'reason' MSG_KEY_RESET_REASON = 'reason'
MSG_KEY_DEVICE_RESET = 'reset' MSG_KEY_DEVICE_RESET = 'reset'
MSG_KEY_SYNC = '__sync' MSG_KEY_SYNC = '__sync'
MSG_KEY_RESET_COMPLETE = 'reset_complete'
RESET_REASONS = { RESET_REASONS = {
'POWER_ON': '0', '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_RAW, self.cb_reset_reason_raw)
self.register_callback(MSG_KEY_RESET_REASON, self.cb_reset_reason) 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_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): def cb_device_ready(self, key, value, timestamp):
"""Request a raw value of the reset_reason register. """Request a raw value of the reset_reason register.
@ -142,7 +143,10 @@ class ResetReasonTest(BaseHostTest):
__ignored_clear_ack = yield __ignored_clear_ack = yield
# Reset the device using DAP. # 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 reset_reason = yield
raise_if_different(RESET_REASONS['PIN_RESET'], reset_reason, 'Wrong reset reason. ') raise_if_different(RESET_REASONS['PIN_RESET'], reset_reason, 'Wrong reset reason. ')
self.send_kv(MSG_KEY_RESET_REASON, MSG_VALUE_RESET_REASON_CLEAR) self.send_kv(MSG_KEY_RESET_REASON, MSG_VALUE_RESET_REASON_CLEAR)

View File

@ -16,6 +16,9 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "mbed_trace.h"
#define TRACE_GROUP "GRNT"
#define ETHERNET 1 #define ETHERNET 1
#define WIFI 2 #define WIFI 2

View File

@ -25,6 +25,7 @@
#include "unity/unity.h" #include "unity/unity.h"
#include "greentea-client/test_env.h" #include "greentea-client/test_env.h"
#include <string> #include <string>
#include "common_defines_test.h"
#define MAX_THREADS 5 #define MAX_THREADS 5
@ -91,7 +92,7 @@ size_t download_test(NetworkInterface *interface, const unsigned char *data, siz
break; break;
} }
ThisThread::sleep_for(1000); 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"); 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 { } else {
TEST_ASSERT_MESSAGE(0, "wrong thread id"); 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; event_fired[thread_id] = false;
/* setup request */ /* setup request */
@ -118,7 +119,7 @@ size_t download_test(NetworkInterface *interface, const unsigned char *data, siz
/* construct request */ /* construct request */
size_t req_len = snprintf(request, REQ_BUF_SIZE - 1, req_template, dl_path, dl_host); size_t req_len = snprintf(request, REQ_BUF_SIZE - 1, req_template, dl_path, dl_host);
request[req_len] = 0; 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 */ /* send request to server */
result = tcpsocket.send(request, req_len); 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]; char *receive_buffer = &g_receive_buffer[thread_id * RECV_BUF_SIZE];
tcpsocket.set_blocking(false); 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; size_t received_bytes = 0;
int body_index = -1; int body_index = -1;
@ -164,7 +165,7 @@ size_t download_test(NetworkInterface *interface, const unsigned char *data, siz
if (body_index < 0) { if (body_index < 0) {
continue; continue;
} else { } 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 */ /* remove header before comparison */
memmove(receive_buffer, &receive_buffer[body_index + 4], result - body_index - 4); 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(); speed = float(received_bytes) / timer.read();
percent = float(received_bytes) * 100 / float(data_length); percent = float(received_bytes) * 100 / float(data_length);
time_left = (data_length - received_bytes) / speed; time_left = (data_length - received_bytes) / speed;
printf("[NET-%d] Received bytes: %u, (%.2f%%, %.2fKB/s, ETA: %02d:%02d:%02d)\r\n", tr_info("[NET-%d] Received bytes: %u, (%.2f%%, %.2fKB/s, ETA: %02d:%02d:%02d)",
thread_id, received_bytes, percent, speed / 1024, thread_id, received_bytes, percent, speed / 1024,
time_left / 3600, (time_left / 60) % 60, time_left % 60); time_left / 3600, (time_left / 60) % 60, time_left % 60);
} }
} while ((result > 0) && (received_bytes < data_length)); } while ((result > 0) && (received_bytes < data_length));
} }
@ -195,10 +196,10 @@ size_t download_test(NetworkInterface *interface, const unsigned char *data, siz
timer.stop(); timer.stop();
float f_received_bytes = float(received_bytes); float f_received_bytes = float(received_bytes);
printf("[NET-%d] Downloaded: %.2fKB (%.2fKB/s, %.2f secs)\r\n", thread_id, tr_info("[NET-%d] Downloaded: %.2fKB (%.2fKB/s, %.2f secs)", thread_id,
f_received_bytes / 1024., f_received_bytes / 1024.,
f_received_bytes / (timer.read() * 1024.), f_received_bytes / (timer.read() * 1024.),
timer.read()); timer.read());
return received_bytes; return received_bytes;
} }

View File

@ -23,6 +23,7 @@
#include "mbed.h" #include "mbed.h"
#include "unity/unity.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) 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"); TEST_ASSERT_EQUAL_INT_MESSAGE(0, result, "could not close file");
timer.stop(); timer.stop();
printf("[FS] Wrote: \"%s\" %.2fKB (%.2fKB/s, %.2f secs)\r\n", file, tr_info("[FS] Wrote: \"%s\" %.2fKB (%.2fKB/s, %.2f secs)", file,
float(data_length) / 1024, float(data_length) / timer.read() / 1024, timer.read()); 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) 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); free(buffer);
printf("[FS] Read : \"%s\" %.2fKB (%.2fKB/s, %.2f secs)\r\n", file, tr_info("[FS] Read : \"%s\" %.2fKB (%.2fKB/s, %.2f secs)", file,
float(data_length) / 1024, float(data_length) / timer.read() / 1024, timer.read()); float(data_length) / 1024, float(data_length) / timer.read() / 1024, timer.read());
} }

View File

@ -68,12 +68,12 @@ static control_t setup_network(const size_t call_count)
if (err == NSAPI_ERROR_OK) { if (err == NSAPI_ERROR_OK) {
break; break;
} else { } 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); TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);
printf("[NET] IP address is '%s'\n", interface->get_ip_address()); tr_info("[NET] IP address is '%s'", interface->get_ip_address());
printf("[NET] MAC address is '%s'\n", interface->get_mac_address()); tr_info("[NET] MAC address is '%s'", interface->get_mac_address());
return CaseNext; return CaseNext;
} }

View File

@ -68,12 +68,12 @@ static control_t setup_network(const size_t call_count)
if (err == NSAPI_ERROR_OK) { if (err == NSAPI_ERROR_OK) {
break; break;
} else { } 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); TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);
printf("[NET] IP address is '%s'\n", net->get_ip_address()); tr_info("[NET] IP address is '%s'", net->get_ip_address());
printf("[NET] MAC address is '%s'\n", net->get_mac_address()); tr_info("[NET] MAC address is '%s'", net->get_mac_address());
return CaseNext; return CaseNext;
} }

View File

@ -72,12 +72,12 @@ static control_t setup_network(const size_t call_count)
if (err == NSAPI_ERROR_OK) { if (err == NSAPI_ERROR_OK) {
break; break;
} else { } 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); TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);
printf("[NET] IP address is '%s'\n", interface->get_ip_address()); tr_info("[NET] IP address is '%s'", interface->get_ip_address());
printf("[NET] MAC address is '%s'\n", interface->get_mac_address()); tr_info("[NET] MAC address is '%s'", interface->get_mac_address());
return CaseNext; return CaseNext;
} }
@ -205,7 +205,7 @@ void test_malloc()
void *bufferTest = NULL; void *bufferTest = NULL;
TEST_ASSERT_MESSAGE(size > 0, "Size must not be zero for test"); 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); bufferTest = malloc(size);
TEST_ASSERT(bufferTest != NULL); TEST_ASSERT(bufferTest != NULL);
free(bufferTest); free(bufferTest);

View File

@ -143,6 +143,7 @@ void flashiap_cross_sector_program_test()
TEST_ASSERT_EQUAL_INT32(0, ret); TEST_ASSERT_EQUAL_INT32(0, ret);
uint32_t page_size = flash_device.get_page_size(); uint32_t page_size = flash_device.get_page_size();
uint8_t erase_value = flash_device.get_erase_value();
// Erase last two sectors // Erase last two sectors
uint32_t address = flash_device.get_flash_start() + flash_device.get_flash_size(); 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; data[i] = rand() % 256;
} }
for (uint32_t i = prog_size; i < aligned_prog_size; i++) { 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); ret = flash_device.program(data, address, prog_size);

View File

@ -23,4 +23,6 @@
#define QSPI_SECTOR_COUNT 1024 // for MX25R3235F #define QSPI_SECTOR_COUNT 1024 // for MX25R3235F
#endif #endif
#define QSPI_MIN_FREQUENCY 2000000
#endif // MBED_QSPI_FLASH_CONFIG_H #endif // MBED_QSPI_FLASH_CONFIG_H

View File

@ -82,7 +82,7 @@
#include "S25FL512S_config.h" #include "S25FL512S_config.h"
#elif defined(TARGET_CYW9P62S1_43012EVB_01) #elif defined(TARGET_CYW9P62S1_43012EVB_01)
#include "S25FS128S_config.h" #include "S25FS512S_config.h"
#elif defined(TARGET_CY8CPROTO_064_SB) #elif defined(TARGET_CY8CPROTO_064_SB)
#include "S25FL128S_config.h" #include "S25FL128S_config.h"

View File

@ -42,7 +42,9 @@ using namespace utest::v1;
#ifndef QSPI_MIN_FREQUENCY
#define QSPI_MIN_FREQUENCY 1000000 #define QSPI_MIN_FREQUENCY 1000000
#endif
// max write size is usually page size // max write size is usually page size
#define DATA_SIZE_256 (QSPI_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())); srand(ticker_read(get_us_ticker_data()));
uint32_t address = (((uint32_t)rand()) % QSPI_SECTOR_COUNT) * QSPI_SECTOR_SIZE; 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; 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); ret = qspi_init(&qspi.handle, QPIN_0, QPIN_1, QPIN_2, QPIN_3, QSCK, QCSN, freq, 0);
TEST_ASSERT_EQUAL(QSPI_STATUS_OK, ret); TEST_ASSERT_EQUAL(QSPI_STATUS_OK, ret);
do { while (ret == QSPI_STATUS_OK && freq >= QSPI_MIN_FREQUENCY) {
// check if the memory is working properly // check if the memory is working properly
qspi.cmd.configure(MODE_1_1_1, ADDR_SIZE_24, ALT_SIZE_8); qspi.cmd.configure(MODE_1_1_1, ADDR_SIZE_24, ALT_SIZE_8);
ret = qspi_frequency(&qspi.handle, freq);
flash_init(qspi); 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); _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); utest_printf("frequency setting %d [Hz] - OK\r\n", freq);
freq /= 2; freq /= 2;
ret = qspi_frequency(&qspi.handle, freq); }
} while (ret == QSPI_STATUS_OK && freq >= QSPI_MIN_FREQUENCY);
qspi_free(&qspi.handle); qspi_free(&qspi.handle);
} }

View File

@ -58,7 +58,7 @@ void QspiCommand::set_dummy_cycles(int dummy_cycles)
void QspiCommand::build(int instruction, int address, int alt) 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) { if (!_cmd.instruction.disabled) {
_cmd.instruction.value = instruction; _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); ret = qspi_command_transfer(&qspi.handle, qspi.cmd.get(), NULL, 0, status, QSPI_STATUS_REG_SIZE);
TEST_ASSERT_EQUAL(QSPI_STATUS_OK, ret); TEST_ASSERT_EQUAL(QSPI_STATUS_OK, ret);
qspi.cmd.build(QSPI_CMD_RSTEN); // Only do reset enable if device needs it
ret = qspi_command_transfer(&qspi.handle, qspi.cmd.get(), NULL, 0, NULL, 0); if (QSPI_CMD_RSTEN != 0) {
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);
WAIT_FOR(WRSR_MAX_TIME, qspi); WAIT_FOR(WRSR_MAX_TIME, qspi);
}
qspi.cmd.build(QSPI_CMD_RST); qspi.cmd.build(QSPI_CMD_RST);
ret = qspi_command_transfer(&qspi.handle, qspi.cmd.get(), NULL, 0, NULL, 0); ret = qspi_command_transfer(&qspi.handle, qspi.cmd.get(), NULL, 0, NULL, 0);
TEST_ASSERT_EQUAL(QSPI_STATUS_OK, ret); TEST_ASSERT_EQUAL(QSPI_STATUS_OK, ret);
WAIT_FOR(WAIT_MAX_TIME, qspi); 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);
} }

View File

@ -102,10 +102,10 @@ struct Qspi {
#define ADDR_SIZE_24 QSPI_CFG_ADDR_SIZE_24 #define ADDR_SIZE_24 QSPI_CFG_ADDR_SIZE_24
#define ADDR_SIZE_32 QSPI_CFG_ADDR_SIZE_32 #define ADDR_SIZE_32 QSPI_CFG_ADDR_SIZE_32
#define ALT_SIZE_8 8u #define ALT_SIZE_8 QSPI_CFG_ALT_SIZE_8
#define ALT_SIZE_16 16u #define ALT_SIZE_16 QSPI_CFG_ALT_SIZE_16
#define ALT_SIZE_24 24u #define ALT_SIZE_24 QSPI_CFG_ALT_SIZE_24
#define ALT_SIZE_32 32u #define ALT_SIZE_32 QSPI_CFG_ALT_SIZE_32
#define STATUS_REG QSPI_CMD_RDSR #define STATUS_REG QSPI_CMD_RDSR
#define CONFIG_REG0 QSPI_CMD_RDCR0 #define CONFIG_REG0 QSPI_CMD_RDCR0

View File

@ -437,11 +437,11 @@ void i2c_test_byte_read(PinName sda, PinName scl)
} }
Case cases[] = { Case cases[] = {
Case("i2c - init/free test all pins", all_ports<I2CPort, DefaultFormFactor, test_i2c_init_free>), Case("i2c - init/free test all pins", one_peripheral<I2CPort, DefaultFormFactor, test_i2c_init_free>),
Case("i2c - test write i2c API", all_peripherals<I2CPort, DefaultFormFactor, i2c_test_write>), Case("i2c - test write i2c API", one_peripheral<I2CPort, DefaultFormFactor, i2c_test_write>),
Case("i2c - test read i2c API", all_peripherals<I2CPort, DefaultFormFactor, i2c_test_read>), Case("i2c - test read i2c API", one_peripheral<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 write i2c API", one_peripheral<I2CPort, DefaultFormFactor, i2c_test_byte_write>),
Case("i2c - test single byte read i2c API", all_peripherals<I2CPort, DefaultFormFactor, i2c_test_byte_read>) 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) utest::v1::status_t greentea_test_setup(const size_t number_of_cases)

View File

@ -404,6 +404,21 @@ static control_t test_printf_x(const size_t call_count)
return CaseNext; 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 */ /* SNPRINTF */
@ -721,6 +736,34 @@ static control_t test_snprintf_x(const size_t call_count)
return CaseNext; 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 #if MBED_CONF_PLATFORM_MINIMAL_PRINTF_ENABLE_FLOATING_POINT
static control_t test_printf_f(const size_t call_count) static control_t test_printf_f(const size_t call_count)
{ {
@ -902,6 +945,9 @@ Case cases[] = {
Case("snprintf %u", test_snprintf_u), Case("snprintf %u", test_snprintf_u),
Case("printf %x", test_printf_x), Case("printf %x", test_printf_x),
Case("snprintf %x", test_snprintf_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 #if MBED_CONF_PLATFORM_MINIMAL_PRINTF_ENABLE_FLOATING_POINT
Case("printf %f", test_printf_f), Case("printf %f", test_printf_f),
Case("snprintf %f", test_snprintf_f), Case("snprintf %f", test_snprintf_f),

View File

@ -56,11 +56,11 @@ void ASYNCHRONOUS_DNS_CACHE()
int delay_ms = (ticker_us - started_us) / 1000; int delay_ms = (ticker_us - started_us) / 1000;
static int delay_first = delay_ms / 2; 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 // Check that cached accesses are at least twice as fast as the first one
TEST_ASSERT_TRUE(i == 0 || delay_ms <= delay_first); TEST_ASSERT_TRUE(i == 0 || delay_ms <= delay_first);
printf("DNS: query \"%s\" => \"%s\", time %i ms\n", tr_info("DNS: query \"%s\" => \"%s\", time %i ms",
dns_test_hosts[0], data.addr.get_ip_address(), delay_ms); dns_test_hosts[0], data.addr.get_ip_address(), delay_ms);
} }
} }

View File

@ -42,7 +42,7 @@ void ASYNCHRONOUS_DNS_CANCEL()
count++; count++;
} else { } else {
// No memory to initiate DNS query, callback will not be called // 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].result = data[i].req_result;
data[i].value_set = true; 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++) { for (unsigned int i = 0; i < MBED_CONF_APP_DNS_TEST_HOSTS_NUM; i++) {
if (!data[i].value_set) { 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; 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); 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) { if (data[i].result == NSAPI_ERROR_OK) {
printf("DNS: query \"%s\" => \"%s\"\n", tr_info("DNS: query \"%s\" => \"%s\"",
dns_test_hosts[i], data[i].addr.get_ip_address()); dns_test_hosts[i], data[i].addr.get_ip_address());
} else if (data[i].result == NSAPI_ERROR_DNS_FAILURE) { } 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) { } 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) { } 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) { } 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]);
} }
} }

View File

@ -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++) { for (unsigned int i = 0; i < MBED_CONF_APP_DNS_TEST_HOSTS_NUM; i++) {
SocketAddress addr; SocketAddress addr;
int err = get_interface()->gethostbyname(dns_test_hosts[i], &addr); int err = get_interface()->gethostbyname(dns_test_hosts[i], &addr);
printf("DNS: query \"%s\" => \"%s\"\n", tr_info("DNS: query \"%s\" => \"%s\"",
dns_test_hosts[i], addr.get_ip_address()); dns_test_hosts[i], addr.get_ip_address());
TEST_ASSERT_EQUAL(0, err); TEST_ASSERT_EQUAL(0, err);
TEST_ASSERT((bool)addr); TEST_ASSERT((bool)addr);
@ -49,8 +49,8 @@ void ASYNCHRONOUS_DNS_NON_ASYNC_AND_ASYNC()
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, data.result); TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, data.result);
printf("DNS: query \"%s\" => \"%s\"\n", tr_info("DNS: query \"%s\" => \"%s\"",
dns_test_hosts_second[0], data.addr.get_ip_address()); dns_test_hosts_second[0], data.addr.get_ip_address());
TEST_ASSERT(strlen(data.addr.get_ip_address()) > 1); TEST_ASSERT(strlen(data.addr.get_ip_address()) > 1);
} }

View File

@ -18,6 +18,10 @@
#ifndef DNS_TESTS_H #ifndef DNS_TESTS_H
#define DNS_TESTS_H #define DNS_TESTS_H
#include "mbed_trace.h"
#define TRACE_GROUP "GRNT"
#ifndef MBED_CONF_APP_DNS_SIMULT_QUERIES #ifndef MBED_CONF_APP_DNS_SIMULT_QUERIES
#ifdef MBED_CONF_CELLULAR_OFFLOAD_DNS_QUERIES #ifdef MBED_CONF_CELLULAR_OFFLOAD_DNS_QUERIES
#define MBED_CONF_APP_DNS_SIMULT_QUERIES MBED_CONF_CELLULAR_OFFLOAD_DNS_QUERIES #define MBED_CONF_APP_DNS_SIMULT_QUERIES MBED_CONF_CELLULAR_OFFLOAD_DNS_QUERIES

View File

@ -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); 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) { if (data[i].result == NSAPI_ERROR_OK) {
(*exp_ok)++; (*exp_ok)++;
printf("DNS: query \"%s\" => \"%s\"\n", tr_info("DNS: query \"%s\" => \"%s\"",
hosts[i], data[i].addr.get_ip_address()); hosts[i], data[i].addr.get_ip_address());
} else if (data[i].result == NSAPI_ERROR_DNS_FAILURE) { } else if (data[i].result == NSAPI_ERROR_DNS_FAILURE) {
(*exp_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) { } else if (data[i].result == NSAPI_ERROR_TIMEOUT) {
(*exp_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) { } else if (data[i].result == NSAPI_ERROR_NO_MEMORY) {
(*exp_no_mem)++; (*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) { } else if (data[i].result == NSAPI_ERROR_BUSY) {
(*exp_no_mem)++; (*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) { if (err == NSAPI_ERROR_OK) {
(*exp_ok)++; (*exp_ok)++;
printf("DNS: query \"%s\" => \"%s\"\n", tr_info("DNS: query \"%s\" => \"%s\"",
hosts[i], address.get_ip_address()); hosts[i], address.get_ip_address());
} else if (err == NSAPI_ERROR_DNS_FAILURE) { } else if (err == NSAPI_ERROR_DNS_FAILURE) {
(*exp_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) { } else if (err == NSAPI_ERROR_TIMEOUT) {
(*exp_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) { } else if (err == NSAPI_ERROR_NO_MEMORY) {
(*exp_no_mem)++; (*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) { } else if (err == NSAPI_ERROR_BUSY) {
(*exp_no_mem)++; (*exp_no_mem)++;
printf("DNS: query \"%s\" => busy\n", hosts[i]); tr_error("DNS: query \"%s\" => busy", hosts[i]);
} else { } 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); 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(); net = NetworkInterface::get_default_instance();
nsapi_error_t err = net->connect(); nsapi_error_t err = net->connect();
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err); 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() static void net_bringdown()
{ {
NetworkInterface::get_default_instance()->disconnect(); NetworkInterface::get_default_instance()->disconnect();
printf("MBED: ifdown\n"); tr_info("MBED: ifdown");
} }
// Test setup // Test setup

View File

@ -49,7 +49,7 @@ void SYNCHRONOUS_DNS_CACHE()
// Check that cached accesses are at least twice as fast as the first one // Check that cached accesses are at least twice as fast as the first one
TEST_ASSERT_TRUE(i == 0 || delay_ms <= delay_first); TEST_ASSERT_TRUE(i == 0 || delay_ms <= delay_first);
printf("DNS: query \"%s\" => \"%s\", time %i ms\n", tr_info("DNS: query \"%s\" => \"%s\", time %i ms",
dns_test_hosts[0], address.get_ip_address(), delay_ms); dns_test_hosts[0], address.get_ip_address(), delay_ms);
} }
} }

View File

@ -72,13 +72,13 @@ static void _ifup()
NetworkInterface *net = NetworkInterface::get_default_instance(); NetworkInterface *net = NetworkInterface::get_default_instance();
nsapi_error_t err = net->connect(); nsapi_error_t err = net->connect();
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err); 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() static void _ifdown()
{ {
NetworkInterface::get_default_instance()->disconnect(); 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) 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); NetworkInterface::get_default_instance()->gethostbyname(ECHO_SERVER_ADDR, &tcp_addr);
tcp_addr.set_port(port); 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()); nsapi_error_t err = sock.open(NetworkInterface::get_default_instance());
if (err != NSAPI_ERROR_OK) { if (err != NSAPI_ERROR_OK) {
printf("Error from sock.open: %d\n", err); tr_error("Error from sock.open: %d", err);
return err; return err;
} }
err = sock.connect(tcp_addr); err = sock.connect(tcp_addr);
if (err != NSAPI_ERROR_OK) { if (err != NSAPI_ERROR_OK) {
printf("Error from sock.connect: %d\n", err); tr_error("Error from sock.connect: %d", err);
return err; return err;
} }

View File

@ -19,6 +19,9 @@
#define TCP_TESTS_H #define TCP_TESTS_H
#include "../test_params.h" #include "../test_params.h"
#include "mbed_trace.h"
#define TRACE_GROUP "GRNT"
NetworkInterface *get_interface(); NetworkInterface *get_interface();
void drop_bad_packets(TCPSocket &sock, int orig_timeout); void drop_bad_packets(TCPSocket &sock, int orig_timeout);

View File

@ -72,11 +72,11 @@ void TCPSOCKET_ECHOTEST()
fill_tx_buffer_ascii(tcp_global::tx_buffer, BUFF_SIZE); fill_tx_buffer_ascii(tcp_global::tx_buffer, BUFF_SIZE);
sent = sock.send(tcp_global::tx_buffer, pkt_s); sent = sock.send(tcp_global::tx_buffer, pkt_s);
if (sent < 0) { 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(); TEST_FAIL();
break; break;
} else if (sent != pkt_s) { } 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(); TEST_FAIL();
break; break;
} }
@ -85,7 +85,7 @@ void TCPSOCKET_ECHOTEST()
while (bytes2recv) { while (bytes2recv) {
recvd = sock.recv(&(tcp_global::rx_buffer[sent - bytes2recv]), bytes2recv); recvd = sock.recv(&(tcp_global::rx_buffer[sent - bytes2recv]), bytes2recv);
if (recvd < 0) { 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_FAIL();
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.close()); TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.close());
return; return;
@ -110,7 +110,7 @@ void tcpsocket_echotest_nonblock_receive()
} }
return; return;
} else if (recvd < 0) { } else if (recvd < 0) {
printf("sock.recv returned an error %d", recvd); tr_error("sock.recv returned an error %d", recvd);
TEST_FAIL(); TEST_FAIL();
receive_error = true; receive_error = true;
} else { } else {
@ -171,7 +171,7 @@ void TCPSOCKET_ECHOTEST_NONBLOCK()
} }
continue; continue;
} else if (sent <= 0) { } 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(); TEST_FAIL();
goto END; goto END;
} }

View File

@ -52,11 +52,11 @@ void TCPSOCKET_ECHOTEST_BURST()
for (int i = 0; i < BURST_CNT; i++) { for (int i = 0; i < BURST_CNT; i++) {
sent = sock.send(tcp_global::tx_buffer, BURST_SIZE); sent = sock.send(tcp_global::tx_buffer, BURST_SIZE);
if (sent < 0) { if (sent < 0) {
printf("[%02d] network error %d\n", i, sent); tr_error("[%02d] network error %d", i, sent);
TEST_FAIL(); TEST_FAIL();
break; break;
} else if (sent != BURST_SIZE) { } 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(); TEST_FAIL();
break; break;
} }
@ -65,7 +65,7 @@ void TCPSOCKET_ECHOTEST_BURST()
while (bytes2recv) { while (bytes2recv) {
recvd = sock.recv(&(tcp_global::rx_buffer[sent - bytes2recv]), bytes2recv); recvd = sock.recv(&(tcp_global::rx_buffer[sent - bytes2recv]), bytes2recv);
if (recvd < 0) { if (recvd < 0) {
printf("[Round#%02d] network error %d\n", i, recvd); tr_error("[Round#%02d] network error %d", i, recvd);
TEST_FAIL(); TEST_FAIL();
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.close()); TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.close());
return; return;
@ -103,7 +103,7 @@ void TCPSOCKET_ECHOTEST_BURST_NONBLOCK()
} }
continue; continue;
} else if (sent < 0) { } else if (sent < 0) {
printf("[%02d] network error %d\n", i, sent); tr_error("[%02d] network error %d", i, sent);
TEST_FAIL(); TEST_FAIL();
goto END; goto END;
} }
@ -119,19 +119,19 @@ void TCPSOCKET_ECHOTEST_BURST_NONBLOCK()
recvd = sock.recv(&(tcp_global::rx_buffer[BURST_SIZE - bt_left]), BURST_SIZE); recvd = sock.recv(&(tcp_global::rx_buffer[BURST_SIZE - bt_left]), BURST_SIZE);
if (recvd == NSAPI_ERROR_WOULD_BLOCK) { if (recvd == NSAPI_ERROR_WOULD_BLOCK) {
if (osSignalWait(SIGNAL_SIGIO, SIGIO_TIMEOUT).status == osEventTimeout) { if (osSignalWait(SIGNAL_SIGIO, SIGIO_TIMEOUT).status == osEventTimeout) {
printf("[bt#%02d] packet timeout...", i); tr_error("[bt#%02d] packet timeout...", i);
break; break;
} }
continue; continue;
} else if (recvd < 0) { } else if (recvd < 0) {
printf("[%02d] network error %d\n", i, recvd); tr_error("[%02d] network error %d", i, recvd);
break; break;
} }
bt_left -= recvd; bt_left -= recvd;
} }
if (bt_left != 0) { 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(); TEST_FAIL();
goto END; goto END;
} }

View File

@ -49,7 +49,7 @@ void TCPSOCKET_OPEN_LIMIT()
} }
ret = sock->open(NetworkInterface::get_default_instance()); ret = sock->open(NetworkInterface::get_default_instance());
if (ret == NSAPI_ERROR_NO_MEMORY || ret == NSAPI_ERROR_NO_SOCKET) { 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; delete sock;
break; break;
} }
@ -91,7 +91,7 @@ void TCPSOCKET_OPEN_LIMIT()
delete tmp->sock; delete tmp->sock;
delete tmp; 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_EQUAL(open_sockets[0], open_sockets[1]);
TEST_ASSERT(open_sockets[0] >= 4); TEST_ASSERT(open_sockets[0] >= 4);

View File

@ -113,7 +113,7 @@ void rcv_n_chk_against_rfc864_pattern(TCPSocket &sock)
recvd_size += rd; recvd_size += rd;
} }
timer.stop(); timer.stop();
printf("MBED: Time taken: %fs\n", timer.read()); tr_info("MBED: Time taken: %fs", timer.read());
} }
void TCPSOCKET_RECV_100K() void TCPSOCKET_RECV_100K()
@ -163,7 +163,7 @@ void rcv_n_chk_against_rfc864_pattern_nonblock(TCPSocket &sock)
} }
} }
timer.stop(); timer.stop();
printf("MBED: Time taken: %fs\n", timer.read()); tr_info("MBED: Time taken: %fs", timer.read());
} }
static void _sigio_handler(osThreadId id) static void _sigio_handler(osThreadId id)

View File

@ -68,7 +68,7 @@ void TCPSOCKET_RECV_TIMEOUT()
goto CLEANUP; goto CLEANUP;
} }
int recv_time_ms = (timer.read_us() + 500) / 1000; 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) { if (recv_time_ms > 150) {
TEST_ASSERT(150 - recv_time_ms < 51); TEST_ASSERT(150 - recv_time_ms < 51);
} else { } else {
@ -76,7 +76,7 @@ void TCPSOCKET_RECV_TIMEOUT()
} }
continue; continue;
} else if (recvd < 0) { } else if (recvd < 0) {
printf("[pkt#%02d] network error %d\n", i, recvd); tr_error("[pkt#%02d] network error %d", i, recvd);
TEST_FAIL(); TEST_FAIL();
goto CLEANUP; goto CLEANUP;
} }

View File

@ -45,7 +45,7 @@ void TCPSOCKET_SEND_TIMEOUT()
(timer.read_ms() <= 800)) { (timer.read_ms() <= 800)) {
continue; continue;
} }
printf("send: err %d, time %d", err, timer.read_ms()); tr_error("send: err %d, time %d", err, timer.read_ms());
TEST_FAIL(); TEST_FAIL();
break; break;
} }

View File

@ -69,7 +69,7 @@ static void check_const_len_rand_sequence()
} }
continue; continue;
} else if (sent < 0) { } else if (sent < 0) {
printf("network error %d\n", sent); tr_error("network error %d", sent);
TEST_FAIL(); TEST_FAIL();
goto END; goto END;
} }
@ -82,7 +82,7 @@ static void check_const_len_rand_sequence()
if (recvd == NSAPI_ERROR_WOULD_BLOCK) { if (recvd == NSAPI_ERROR_WOULD_BLOCK) {
continue; continue;
} else if (recvd < 0) { } else if (recvd < 0) {
printf("network error %d\n", recvd); tr_error("network error %d", recvd);
TEST_FAIL(); TEST_FAIL();
goto END; goto END;
} }
@ -126,7 +126,7 @@ static void check_var_len_rand_sequence()
} }
continue; continue;
} else if (sent < 0) { } else if (sent < 0) {
printf("[%02d] network error %d\n", i, sent); tr_error("[%02d] network error %d", i, sent);
TEST_FAIL(); TEST_FAIL();
goto END; goto END;
} }
@ -139,7 +139,7 @@ static void check_var_len_rand_sequence()
if (recvd == NSAPI_ERROR_WOULD_BLOCK) { if (recvd == NSAPI_ERROR_WOULD_BLOCK) {
continue; continue;
} else if (recvd < 0) { } else if (recvd < 0) {
printf("[%02d] network error %d\n", i, recvd); tr_error("[%02d] network error %d", i, recvd);
TEST_FAIL(); TEST_FAIL();
goto END; goto END;
} }

View File

@ -28,6 +28,7 @@
#include "utest/utest_stack_trace.h" #include "utest/utest_stack_trace.h"
#include "tls_tests.h" #include "tls_tests.h"
#include "cert.h" #include "cert.h"
#include "CellularDevice.h"
#ifndef ECHO_SERVER_ADDR #ifndef ECHO_SERVER_ADDR
#error [NOT_SUPPORTED] Requires parameters for echo server #error [NOT_SUPPORTED] Requires parameters for echo server
@ -66,13 +67,13 @@ static void _ifup()
NetworkInterface *net = NetworkInterface::get_default_instance(); NetworkInterface *net = NetworkInterface::get_default_instance();
nsapi_error_t err = net->connect(); nsapi_error_t err = net->connect();
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err); 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() static void _ifdown()
{ {
NetworkInterface::get_default_instance()->disconnect(); 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) 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); NetworkInterface::get_default_instance()->gethostbyname(ECHO_SERVER_ADDR, &tls_addr);
tls_addr.set_port(port); 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); nsapi_error_t err = sock.set_root_ca_cert(tls_global::cert);
if (err != NSAPI_ERROR_OK) { 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; return err;
} }
err = sock.open(NetworkInterface::get_default_instance()); err = sock.open(NetworkInterface::get_default_instance());
if (err != NSAPI_ERROR_OK) { 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; return err;
} }
err = sock.connect(tls_addr); err = sock.connect(tls_addr);
if (err != NSAPI_ERROR_OK) { if (err != NSAPI_ERROR_OK) {
printf("Error from sock.connect: %d\n", err); tr_error("Error from sock.connect: %d\n", err);
return 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"); GREENTEA_SETUP(tls_global::TESTS_TIMEOUT, "default_auto");
_ifup(); _ifup();
#ifdef MBED_CONF_APP_BAUD_RATE
CellularDevice::get_default_instance()->set_baud_rate(MBED_CONF_APP_BAUD_RATE);
#endif
tc_bucket.start(); tc_bucket.start();
return greentea_test_setup_handler(number_of_cases); return greentea_test_setup_handler(number_of_cases);
} }

View File

@ -20,6 +20,9 @@
#include "../test_params.h" #include "../test_params.h"
#include "TLSSocket.h" #include "TLSSocket.h"
#include "mbed_trace.h"
#define TRACE_GROUP "GRNT"
#if defined(MBEDTLS_SSL_CLI_C) || defined(DOXYGEN_ONLY) #if defined(MBEDTLS_SSL_CLI_C) || defined(DOXYGEN_ONLY)

View File

@ -62,7 +62,7 @@ void TLSSOCKET_ECHOTEST()
SKIP_IF_TCP_UNSUPPORTED(); SKIP_IF_TCP_UNSUPPORTED();
sock = new TLSSocket; sock = new TLSSocket;
if (tlssocket_connect_to_echo_srv(*sock) != NSAPI_ERROR_OK) { 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(); TEST_FAIL();
delete sock; delete sock;
return; return;
@ -76,11 +76,11 @@ void TLSSOCKET_ECHOTEST()
sent = sock->send(tls_global::tx_buffer, pkt_s); sent = sock->send(tls_global::tx_buffer, pkt_s);
if (sent < 0) { 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(); TEST_FAIL();
break; break;
} else if (sent != pkt_s) { } 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(); TEST_FAIL();
break; break;
} }
@ -89,7 +89,7 @@ void TLSSOCKET_ECHOTEST()
while (bytes2recv) { while (bytes2recv) {
recvd = sock->recv(&(tls_global::rx_buffer[sent - bytes2recv]), bytes2recv); recvd = sock->recv(&(tls_global::rx_buffer[sent - bytes2recv]), bytes2recv);
if (recvd < 0) { 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_FAIL();
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->close()); TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->close());
return; return;
@ -115,7 +115,7 @@ void tlssocket_echotest_nonblock_receive()
} }
return; return;
} else if (recvd < 0) { } else if (recvd < 0) {
printf("sock.recv returned an error %d", recvd); tr_error("sock.recv returned an error %d", recvd);
TEST_FAIL(); TEST_FAIL();
receive_error = true; receive_error = true;
} else { } else {
@ -176,7 +176,7 @@ void TLSSOCKET_ECHOTEST_NONBLOCK()
} }
continue; continue;
} else if (sent <= 0) { } 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(); TEST_FAIL();
goto END; goto END;
} }

View File

@ -54,11 +54,11 @@ void TLSSOCKET_ECHOTEST_BURST()
for (int i = 0; i < BURST_CNT; i++) { for (int i = 0; i < BURST_CNT; i++) {
sent = sock->send(tls_global::tx_buffer, BURST_SIZE); sent = sock->send(tls_global::tx_buffer, BURST_SIZE);
if (sent < 0) { if (sent < 0) {
printf("[%02d] network error %d\n", i, sent); tr_error("[%02d] network error %d\n", i, sent);
TEST_FAIL(); TEST_FAIL();
break; break;
} else if (sent != BURST_SIZE) { } 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(); TEST_FAIL();
break; break;
} }
@ -67,7 +67,7 @@ void TLSSOCKET_ECHOTEST_BURST()
while (bytes2recv) { while (bytes2recv) {
recvd = sock->recv(&(tls_global::rx_buffer[sent - bytes2recv]), bytes2recv); recvd = sock->recv(&(tls_global::rx_buffer[sent - bytes2recv]), bytes2recv);
if (recvd < 0) { 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_FAIL();
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->close()); TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->close());
return; return;
@ -106,7 +106,7 @@ void TLSSOCKET_ECHOTEST_BURST_NONBLOCK()
} }
continue; continue;
} else if (sent < 0) { } else if (sent < 0) {
printf("[%02d] network error %d\n", i, sent); tr_error("[%02d] network error %d\n", i, sent);
TEST_FAIL(); TEST_FAIL();
goto END; goto END;
} }
@ -122,19 +122,19 @@ void TLSSOCKET_ECHOTEST_BURST_NONBLOCK()
recvd = sock->recv(&(tls_global::rx_buffer[BURST_SIZE - bt_left]), BURST_SIZE); recvd = sock->recv(&(tls_global::rx_buffer[BURST_SIZE - bt_left]), BURST_SIZE);
if (recvd == NSAPI_ERROR_WOULD_BLOCK) { if (recvd == NSAPI_ERROR_WOULD_BLOCK) {
if (osSignalWait(SIGNAL_SIGIO, SIGIO_TIMEOUT).status == osEventTimeout) { if (osSignalWait(SIGNAL_SIGIO, SIGIO_TIMEOUT).status == osEventTimeout) {
printf("[bt#%02d] packet timeout...", i); tr_error("[bt#%02d] packet timeout...", i);
break; break;
} }
continue; continue;
} else if (recvd < 0) { } else if (recvd < 0) {
printf("[%02d] network error %d\n", i, recvd); tr_error("[%02d] network error %d\n", i, recvd);
break; break;
} }
bt_left -= recvd; bt_left -= recvd;
} }
if (bt_left != 0) { 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(); TEST_FAIL();
goto END; goto END;
} }

View File

@ -29,6 +29,14 @@ using namespace utest::v1;
void TLSSOCKET_HANDSHAKE_INVALID() void TLSSOCKET_HANDSHAKE_INVALID()
{ {
SKIP_IF_TCP_UNSUPPORTED(); 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; TLSSocket sock;
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.open(NetworkInterface::get_default_instance())); 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)); TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.set_root_ca_cert(tls_global::cert));

View File

@ -51,7 +51,7 @@ void TLSSOCKET_OPEN_LIMIT()
} }
ret = sock->open(NetworkInterface::get_default_instance()); ret = sock->open(NetworkInterface::get_default_instance());
if (ret == NSAPI_ERROR_NO_MEMORY || ret == NSAPI_ERROR_NO_SOCKET) { 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; delete sock;
break; break;
} }
@ -93,7 +93,7 @@ void TLSSOCKET_OPEN_LIMIT()
delete tmp->sock; delete tmp->sock;
delete tmp; 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_EQUAL(open_sockets[0], open_sockets[1]);
TEST_ASSERT(open_sockets[0] >= 4); TEST_ASSERT(open_sockets[0] >= 4);

View File

@ -69,10 +69,10 @@ void TLSSOCKET_RECV_TIMEOUT()
TEST_FAIL(); TEST_FAIL();
goto CLEANUP; goto CLEANUP;
} }
printf("MBED: recv() took: %dus\n", timer.read_us()); tr_info("MBED: recv() took: %dus\n", timer.read_us());
continue; continue;
} else if (recvd < 0) { } 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(); TEST_FAIL();
goto CLEANUP; goto CLEANUP;
} }

View File

@ -59,13 +59,13 @@ static void _ifup()
NetworkInterface *net = NetworkInterface::get_default_instance(); NetworkInterface *net = NetworkInterface::get_default_instance();
nsapi_error_t err = net->connect(); nsapi_error_t err = net->connect();
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err); 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() static void _ifdown()
{ {
NetworkInterface::get_default_instance()->disconnect(); NetworkInterface::get_default_instance()->disconnect();
printf("MBED: ifdown\n"); tr_info("MBED: ifdown");
} }

View File

@ -19,6 +19,9 @@
#define UDP_TESTS_H #define UDP_TESTS_H
#include "../test_params.h" #include "../test_params.h"
#include "mbed_trace.h"
#define TRACE_GROUP "GRNT"
NetworkInterface *get_interface(); NetworkInterface *get_interface();
void drop_bad_packets(UDPSocket &sock, int orig_timeout); void drop_bad_packets(UDPSocket &sock, int orig_timeout);

View File

@ -29,6 +29,7 @@ namespace {
static const int SIGNAL_SIGIO_RX = 0x1; static const int SIGNAL_SIGIO_RX = 0x1;
static const int SIGNAL_SIGIO_TX = 0x2; static const int SIGNAL_SIGIO_TX = 0x2;
static const int SIGIO_TIMEOUT = 5000; //[ms] static const int SIGIO_TIMEOUT = 5000; //[ms]
static const int SOCKET_TIMEOUT = (10 * 1000); //[ms]
static const int RETRIES = 2; static const int RETRIES = 2;
static const double EXPECTED_LOSS_RATIO = 0.0; 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, \ 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, \
1100, 1200 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; Timer tc_exec_time;
int time_allotted; int time_allotted;
} }
@ -58,16 +64,19 @@ static void _sigio_handler()
void UDPSOCKET_ECHOTEST() void UDPSOCKET_ECHOTEST()
{ {
SocketAddress udp_addr; SocketAddress udp_addr;
SocketAddress recv_addr;
NetworkInterface::get_default_instance()->gethostbyname(ECHO_SERVER_ADDR, &udp_addr); NetworkInterface::get_default_instance()->gethostbyname(ECHO_SERVER_ADDR, &udp_addr);
udp_addr.set_port(ECHO_SERVER_PORT); udp_addr.set_port(ECHO_SERVER_PORT);
UDPSocket sock; UDPSocket sock;
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.open(NetworkInterface::get_default_instance())); TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.open(NetworkInterface::get_default_instance()));
sock.set_timeout(SOCKET_TIMEOUT);
int recvd; int recvd;
int sent; int sent;
int packets_sent = 0; int packets_sent = 0;
int packets_recv = 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) { for (unsigned int s_idx = 0; s_idx < sizeof(pkt_sizes) / sizeof(*pkt_sizes); ++s_idx) {
int pkt_s = pkt_sizes[s_idx]; int pkt_s = pkt_sizes[s_idx];
@ -82,18 +91,36 @@ void UDPSOCKET_ECHOTEST()
} else if (sent == pkt_s) { } else if (sent == pkt_s) {
packets_sent++; packets_sent++;
} else { } else {
printf("[Round#%02d - Sender] error, returned %d\n", s_idx, sent); tr_error("[Round#%02d - Sender] error, returned %d", s_idx, sent);
continue; 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) { if (recvd == pkt_s) {
break; break;
} else { } 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) { if (memcmp(tx_buffer, rx_buffer, pkt_s) == 0) {
packets_recv++; packets_recv++;
pkt_received[s_idx] = true;
} }
// Make sure that at least one packet of every size was sent. // Make sure that at least one packet of every size was sent.
TEST_ASSERT_TRUE(packets_sent > packets_sent_prev); TEST_ASSERT_TRUE(packets_sent > packets_sent_prev);
@ -102,7 +129,7 @@ void UDPSOCKET_ECHOTEST()
// Packet loss up to 30% tolerated // Packet loss up to 30% tolerated
if (packets_sent > 0) { if (packets_sent > 0) {
double loss_ratio = 1 - ((double)packets_recv / (double)packets_sent); 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_DOUBLE_WITHIN(TOLERATED_LOSS_RATIO, EXPECTED_LOSS_RATIO, loss_ratio);
} }
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.close()); TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.close());
@ -143,7 +170,7 @@ void UDPSOCKET_ECHOTEST_NONBLOCK()
} }
--retry_cnt; --retry_cnt;
} else { } else {
printf("[Round#%02d - Sender] error, returned %d\n", s_idx, sent); tr_error("[Round#%02d - Sender] error, returned %d", s_idx, sent);
continue; continue;
} }
@ -158,7 +185,7 @@ void UDPSOCKET_ECHOTEST_NONBLOCK()
--retry_recv; --retry_recv;
continue; continue;
} else if (recvd < 0) { } else if (recvd < 0) {
printf("sock.recvfrom returned %d\n", recvd); tr_error("sock.recvfrom returned %d", recvd);
TEST_FAIL(); TEST_FAIL();
break; break;
} else if (recvd == pkt_s) { } else if (recvd == pkt_s) {
@ -180,7 +207,7 @@ void UDPSOCKET_ECHOTEST_NONBLOCK()
// Packet loss up to 30% tolerated // Packet loss up to 30% tolerated
if (packets_sent > 0) { if (packets_sent > 0) {
double loss_ratio = 1 - ((double)packets_recv / (double)packets_sent); 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_DOUBLE_WITHIN(TOLERATED_LOSS_RATIO, EXPECTED_LOSS_RATIO, loss_ratio);
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED #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); 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); TEST_ASSERT_DOUBLE_WITHIN(TOLERATED_LOSS_RATIO, EXPECTED_LOSS_RATIO, loss_ratio);
#endif #endif

View File

@ -21,6 +21,7 @@
#include "unity/unity.h" #include "unity/unity.h"
#include "utest.h" #include "utest.h"
#include "udp_tests.h" #include "udp_tests.h"
#include "CellularDevice.h"
using namespace utest::v1; using namespace utest::v1;
@ -70,6 +71,10 @@ static void _sigio_handler(osThreadId id)
void UDPSOCKET_ECHOTEST_BURST() 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; SocketAddress udp_addr;
NetworkInterface::get_default_instance()->gethostbyname(ECHO_SERVER_ADDR, &udp_addr); NetworkInterface::get_default_instance()->gethostbyname(ECHO_SERVER_ADDR, &udp_addr);
udp_addr.set_port(ECHO_SERVER_PORT); udp_addr.set_port(ECHO_SERVER_PORT);
@ -109,12 +114,12 @@ void UDPSOCKET_ECHOTEST_BURST()
} }
} else if (recvd < 0) { } else if (recvd < 0) {
pkg_fail += BURST_PKTS - j; // Assume all the following packets of the burst to be lost 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); ThisThread::sleep_for(recv_timeout * 1000);
recv_timeout *= 2; // Back off, recv_timeout *= 2; // Back off,
break; break;
} else if (temp_addr != udp_addr) { } else if (temp_addr != udp_addr) {
printf("[%02d] packet from wrong address\n", i); tr_info("[%02d] packet from wrong address", i);
--j; --j;
continue; continue;
} }
@ -134,15 +139,15 @@ void UDPSOCKET_ECHOTEST_BURST()
ok_bursts++; ok_bursts++;
} else { } else {
drop_bad_packets(sock, TIMEOUT); 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(); free_tx_buffers();
double loss_ratio = 1 - ((double)(BURST_CNT * BURST_PKTS - pkg_fail) / (double)(BURST_CNT * BURST_PKTS)); 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", tr_info("Packets sent: %d, packets received %d, loss ratio %.2lf",
BURST_CNT * BURST_PKTS, BURST_CNT * BURST_PKTS - pkg_fail, loss_ratio); BURST_CNT * BURST_PKTS, BURST_CNT * BURST_PKTS - pkg_fail, loss_ratio);
// Packet loss up to 30% tolerated // Packet loss up to 30% tolerated
TEST_ASSERT_DOUBLE_WITHIN(TOLERATED_LOSS_RATIO, EXPECTED_LOSS_RATIO, loss_ratio); TEST_ASSERT_DOUBLE_WITHIN(TOLERATED_LOSS_RATIO, EXPECTED_LOSS_RATIO, loss_ratio);
// 70% of the bursts need to be successful // 70% of the bursts need to be successful
@ -153,6 +158,10 @@ void UDPSOCKET_ECHOTEST_BURST()
void UDPSOCKET_ECHOTEST_BURST_NONBLOCK() 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; SocketAddress udp_addr;
NetworkInterface::get_default_instance()->gethostbyname(ECHO_SERVER_ADDR, &udp_addr); NetworkInterface::get_default_instance()->gethostbyname(ECHO_SERVER_ADDR, &udp_addr);
udp_addr.set_port(ECHO_SERVER_PORT); udp_addr.set_port(ECHO_SERVER_PORT);
@ -206,7 +215,7 @@ void UDPSOCKET_ECHOTEST_BURST_NONBLOCK()
goto PKT_OK; goto PKT_OK;
} }
} }
printf("[bt#%02d] corrupted packet...", i); tr_error("[bt#%02d] corrupted packet...", i);
pkg_fail++; pkg_fail++;
break; break;
PKT_OK: PKT_OK:
@ -224,8 +233,8 @@ PKT_OK:
free_tx_buffers(); free_tx_buffers();
double loss_ratio = 1 - ((double)(BURST_CNT * BURST_PKTS - pkg_fail) / (double)(BURST_CNT * BURST_PKTS)); 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", tr_info("Packets sent: %d, packets received %d, loss ratio %.2lf",
BURST_CNT * BURST_PKTS, BURST_CNT * BURST_PKTS - pkg_fail, loss_ratio); BURST_CNT * BURST_PKTS, BURST_CNT * BURST_PKTS - pkg_fail, loss_ratio);
// Packet loss up to 30% tolerated // Packet loss up to 30% tolerated
TEST_ASSERT_DOUBLE_WITHIN(TOLERATED_LOSS_RATIO, EXPECTED_LOSS_RATIO, loss_ratio); TEST_ASSERT_DOUBLE_WITHIN(TOLERATED_LOSS_RATIO, EXPECTED_LOSS_RATIO, loss_ratio);
// 70% of the bursts need to be successful // 70% of the bursts need to be successful

View File

@ -49,7 +49,7 @@ void UDPSOCKET_OPEN_LIMIT()
} }
ret = sock->open(NetworkInterface::get_default_instance()); ret = sock->open(NetworkInterface::get_default_instance());
if (ret == NSAPI_ERROR_NO_MEMORY || ret == NSAPI_ERROR_NO_SOCKET) { 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; delete sock;
break; break;
} }
@ -89,7 +89,7 @@ void UDPSOCKET_OPEN_LIMIT()
delete tmp->sock; delete tmp->sock;
delete tmp; 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_EQUAL(open_sockets[0], open_sockets[1]);
// In case of lwIP one is taken by DHCP -> reduction by one to three // In case of lwIP one is taken by DHCP -> reduction by one to three

View File

@ -62,7 +62,7 @@ void UDPSOCKET_RECV_TIMEOUT()
if (recvd == NSAPI_ERROR_WOULD_BLOCK) { if (recvd == NSAPI_ERROR_WOULD_BLOCK) {
osSignalWait(SIGNAL_SIGIO, SIGIO_TIMEOUT); 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) { if (timer.read_ms() > 150) {
TEST_ASSERT(150 - timer.read_ms() < 51); TEST_ASSERT(150 - timer.read_ms() < 51);
} else { } else {
@ -70,16 +70,16 @@ void UDPSOCKET_RECV_TIMEOUT()
} }
continue; continue;
} else if (recvd < 0) { } else if (recvd < 0) {
printf("[bt#%02d] network error %d\n", i, recvd); tr_error("[bt#%02d] network error %d", i, recvd);
continue; continue;
} else if (temp_addr != udp_addr) { } 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; continue;
} }
TEST_ASSERT_EQUAL(DATA_LEN, recvd); TEST_ASSERT_EQUAL(DATA_LEN, recvd);
pkt_success++; 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()); TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.close());
} }

View File

@ -41,7 +41,7 @@ void UDPSOCKET_SENDTO_TIMEOUT()
int sent = sock.sendto(udp_addr, tx_buffer, sizeof(tx_buffer)); int sent = sock.sendto(udp_addr, tx_buffer, sizeof(tx_buffer));
timer.stop(); timer.stop();
TEST_ASSERT_EQUAL(sizeof(tx_buffer), sent); 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); sock.set_timeout(1000);
timer.reset(); timer.reset();
@ -49,7 +49,7 @@ void UDPSOCKET_SENDTO_TIMEOUT()
sent = sock.sendto(udp_addr, tx_buffer, sizeof(tx_buffer)); sent = sock.sendto(udp_addr, tx_buffer, sizeof(tx_buffer));
timer.stop(); timer.stop();
TEST_ASSERT_EQUAL(sizeof(tx_buffer), sent); 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()); TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.close());
} }

View File

@ -29,7 +29,7 @@ using namespace utest::v1;
void test_emac_multicast_filter_cb(int opt) void test_emac_multicast_filter_cb(int opt)
{ {
static bool multicasts_are_filtered = true; 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 send_request = true;
static bool receive = true; static bool receive = true;
static int no_response_cnt = 0; static int no_response_cnt = 0;
@ -71,7 +71,6 @@ void test_emac_multicast_filter_cb(int opt)
receive = true; receive = true;
break; break;
case 3: case 3:
printf("STEP 3: set ipv4 multicast filter, test if input message is filtered\r\n\r\n"); 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) { if (next_step) {
RESET_OUTGOING_MSG_DATA; 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++; test_step++;
#endif
retries = 0; retries = 0;
send_request = true; send_request = true;
} }

View File

@ -72,7 +72,10 @@ Case cases[] = {
Case("EMAC unicast frame length", test_emac_unicast_frame_len), Case("EMAC unicast frame length", test_emac_unicast_frame_len),
Case("EMAC unicast burst", test_emac_unicast_burst), Case("EMAC unicast burst", test_emac_unicast_burst),
Case("EMAC unicast long", test_emac_unicast_long), 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), 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) Case("EMAC memory", test_emac_memory)
}; };

View File

@ -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
}
}
}

View File

@ -155,10 +155,14 @@ Test `NetworkInterface::get_connection_status()`.
1. Check that `get_connection_status()` returns status `NSAPI_STATUS_DISCONNECTED`. 1. Check that `get_connection_status()` returns status `NSAPI_STATUS_DISCONNECTED`.
2. Connect interface. 2. Connect interface.
3. Poll the `get_connection_status()` until it returns status `NSAPI_STATUS_GLOBAL_UP`. 3. Poll the `get_connection_status()` until it returns status `NSAPI_STATUS_GLOBAL_UP`.
4. Disconnect interface. 4. (IPv6 only) Get IPv6 link local address using `get_ipv6_link_local_address` API.
5. Check that `get_connection_status()` returns status `NSAPI_STATUS_DISCONNECTED`. 5. (IPv6 only) Check that `get_ipv6_link_local_address` returned status `NSAPI_ERROR_OK`.
6. Repeat connect and disconnect steps 2 to 5 four times. 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:** **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`.

View File

@ -156,6 +156,15 @@ void NETWORKINTERFACE_STATUS_GET()
ThisThread::sleep_for(500); 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(); err = net->disconnect();
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err); TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);

View File

@ -34,15 +34,15 @@
!defined(MBED_CONF_APP_WIFI_CH_SECURE) || \ !defined(MBED_CONF_APP_WIFI_CH_SECURE) || \
!defined(MBED_CONF_APP_WIFI_PASSWORD) || \ !defined(MBED_CONF_APP_WIFI_PASSWORD) || \
!defined(MBED_CONF_APP_WIFI_SECURE_SSID) || \ !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) #error [NOT_SUPPORTED] Requires parameters from mbed_app.json (for secure connections)
#else #else
#if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) && \ #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_MAX_SCAN_SIZE) || \
!defined(MBED_CONF_APP_WIFI_CH_UNSECURE) || \ !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) #error [NOT_SUPPORTED] Requires parameters from mbed_app.json (for unsecure connections)
#else #else

View File

@ -76,7 +76,7 @@ if (COVERAGE)
endif() endif()
# Append coverage compiler flags # 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_C_FLAGS "${CMAKE_C_FLAGS} ${COVERAGE_COMPILER_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COVERAGE_COMPILER_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COVERAGE_COMPILER_FLAGS}")

View File

@ -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);
}

View File

@ -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}")

View File

@ -43,5 +43,5 @@ set(unittest-test-sources
) )
# defines # 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_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") 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")

View File

@ -94,6 +94,7 @@ public:
MOCK_CONST_METHOD0(get_connection_status, nsapi_connection_status_t()); 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_mac_address, char *(char *buf, nsapi_size_t buflen));
MOCK_METHOD2(get_ip_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_netmask, char *(char *buf, nsapi_size_t buflen));
MOCK_METHOD2(get_gateway, char *(char *buf, nsapi_size_t buflen)); MOCK_METHOD2(get_gateway, char *(char *buf, nsapi_size_t buflen));
}; };

View File

@ -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;
}

View File

@ -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
)

View File

@ -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;
}

View File

@ -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
)

View File

@ -31,6 +31,11 @@ const char *NetworkInterface::get_ip_address()
return 0; return 0;
} }
nsapi_error_t NetworkInterface::get_ipv6_link_local_address(SocketAddress *address)
{
return NSAPI_ERROR_UNSUPPORTED;
}
const char *NetworkInterface::get_netmask() const char *NetworkInterface::get_netmask()
{ {
return 0; return 0;

View File

@ -93,6 +93,12 @@ const char *NetworkStack::get_ip_address()
{ {
return NULL; 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) const char *NetworkStack::get_ip_address_if(const char *interface_name)
{ {
return NULL; return NULL;

View File

@ -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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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;
} }

View File

@ -36,8 +36,13 @@ typedef enum {
typedef enum { typedef enum {
} PinMode; } PinMode;
typedef enum {
PortA = 0,
} PortName;
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#include "pinmap.h"
#endif #endif

View File

@ -64,6 +64,7 @@ typedef void *osEventFlagsId_t;
/// Attributes structure for thread. /// Attributes structure for thread.
typedef struct { typedef struct {
int unused;
} osThreadAttr_t; } osThreadAttr_t;
#define osWaitForever 0xFFFFFFFFU ///< Wait forever timeout value. #define osWaitForever 0xFFFFFFFFU ///< Wait forever timeout value.

View File

@ -19,5 +19,6 @@
#define MBED_DEVICE_H #define MBED_DEVICE_H
#include "objects.h" #include "objects.h"
#include "PinNames.h"
#endif #endif

View File

@ -27,6 +27,7 @@ extern "C" {
#endif #endif
typedef struct { typedef struct {
int unused;
} gpio_t; } gpio_t;
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -33,6 +33,42 @@ struct serial_s {
int x; 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" #include "gpio_object.h"
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -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__*/

View File

@ -23,7 +23,7 @@
#define MBED_POWER_MGMT_H #define MBED_POWER_MGMT_H
extern void mock_system_reset(); extern void mock_system_reset();
MBED_NORETURN static inline void system_reset(void) static inline void system_reset(void)
{ {
mock_system_reset(); mock_system_reset();
} }

View File

@ -1,5 +1,4 @@
/* /* Copyright (c) 2019 ARM Limited
* Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -15,4 +14,23 @@
* limitations under the License. * 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

View File

@ -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

View File

@ -137,6 +137,9 @@ class CoverageAPI(object):
coverage_path = os.path.join(build_path, "coverage") coverage_path = os.path.join(build_path, "coverage")
if not os.path.exists(coverage_path): if not os.path.exists(coverage_path):
os.mkdir(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 # Generate the command
args = self._gen_cmd(output, excludes, filter_regex) args = self._gen_cmd(output, excludes, filter_regex)
@ -145,4 +148,4 @@ class CoverageAPI(object):
execute_program( execute_program(
args, args,
"%s code coverage report generation failed." % output.upper(), "%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

View File

@ -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__

View File

@ -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__

View File

@ -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__

View File

@ -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__

View File

@ -29,7 +29,7 @@ client_test_t test_a001_attestation_list[] = {
static int g_test_count = 1; 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]); int num_checks = sizeof(check1)/sizeof(check1[0]);
uint32_t i, status, token_size; 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; 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]); int num_checks = sizeof(check2)/sizeof(check2[0]);
uint32_t i, status, token_size; uint32_t i, status, token_size;

View File

@ -28,6 +28,6 @@ extern val_api_t *val;
extern psa_api_t *psa; extern psa_api_t *psa;
extern client_test_t test_a001_attestation_list[]; 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_test(caller_security_t caller);
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);
#endif /* _TEST_A001_CLIENT_TESTS_H_ */ #endif /* _TEST_A001_CLIENT_TESTS_H_ */

View File

@ -141,7 +141,7 @@ static int32_t sst_remove_stray_uid(psa_sst_uid_t p_uid)
return VAL_STATUS_SUCCESS; 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; int32_t test_status;
psa_sst_uid_t uid = UID_BASE_VALUE + 6; psa_sst_uid_t uid = UID_BASE_VALUE + 6;

View File

@ -31,5 +31,5 @@ extern val_api_t *val;
extern psa_api_t *psa; extern psa_api_t *psa;
extern client_test_t test_s001_sst_list[]; 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_ */ #endif /* _TEST_S001_CLIENT_TESTS_H_ */

View File

@ -35,7 +35,7 @@ client_test_t test_s002_sst_list[] = {
NULL, 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; uint32_t status;
psa_sst_uid_t uid = UID_WRITE_ONCE_1; 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; uint32_t status;
psa_sst_uid_t uid = UID_WRITE_ONCE_2; psa_sst_uid_t uid = UID_WRITE_ONCE_2;

View File

@ -31,6 +31,6 @@ extern val_api_t *val;
extern psa_api_t *psa; extern psa_api_t *psa;
extern client_test_t test_s002_sst_list[]; 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_update_write_once_flag_after_create(caller_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);
#endif /* _TEST_S002_CLIENT_TESTS_H_ */ #endif /* _TEST_S002_CLIENT_TESTS_H_ */

View File

@ -39,7 +39,7 @@ static char test_desc[2][80] = {
"Overload storage space\n", "Overload storage space\n",
"Overload storage again to verify all previous UID removed\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; uint32_t status = PSA_SST_SUCCESS;
psa_sst_uid_t uid; psa_sst_uid_t uid;

View File

@ -31,5 +31,5 @@ extern val_api_t *val;
extern psa_api_t *psa; extern psa_api_t *psa;
extern client_test_t test_s003_sst_list[]; 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_ */ #endif /* _TEST_S003_CLIENT_TESTS_H_ */

View File

@ -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, \ 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}; 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; uint32_t status,j;

View File

@ -31,5 +31,5 @@ extern val_api_t *val;
extern psa_api_t *psa; extern psa_api_t *psa;
extern client_test_t test_s004_sst_list[]; 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_ */ #endif /* _TEST_S004_CLIENT_TESTS_H_ */

View File

@ -64,7 +64,7 @@ static int32_t psa_sst_apis_check(psa_sst_uid_t uid, uint32_t data_len,
return VAL_STATUS_SUCCESS; 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; psa_sst_uid_t uid = UID_BASE_VALUE + 4;
uint32_t data_len = 0, status = VAL_STATUS_SUCCESS; uint32_t data_len = 0, status = VAL_STATUS_SUCCESS;

View File

@ -31,6 +31,6 @@ extern val_api_t *val;
extern psa_api_t *psa; extern psa_api_t *psa;
extern client_test_t test_s005_sst_list[]; 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_ */ #endif /* _TEST_S005_CLIENT_TESTS_H_ */

View File

@ -53,7 +53,7 @@ static int32_t psa_sst_remove_api(psa_sst_uid_t uid, uint32_t data_len,
return VAL_STATUS_SUCCESS; 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; psa_sst_create_flags_t flag = 0x80000000;
uint32_t status = VAL_STATUS_SUCCESS; uint32_t status = VAL_STATUS_SUCCESS;

View File

@ -31,6 +31,6 @@ extern val_api_t *val;
extern psa_api_t *psa; extern psa_api_t *psa;
extern client_test_t test_s006_sst_list[]; 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_ */ #endif /* _TEST_S006_CLIENT_TESTS_H_ */

View File

@ -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}; 0x70, 0xA1, 0xFF, 0xFF, 0x14, 0x73, 0x46, 0x97, 0xE8, 0xDD, 0xCA, 0x0B, 0x3C, 0x0D, 0x2E};
static uint8_t read_buff[TEST_BUFF_SIZE]; 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; psa_sst_uid_t uid = UID_BASE_VALUE + 5;
uint32_t status = VAL_STATUS_SUCCESS; uint32_t status = VAL_STATUS_SUCCESS;

View File

@ -31,6 +31,6 @@ extern val_api_t *val;
extern psa_api_t *psa; extern psa_api_t *psa;
extern client_test_t test_s007_sst_list[]; 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_ */ #endif /* _TEST_S007_CLIENT_TESTS_H_ */

View File

@ -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, \ 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}; 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; uint32_t status, j;
@ -80,7 +80,7 @@ int32_t psa_sst_invalid_offset_failure(security_t caller)
return VAL_STATUS_SUCCESS; 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; uint32_t status, data_len, offset = TEST_BUFF_SIZE;

View File

@ -31,7 +31,7 @@ extern val_api_t *val;
extern psa_api_t *psa; extern psa_api_t *psa;
extern client_test_t test_s008_sst_list[]; extern client_test_t test_s008_sst_list[];
int32_t psa_sst_valid_offset_success(security_t caller); int32_t psa_sst_valid_offset_success(caller_security_t caller);
int32_t psa_sst_invalid_offset_failure(security_t caller); int32_t psa_sst_invalid_offset_failure(caller_security_t caller);
#endif /* _TEST_S008_CLIENT_TESTS_H_ */ #endif /* _TEST_S008_CLIENT_TESTS_H_ */

View File

@ -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, \ 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}; 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; uint32_t status;

View File

@ -31,6 +31,6 @@ extern val_api_t *val;
extern psa_api_t *psa; extern psa_api_t *psa;
extern client_test_t test_s009_sst_list[]; 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_ */ #endif /* _TEST_S009_CLIENT_TESTS_H_ */

View File

@ -34,7 +34,7 @@ client_test_t test_s010_sst_list[] = {
static uint8_t write_buff[TEST_BUFF_SIZE] = {0xFF}; 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; int32_t status;
psa_sst_uid_t uid = 0; psa_sst_uid_t uid = 0;

Some files were not shown because too many files have changed in this diff Show More