tests: tracing: add test cases for tracing infrastructure
Add test cases for currently supported backends (UART, USB and POSIX) of tracing infrastructure. Signed-off-by: Wentong Wu <wentong.wu@intel.com>
This commit is contained in:
parent
4f4b8ef4ea
commit
9d1614477e
10 changed files with 260 additions and 4 deletions
|
@ -2,7 +2,17 @@
|
|||
|
||||
cmake_minimum_required(VERSION 3.13.1)
|
||||
|
||||
if(BOARD MATCHES "qemu_.*")
|
||||
list(APPEND QEMU_EXTRA_FLAGS -serial file:channel0_0)
|
||||
endif()
|
||||
|
||||
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
|
||||
project(tracing_tests)
|
||||
|
||||
target_sources(app PRIVATE src/main.c)
|
||||
|
||||
target_sources_ifdef(
|
||||
CONFIG_TRACING_TEST
|
||||
app PRIVATE
|
||||
src/tracing_string_format_test.c
|
||||
)
|
||||
|
|
61
tests/subsys/debug/tracing/README.txt
Normal file
61
tests/subsys/debug/tracing/README.txt
Normal file
|
@ -0,0 +1,61 @@
|
|||
Title: Send Tracing Formated Packet To The Host With Supported Backends
|
||||
|
||||
Description:
|
||||
|
||||
This application can be used to demonstrate the tracing feature. The tracing
|
||||
formated packet will be sent to the host with the currently supported tracing
|
||||
backend under tracing generic infrastructure.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Usage for UART Tracing Backend:
|
||||
|
||||
Build a UART-tracing image with:
|
||||
|
||||
cmake -DBOARD=mps2_an521 -DCONF_FILE=prj_uart.conf ..
|
||||
|
||||
or:
|
||||
|
||||
cmake -DBOARD=mps2_an521 -DCONF_FILE=prj_uart_ctf.conf ..
|
||||
|
||||
After the application has run for a while, check the trace output file.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Usage for USB Tracing Backend
|
||||
|
||||
Build a USB-tracing image with:
|
||||
|
||||
cmake -DBOARD=sam_e70_xplained -DCONF_FILE=prj_usb.conf ..
|
||||
|
||||
or:
|
||||
|
||||
cmake -DBOARD=sam_e70_xplained -DCONF_FILE=prj_usb_ctf.conf ..
|
||||
|
||||
After the serial console has stable output like this:
|
||||
|
||||
threadA: Hello World!
|
||||
threadB: Hello World!
|
||||
threadA: Hello World!
|
||||
threadB: Hello World!
|
||||
|
||||
connect the board's USB port to the host device and
|
||||
run the trace_capture_usb.py script on the host:
|
||||
|
||||
sudo python3 trace_capture_usb.py -v 0x2FE9 -p 0x100 -o channel0_0
|
||||
|
||||
The VID and PID of USB device can be configured, just adjusting it accordingly.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Usage for POSIX Tracing Backend
|
||||
|
||||
Build a POSIX-tracing image with:
|
||||
|
||||
cmake -DBOARD=native_posix -DCONF_FILE=prj_native_posix.conf ..
|
||||
|
||||
or:
|
||||
|
||||
cmake -DBOARD=native_posix -DCONF_FILE=prj_native_posix_ctf.conf ..
|
||||
|
||||
After the application has run for a while, check the trace output file.
|
11
tests/subsys/debug/tracing/prj_native_posix.conf
Normal file
11
tests/subsys/debug/tracing/prj_native_posix.conf
Normal file
|
@ -0,0 +1,11 @@
|
|||
CONFIG_THREAD_NAME=y
|
||||
CONFIG_THREAD_STACK_INFO=y
|
||||
|
||||
CONFIG_TRACING=y
|
||||
CONFIG_TRACING_ISR=y
|
||||
CONFIG_TRACING_SYNC=y
|
||||
CONFIG_TRACING_BACKEND_POSIX=y
|
||||
CONFIG_TRACING_HANDLE_HOST_CMD=n
|
||||
CONFIG_TRACING_PACKET_MAX_SIZE=64
|
||||
|
||||
CONFIG_TRACING_TEST=y
|
10
tests/subsys/debug/tracing/prj_native_posix_ctf.conf
Normal file
10
tests/subsys/debug/tracing/prj_native_posix_ctf.conf
Normal file
|
@ -0,0 +1,10 @@
|
|||
CONFIG_THREAD_NAME=y
|
||||
CONFIG_THREAD_STACK_INFO=y
|
||||
|
||||
CONFIG_TRACING=y
|
||||
CONFIG_TRACING_CTF=y
|
||||
CONFIG_TRACING_ISR=y
|
||||
CONFIG_TRACING_SYNC=y
|
||||
CONFIG_TRACING_BACKEND_POSIX=y
|
||||
CONFIG_TRACING_HANDLE_HOST_CMD=n
|
||||
CONFIG_TRACING_PACKET_MAX_SIZE=64
|
14
tests/subsys/debug/tracing/prj_uart.conf
Normal file
14
tests/subsys/debug/tracing/prj_uart.conf
Normal file
|
@ -0,0 +1,14 @@
|
|||
CONFIG_THREAD_NAME=y
|
||||
CONFIG_THREAD_STACK_INFO=y
|
||||
CONFIG_IDLE_STACK_SIZE=4096
|
||||
|
||||
CONFIG_UART_LINE_CTRL=y
|
||||
CONFIG_UART_INTERRUPT_DRIVEN=y
|
||||
|
||||
CONFIG_TRACING=y
|
||||
CONFIG_TRACING_ISR=y
|
||||
CONFIG_TRACING_TEST=y
|
||||
CONFIG_TRACING_BACKEND_UART=y
|
||||
CONFIG_TRACING_BUFFER_SIZE=4096
|
||||
CONFIG_TRACING_HANDLE_HOST_CMD=n
|
||||
CONFIG_TRACING_BACKEND_UART_NAME="UART_1"
|
13
tests/subsys/debug/tracing/prj_uart_ctf.conf
Normal file
13
tests/subsys/debug/tracing/prj_uart_ctf.conf
Normal file
|
@ -0,0 +1,13 @@
|
|||
CONFIG_THREAD_NAME=y
|
||||
CONFIG_THREAD_STACK_INFO=y
|
||||
|
||||
CONFIG_UART_LINE_CTRL=y
|
||||
CONFIG_UART_INTERRUPT_DRIVEN=y
|
||||
|
||||
CONFIG_TRACING=y
|
||||
CONFIG_TRACING_CTF=y
|
||||
CONFIG_TRACING_ISR=y
|
||||
CONFIG_TRACING_BACKEND_UART=y
|
||||
CONFIG_TRACING_BUFFER_SIZE=4096
|
||||
CONFIG_TRACING_HANDLE_HOST_CMD=n
|
||||
CONFIG_TRACING_BACKEND_UART_NAME="UART_1"
|
13
tests/subsys/debug/tracing/prj_usb.conf
Normal file
13
tests/subsys/debug/tracing/prj_usb.conf
Normal file
|
@ -0,0 +1,13 @@
|
|||
CONFIG_GPIO=y
|
||||
CONFIG_USB=y
|
||||
CONFIG_USB_DEVICE_STACK=y
|
||||
CONFIG_USB_DEVICE_VID=0x2FE9
|
||||
|
||||
CONFIG_THREAD_NAME=y
|
||||
CONFIG_THREAD_STACK_INFO=y
|
||||
|
||||
CONFIG_TRACING=y
|
||||
CONFIG_TRACING_TEST=y
|
||||
CONFIG_TRACING_BACKEND_USB=y
|
||||
CONFIG_TRACING_BUFFER_SIZE=4096
|
||||
CONFIG_TRACING_HANDLE_HOST_CMD=y
|
14
tests/subsys/debug/tracing/prj_usb_ctf.conf
Normal file
14
tests/subsys/debug/tracing/prj_usb_ctf.conf
Normal file
|
@ -0,0 +1,14 @@
|
|||
CONFIG_GPIO=y
|
||||
CONFIG_USB=y
|
||||
CONFIG_USB_DEVICE_STACK=y
|
||||
CONFIG_USB_DEVICE_VID=0x2FE9
|
||||
|
||||
CONFIG_THREAD_NAME=y
|
||||
CONFIG_THREAD_STACK_INFO=y
|
||||
|
||||
CONFIG_TRACING=y
|
||||
CONFIG_TRACING_CTF=y
|
||||
CONFIG_TRACING_ASYNC=y
|
||||
CONFIG_TRACING_BACKEND_USB=y
|
||||
CONFIG_TRACING_HANDLE_HOST_CMD=y
|
||||
CONFIG_TRACING_BUFFER_SIZE=4096
|
94
tests/subsys/debug/tracing/src/tracing_string_format_test.c
Normal file
94
tests/subsys/debug/tracing/src/tracing_string_format_test.c
Normal file
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <zephyr.h>
|
||||
#include <tracing_test.h>
|
||||
#include <debug/tracing_format.h>
|
||||
|
||||
void sys_trace_thread_switched_out(void)
|
||||
{
|
||||
TRACING_STRING("%s %d\n", __func__, __LINE__);
|
||||
}
|
||||
|
||||
void sys_trace_thread_switched_in(void)
|
||||
{
|
||||
TRACING_STRING("%s %d\n", __func__, __LINE__);
|
||||
}
|
||||
|
||||
void sys_trace_thread_priority_set(struct k_thread *thread)
|
||||
{
|
||||
TRACING_STRING("%s %d\n", __func__, __LINE__);
|
||||
}
|
||||
|
||||
void sys_trace_thread_create(struct k_thread *thread)
|
||||
{
|
||||
TRACING_STRING("%s %d\n", __func__, __LINE__);
|
||||
}
|
||||
|
||||
void sys_trace_thread_abort(struct k_thread *thread)
|
||||
{
|
||||
TRACING_STRING("%s %d\n", __func__, __LINE__);
|
||||
}
|
||||
|
||||
void sys_trace_thread_suspend(struct k_thread *thread)
|
||||
{
|
||||
TRACING_STRING("%s %d\n", __func__, __LINE__);
|
||||
}
|
||||
|
||||
void sys_trace_thread_resume(struct k_thread *thread)
|
||||
{
|
||||
TRACING_STRING("%s %d\n", __func__, __LINE__);
|
||||
}
|
||||
|
||||
void sys_trace_thread_ready(struct k_thread *thread)
|
||||
{
|
||||
TRACING_STRING("%s %d\n", __func__, __LINE__);
|
||||
}
|
||||
|
||||
void sys_trace_thread_pend(struct k_thread *thread)
|
||||
{
|
||||
TRACING_STRING("%s %d\n", __func__, __LINE__);
|
||||
}
|
||||
|
||||
void sys_trace_thread_info(struct k_thread *thread)
|
||||
{
|
||||
TRACING_STRING("%s %d\n", __func__, __LINE__);
|
||||
}
|
||||
|
||||
void sys_trace_thread_name_set(struct k_thread *thread)
|
||||
{
|
||||
TRACING_STRING("%s %d\n", __func__, __LINE__);
|
||||
}
|
||||
|
||||
void sys_trace_isr_enter(void)
|
||||
{
|
||||
TRACING_STRING("%s %d\n", __func__, __LINE__);
|
||||
}
|
||||
|
||||
void sys_trace_isr_exit(void)
|
||||
{
|
||||
TRACING_STRING("%s %d\n", __func__, __LINE__);
|
||||
}
|
||||
|
||||
void sys_trace_isr_exit_to_scheduler(void)
|
||||
{
|
||||
TRACING_STRING("%s %d\n", __func__, __LINE__);
|
||||
}
|
||||
|
||||
void sys_trace_idle(void)
|
||||
{
|
||||
TRACING_STRING("%s %d\n", __func__, __LINE__);
|
||||
}
|
||||
|
||||
void sys_trace_void(unsigned int id)
|
||||
{
|
||||
TRACING_STRING("%s %d\n", __func__, __LINE__);
|
||||
}
|
||||
|
||||
void sys_trace_end_call(unsigned int id)
|
||||
{
|
||||
TRACING_STRING("%s %d\n", __func__, __LINE__);
|
||||
}
|
|
@ -12,10 +12,6 @@ tests:
|
|||
extra_configs:
|
||||
- CONFIG_SEGGER_SYSTEMVIEW=y
|
||||
- CONFIG_USE_SEGGER_RTT=y
|
||||
tracing.backends.ctf:
|
||||
platform_whitelist: native_posix
|
||||
extra_configs:
|
||||
- CONFIG_TRACING_CTF=y
|
||||
tracing.backends.cpu_stats:
|
||||
platform_whitelist: nrf52840_pca10056
|
||||
extra_configs:
|
||||
|
@ -25,3 +21,23 @@ tests:
|
|||
- CONFIG_OPENOCD_SUPPORT=y
|
||||
arch_exclude: posix xtensa
|
||||
platform_exclude: qemu_x86_64
|
||||
tracing.uart:
|
||||
platform_whitelist: qemu_x86 qemu_x86_64
|
||||
extra_args: CONF_FILE="prj_uart.conf"
|
||||
tracing.usb:
|
||||
platform_whitelist: sam_e70_xplained
|
||||
depends_on: usb_device
|
||||
extra_args: CONF_FILE="prj_usb.conf"
|
||||
tracing.uart.ctf:
|
||||
platform_whitelist: qemu_x86 qemu_x86_64
|
||||
extra_args: CONF_FILE="prj_uart_ctf.conf"
|
||||
tracing.usb.ctf:
|
||||
platform_whitelist: sam_e70_xplained
|
||||
depends_on: usb_device
|
||||
extra_args: CONF_FILE="prj_usb_ctf.conf"
|
||||
tracing.posix:
|
||||
platform_whitelist: native_posix
|
||||
extra_args: CONF_FILE="prj_native_posix.conf"
|
||||
tracing.posix.ctf:
|
||||
platform_whitelist: native_posix
|
||||
extra_args: CONF_FILE="prj_native_posix_ctf.conf"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue