1#
2# Copyright (c) 2020, 2023 intel Corporation.
3#
4# SPDX-License-Identifier: Apache-2.0
5#
6
7common:
8  tags:
9    - debug
10    - gdbstub
11  filter: CONFIG_ARCH_HAS_GDBSTUB
12
13tests:
14  # Basic build-only test for all platforms supporting gdbstub
15  debug.gdbstub.build_only:
16    platform_allow:
17      - qemu_x86
18      - qemu_cortex_a9
19    build_only: true
20
21  # Connect to Zephyr gdbstub and run a simple GDB script
22  debug.gdbstub.breakpoints:
23    platform_allow:
24      - qemu_x86
25    harness: pytest
26    harness_config:
27      pytest_root:
28        - "pytest/test_gdbstub.py"
29      pytest_args:
30        - "--gdb_timeout"
31        - "20"
32        - "--gdb_script"
33        - "test_breakpoints.gdbinit"
34        - "--gdb_target_remote"
35        - "tcp::5678"
36    extra_configs:
37      # Make sure the gdbstub port chosen is unique for this test to avoid conflicts
38      # when Twister runs tests in parallel on the same host.
39      - CONFIG_QEMU_EXTRA_FLAGS="-serial tcp::5678,server"
40
41  # Connect to QEMU gdbstub backend and run the same GDB test script
42  # to check it against a reference RDP backend implementation expecting
43  # similar behavior as for Zephyr's gdbstub.
44  # Use non-default QEMU gdbstub port 1235 for this test to avoid conflicts
45  # with some other test on QEMU running in parallel.
46  debug.gdbstub_qemu.breakpoints:
47    platform_allow:
48      - qemu_x86
49    harness: pytest
50    harness_config:
51      pytest_root:
52        - "pytest/test_gdbstub.py"
53      pytest_args:
54        - "--gdb_timeout"
55        - "20"
56        - "--gdb_script"
57        - "test_breakpoints.gdbinit"
58        - "--gdb_target_remote"
59        - "tcp::1235"
60    extra_configs:
61      # Turn off Zephyr's gdbstub for this test case.
62      - CONFIG_GDBSTUB=n
63      - CONFIG_GDBSTUB_SERIAL_BACKEND=n
64      # Make sure the gdbstub port chosen is unique for this test to avoid conflicts
65      # when Twister runs tests in parallel on the same host.
66      - CONFIG_QEMU_EXTRA_FLAGS="-S -gdb tcp::1235"
67      # Clear QEMU default 'tcp::1234'
68      - CONFIG_QEMU_GDBSERVER_LISTEN_DEV=""
69