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:
parent
faae15d838
commit
86b2cbc5ea
|
@ -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
|
||||
|
|
8
tests/subsys/debug/coredump/CMakeLists.txt
Normal file
8
tests/subsys/debug/coredump/CMakeLists.txt
Normal 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)
|
4
tests/subsys/debug/coredump/prj.conf
Normal file
4
tests/subsys/debug/coredump/prj.conf
Normal file
|
@ -0,0 +1,4 @@
|
|||
CONFIG_LOG=y
|
||||
CONFIG_LOG_MINIMAL=y
|
||||
CONFIG_DEBUG_COREDUMP=y
|
||||
CONFIG_DEBUG_COREDUMP_BACKEND_LOGGING=y
|
31
tests/subsys/debug/coredump/src/main.c
Normal file
31
tests/subsys/debug/coredump/src/main.c
Normal 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);
|
||||
}
|
14
tests/subsys/debug/coredump/testcase.yaml
Normal file
14
tests/subsys/debug/coredump/testcase.yaml
Normal 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#"
|
Loading…
Reference in a new issue