Skip to content

Commit 4895b1f

Browse files
pdgendtkartben
authored andcommitted
tests: Add CTest base harness testing
Add a testcase to validate the added CTest twister harness. Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
1 parent 0b67255 commit 4895b1f

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

tests/ctest/base/CMakeLists.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright (c) 2024 Basalte bv
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
cmake_minimum_required(VERSION 3.20.0)
5+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
6+
7+
project(ctest_base)
8+
9+
target_sources(app PRIVATE ${ZEPHYR_BASE}/misc/empty_file.c)
10+
11+
enable_testing()
12+
include(CTest)
13+
14+
add_test(NAME exe_help COMMAND ${CMAKE_BINARY_DIR}/zephyr/zephyr.exe --help)
15+
add_test(NAME exe_run COMMAND ${CMAKE_BINARY_DIR}/zephyr/zephyr.exe -stop_at=3 -no-rt)
16+
set_property(
17+
TEST exe_run
18+
PROPERTY PASS_REGULAR_EXPRESSION "Stopped at [0-9.]+s"
19+
)
20+
21+
# A test that always succeeds
22+
add_test(NAME success COMMAND ${CMAKE_COMMAND} -E true)
23+
24+
# A test that is expected to fail
25+
add_test(NAME failure COMMAND ${CMAKE_COMMAND} -E false)
26+
set_property(TEST failure PROPERTY WILL_FAIL true)

tests/ctest/base/prj.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Intentionally empty

tests/ctest/base/testcase.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
common:
2+
tags:
3+
- test_framework
4+
platform_allow:
5+
- native_sim
6+
integration_platforms:
7+
- native_sim
8+
harness: ctest
9+
tests:
10+
testing.ctest.base: {}

0 commit comments

Comments
 (0)