Skip to content

Commit 9ddfa62

Browse files
committed
samples: added sample to demonstrate new Twister feature.
Added sample to demonstrate shared app mechanism added to Twister. Signed-off-by: Grzegorz Chwierut <[email protected]>
1 parent ca1b6bc commit 9ddfa62

File tree

5 files changed

+82
-0
lines changed

5 files changed

+82
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
cmake_minimum_required(VERSION 3.20.0)
4+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
5+
project(shared_app_with_own_image)
6+
7+
FILE(GLOB app_sources src/*.c)
8+
target_sources(app PRIVATE ${app_sources})
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CONFIG_PRINTK=y
2+
CONFIG_SHELL=y
3+
CONFIG_LOG=y
4+
CONFIG_SHELL_BACKEND_SERIAL=y
5+
CONFIG_KERNEL_SHELL=y
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright (c) 2024 Nordic Semiconductor ASA
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
from __future__ import annotations
5+
6+
import logging
7+
from pathlib import Path
8+
9+
from twister_harness import DeviceAdapter, Shell
10+
11+
logger = logging.getLogger(__name__)
12+
13+
14+
def test_shell_is_ready(shell: Shell):
15+
# wait_for_prompt is called from shell fixture, so if passed, shell is ready to use
16+
assert True
17+
18+
19+
def test_second_app_is_found(dut: DeviceAdapter, shell: Shell, required_images):
20+
logger.info(f"Required images: {required_images}")
21+
assert required_images
22+
assert Path(required_images[0]).is_dir()
23+
assert Path(Path(required_images[0]) / 'build.log').exists()
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
int main(void)
8+
{
9+
return 0;
10+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
common:
2+
filter: CONFIG_SERIAL and dt_chosen_enabled("zephyr,shell-uart")
3+
min_ram: 40
4+
extra_configs:
5+
- arch:posix:CONFIG_NATIVE_UART_0_ON_STDINOUT=y
6+
integration_platforms:
7+
- native_sim
8+
tests:
9+
sample.shared.build_only:
10+
build_only: true
11+
sample.shared.with_own_image.pytest:
12+
required_images:
13+
- sample.shared.build_only
14+
harness: pytest
15+
harness_config:
16+
pytest_dut_scope: module
17+
tags: pytest shared
18+
sample.shared.no_own_image.pytest:
19+
no_own_image: true
20+
required_images:
21+
- sample.shared.with_own_image.pytest
22+
- sample.shared.build_only
23+
harness: pytest
24+
harness_config:
25+
pytest_dut_scope: module
26+
tags: pytest shared
27+
sample.shared.no_own_image.helloworld:
28+
no_own_image: true
29+
required_images:
30+
- sample.basic.helloworld
31+
harness: console
32+
harness_config:
33+
type: one_line
34+
regex:
35+
- "Hello World! (.*)"
36+
tags: shared

0 commit comments

Comments
 (0)