tests: add a test for coredump

This adds a simple test for coredump.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2020-08-07 10:45:20 -07:00 committed by Anas Nashif
parent faae15d838
commit 86b2cbc5ea
5 changed files with 58 additions and 0 deletions

View file

@ -534,6 +534,7 @@
/tests/net/lib/coap/ @rveerama1
/tests/net/socket/socketpair/ @cfriedt
/tests/net/socket/ @jukkar @tbursztyka @pfalcon
/tests/subsys/debug/coredump/ @dcpleung
/tests/subsys/fs/ @nashif @wentongwu
/tests/subsys/settings/ @nvlsianpu
/tests/subsys/shell/ @jakub-uC @nordic-krch

View file

@ -0,0 +1,8 @@
# SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.13.1)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(hello_world)
target_sources(app PRIVATE src/main.c)

View file

@ -0,0 +1,4 @@
CONFIG_LOG=y
CONFIG_LOG_MINIMAL=y
CONFIG_DEBUG_COREDUMP=y
CONFIG_DEBUG_COREDUMP_BACKEND_LOGGING=y

View file

@ -0,0 +1,31 @@
/*
* Copyright (c) 2012-2014 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr.h>
#include <sys/printk.h>
void func_3(uint32_t *addr)
{
/* For null pointer reference */
*addr = 0;
}
void func_2(uint32_t *addr)
{
func_3(addr);
}
void func_1(uint32_t *addr)
{
func_2(addr);
}
void main(void)
{
printk("Coredump: %s\n", CONFIG_BOARD);
func_1(0);
}

View file

@ -0,0 +1,14 @@
tests:
coredump.logging_backend:
tags: ignore_faults ignore_qemu_crash
filter: CONFIG_ARCH_SUPPORTS_COREDUMP
harness: console
harness_config:
type: multi_line
regex:
- "Coredump: (.*)"
- "E: #CD:BEGIN#"
- "E: #CD:5([aA])45([0-9a-fA-F]+)"
- "E: #CD:41([0-9a-fA-F]+)"
- "E: #CD:4([dD])([0-9a-fA-F]+)"
- "E: #CD:END#"