2017-02-21 02:40:42 +00:00
|
|
|
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
|
2017-01-05 04:51:02 +00:00
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
|
2017-11-30 11:31:51 +00:00
|
|
|
#include <string.h>
|
2017-02-21 02:40:42 +00:00
|
|
|
#include "unity.h"
|
|
|
|
#include "test_utils.h"
|
2017-11-30 11:31:51 +00:00
|
|
|
#include "rom/ets_sys.h"
|
|
|
|
#include "rom/uart.h"
|
2017-01-05 04:51:02 +00:00
|
|
|
|
2017-02-21 02:40:42 +00:00
|
|
|
const esp_partition_t *get_test_data_partition()
|
|
|
|
{
|
2017-05-04 08:42:22 +00:00
|
|
|
/* This finds "flash_test" partition defined in partition_table_unit_test_app.csv */
|
|
|
|
const esp_partition_t *result = esp_partition_find_first(ESP_PARTITION_TYPE_DATA,
|
|
|
|
ESP_PARTITION_SUBTYPE_ANY, "flash_test");
|
2017-02-21 02:40:42 +00:00
|
|
|
TEST_ASSERT_NOT_NULL(result); /* means partition table set wrong */
|
|
|
|
return result;
|
|
|
|
}
|
2017-11-30 11:31:51 +00:00
|
|
|
|
|
|
|
// wait user to send "Enter" key
|
|
|
|
static void wait_user_control()
|
|
|
|
{
|
|
|
|
char sign[5] = {0};
|
|
|
|
while(strlen(sign) == 0)
|
|
|
|
{
|
|
|
|
/* Flush anything already in the RX buffer */
|
|
|
|
while(uart_rx_one_char((uint8_t *) sign) == OK) {
|
|
|
|
}
|
|
|
|
/* Read line */
|
|
|
|
UartRxString((uint8_t*) sign, sizeof(sign) - 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// signal functions, used for sync between unity DUTs for multiple devices cases
|
|
|
|
void unity_wait_for_signal(const char* signal_name)
|
|
|
|
{
|
|
|
|
printf("Waiting for signal: [%s]!\n"
|
|
|
|
"Please press \"Enter\" key to once any board send this signal.\n", signal_name);
|
|
|
|
wait_user_control();
|
|
|
|
}
|
|
|
|
|
|
|
|
void unity_send_signal(const char* signal_name)
|
|
|
|
{
|
|
|
|
printf("Send signal: [%s]!\n", signal_name);
|
|
|
|
}
|
|
|
|
|