1# SPDX-License-Identifier: Apache-2.0
2
3cmake_minimum_required(VERSION 3.20.0)
4
5find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
6
7# You can name the project however you like. Having a unique name is encouraged.
8project(sample_test)
9
10# This contains a variety of helper functions that abstract away common tasks,
11# like scanning, setting up a connection, querying the peer for a given
12# characteristic, etc..
13add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/common/testlib testlib)
14target_link_libraries(app PRIVATE testlib)
15
16# This contains babblesim-specific helpers, e.g. device synchronization.
17add_subdirectory(${ZEPHYR_BASE}/tests/bsim/babblekit babblekit)
18target_link_libraries(app PRIVATE babblekit)
19
20zephyr_include_directories(
21  ${BSIM_COMPONENTS_PATH}/libUtilv1/src/
22  ${BSIM_COMPONENTS_PATH}/libPhyComv1/src/
23)
24
25# List every source file in the test application. Do not use GLOB.
26#
27# It is a good idea to have one file per test role / entry point.
28#
29# Try to keep test procedures readable, that is minimizing the amount of
30# boilerplate. Use the `testlib` for anything that is not the object of the test
31# or that you don't need tight control over. For example, setting up a
32# connection between two devices.
33#
34# As a general rule of thumb: All functions that use `TEST_ASSERT()` are part of
35# the test and should be in the same file as the test entry point. Any other
36# "helper" functions can be isolated in their own file, minimizing visual
37# clutter and cognitive overhead for future readers.
38#
39# Common data can live in a header included by multiple roles (e.g. service or
40# characteristic UUIDs, test data that should be verified by both parties,
41# etc..).
42#
43# Ideally, main.c should only set up the test framework, and map the entry
44# points to the test identifiers.
45target_sources(app PRIVATE
46  src/main.c
47  src/dut.c
48  src/peer.c
49)
50