From 82d56e8f0ba0039d69f4cc4801a885f2be89ef72 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Fri, 16 Aug 2024 09:45:17 -0700 Subject: [PATCH] tests: thread_analyzer: test for privileged stacks usage This adds the bits to test the displaying the usage of privileged stacks for user threads. Note that this only adds the printk part as this is to test the code path to fetch usage data rather than the display part. Also add qemu_xtensa/dc233c/mmu to platform allow list so the privileged stack code can be tested on that platform. This replaces mps2/an385 with qemu_x86 as an integration platform due to the privileged stack test. Since ARM does not currently support getting privileged stack info, test would result in twister error due to kconfig warnings. The board cannot be excluded since it's an integration platform. So for now, use qemu_x86 as an integration for 32-bit testing. Once ARM has proper support, we can go back to having mps2/an385 as an integration platform. Signed-off-by: Daniel Leung --- .../debug/thread_analyzer/testcase.yaml | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tests/subsys/debug/thread_analyzer/testcase.yaml b/tests/subsys/debug/thread_analyzer/testcase.yaml index 7395a274f99..9ae49081889 100644 --- a/tests/subsys/debug/thread_analyzer/testcase.yaml +++ b/tests/subsys/debug/thread_analyzer/testcase.yaml @@ -1,6 +1,6 @@ common: integration_platforms: - - mps2/an385 + - qemu_x86 - qemu_x86_64 platform_allow: # Representative platforms to make sure this builds without issues @@ -11,6 +11,7 @@ common: - qemu_x86_64 - qemu_riscv32 - qemu_riscv64 + - qemu_xtensa/dc233c/mmu extra_configs: - CONFIG_QEMU_ICOUNT=n tags: @@ -37,6 +38,24 @@ tests: regex: - "(.*)0x([0-9a-fA-F]+)([ ]+) : STACK: unused [0-9]+ usage [0-9]+ / [0-9]+ (.*)" - "(.*)ISR0([ ]+) : STACK: unused [0-9]+ usage [0-9]+ / [0-9]+ (.*)" + debug.thread_analyzer.printk.userspace.priv_stack: + filter: CONFIG_ARCH_HAS_USERSPACE + extra_configs: + - CONFIG_THREAD_ANALYZER_USE_PRINTK=y + - CONFIG_THREAD_ANALYZER_PRIV_STACK_USAGE=y + - CONFIG_USERSPACE=y + platform_exclude: + # These platforms do not yet have the necessary bits to determine + # usage of privileged stacks. + - mps2/an385 + - qemu_cortex_a53 + harness: console + harness_config: + type: multi_line + regex: + - "(.*)0x([0-9a-fA-F]+)([ ]+) : STACK: unused [0-9]+ usage [0-9]+ / [0-9]+ (.*)" + - "(.*)PRIV_STACK: unused [0-9]+ usage [0-9]+ / [0-9]+" + - "(.*)ISR0([ ]+) : STACK: unused [0-9]+ usage [0-9]+ / [0-9]+ (.*)" debug.thread_analyzer.log_backend: extra_configs: - CONFIG_THREAD_ANALYZER_USE_LOG=y