mirror of https://github.com/ARMmbed/mbed-os.git
Review comments: Re-implemented utest_printf to use RawSerial.
Re-implemented utest_safe_putc() to use Rawserial. Minor cosmetic changes.
parent
0ccdfe3ca2
commit
50f1c178e9
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "utest/case.h"
|
#include "utest/case.h"
|
||||||
|
#include "utest/utest_serial.h"
|
||||||
|
|
||||||
using namespace utest::v1;
|
using namespace utest::v1;
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include "utest/default_handlers.h"
|
#include "utest/default_handlers.h"
|
||||||
#include "utest/case.h"
|
#include "utest/case.h"
|
||||||
#include "utest/stack_trace.h"
|
#include "utest/stack_trace.h"
|
||||||
|
#include "utest/utest_serial.h"
|
||||||
|
|
||||||
using namespace utest::v1;
|
using namespace utest::v1;
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "utest/case.h"
|
#include "utest/case.h"
|
||||||
#include "greentea-client/test_env.h"
|
#include "greentea-client/test_env.h"
|
||||||
#include "utest/stack_trace.h"
|
#include "utest/stack_trace.h"
|
||||||
|
#include "utest/utest_serial.h"
|
||||||
|
|
||||||
using namespace utest::v1;
|
using namespace utest::v1;
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
#include "utest/harness.h"
|
#include "utest/harness.h"
|
||||||
#include "utest/stack_trace.h"
|
#include "utest/stack_trace.h"
|
||||||
|
#include "utest/utest_serial.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
|
@ -124,20 +124,6 @@ static int32_t utest_us_ticker_run()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int utest_printf(char *str, ...)
|
|
||||||
{
|
|
||||||
volatile uint32_t primask = __get_PRIMASK();\
|
|
||||||
if ( (primask & 0x1) == 0){ \
|
|
||||||
va_list vargs;
|
|
||||||
|
|
||||||
va_start(vargs, str);
|
|
||||||
vprintf(str, vargs);
|
|
||||||
va_end(vargs);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
static const utest_v1_scheduler_t utest_v1_scheduler =
|
static const utest_v1_scheduler_t utest_v1_scheduler =
|
||||||
|
|
|
@ -21,8 +21,7 @@
|
||||||
#include "utest.h"
|
#include "utest.h"
|
||||||
#include "unity.h"
|
#include "unity.h"
|
||||||
#include "utest/stack_trace.h"
|
#include "utest/stack_trace.h"
|
||||||
|
#include "utest/utest_serial.h"
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
using namespace utest::v1;
|
using namespace utest::v1;
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include "utest/harness.h"
|
#include "utest/harness.h"
|
||||||
#include "utest/stack_trace.h"
|
#include "utest/stack_trace.h"
|
||||||
#include "utest/unity_handler.h"
|
#include "utest/unity_handler.h"
|
||||||
|
#include "utest/utest_serial.h"
|
||||||
|
|
||||||
void utest_unity_assert_failure(void)
|
void utest_unity_assert_failure(void)
|
||||||
{
|
{
|
||||||
|
@ -35,11 +35,7 @@ void utest_unity_ignore_failure(void)
|
||||||
|
|
||||||
void utest_safe_putc(int chr)
|
void utest_safe_putc(int chr)
|
||||||
{
|
{
|
||||||
volatile uint32_t primask = __get_PRIMASK();
|
utest_serial.putc(chr);
|
||||||
if ( (primask & 0x1) == 0){
|
|
||||||
(void)putchar(chr);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* Copyright (c) 2015, ARM Limited, All Rights Reserved
|
||||||
|
* 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 "utest/utest_serial.h"
|
||||||
|
|
||||||
|
RawSerial utest_serial(USBTX, USBRX);
|
||||||
|
|
||||||
|
void utest_safe_putc(int chr)
|
||||||
|
{
|
||||||
|
utest_serial.putc(chr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,6 @@ extern "C" {
|
||||||
/// must be implemented by the port
|
/// must be implemented by the port
|
||||||
void utest_v1_enter_critical_section(void);
|
void utest_v1_enter_critical_section(void);
|
||||||
void utest_v1_leave_critical_section(void);
|
void utest_v1_leave_critical_section(void);
|
||||||
int utest_printf(char *str, ...);
|
|
||||||
|
|
||||||
/// This is the default scheduler implementation used by the harness.
|
/// This is the default scheduler implementation used by the harness.
|
||||||
utest_v1_scheduler_t utest_v1_get_scheduler(void);
|
utest_v1_scheduler_t utest_v1_get_scheduler(void);
|
||||||
|
|
|
@ -20,8 +20,6 @@
|
||||||
#define UTEST_UNITY_ASSERT_FAILURE_H
|
#define UTEST_UNITY_ASSERT_FAILURE_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include "cmsis.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -23,6 +23,6 @@
|
||||||
#include "case.h"
|
#include "case.h"
|
||||||
#include "default_handlers.h"
|
#include "default_handlers.h"
|
||||||
#include "harness.h"
|
#include "harness.h"
|
||||||
|
#include "utest/utest_serial.h"
|
||||||
|
|
||||||
#endif // UTEST_H
|
#endif // UTEST_H
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* Copyright (c) 2016, ARM Limited, All Rights Reserved
|
||||||
|
* 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 UTEST_SERIAL_H
|
||||||
|
#define UTEST_SERIAL_H
|
||||||
|
|
||||||
|
#include "mbed.h"
|
||||||
|
|
||||||
|
extern RawSerial utest_serial;
|
||||||
|
|
||||||
|
#define utest_printf(...) utest_serial.printf(__VA_ARGS__)
|
||||||
|
|
||||||
|
#endif // UTEST_SERIAL_H
|
Loading…
Reference in New Issue