Skip to content

Commit 53c1213

Browse files
aescolarnashif
authored andcommitted
CI bsim workflow: Add UART tests to the bsim workflow
Add new workflow steps to the babblesim workflow to run also the UART tests on the nrf52_bsim. This commit: * Enables the single device tests (which we may move to the normal twister workflow once we fix the requirement for a fixture) * Adds as a placeholder the infra for multidevice tests. Signed-off-by: Alberto Escolar Piedras <[email protected]>
1 parent 9af7450 commit 53c1213

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

.github/workflows/bsim-tests.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ on:
2020
- "include/zephyr/net/openthread.h"
2121
- "drivers/ieee802154/**"
2222
- "include/zephyr/net/ieee802154*"
23+
- "drivers/serial/*nrfx*"
24+
- "tests/drivers/uart/**"
2325

2426
concurrency:
2527
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }}
@@ -44,6 +46,7 @@ jobs:
4446
bsim_bt_53_test_results_file: ./bsim_bt/53_bsim_results.xml
4547
bsim_bt_53split_test_results_file: ./bsim_bt/53_bsim_split_results.xml
4648
bsim_net_52_test_results_file: ./bsim_net/52_bsim_results.xml
49+
bsim_uart_test_results_file: ./bsim_uart/uart_bsim_results.xml
4750
steps:
4851
- name: Apply container owner mismatch workaround
4952
run: |
@@ -116,10 +119,20 @@ jobs:
116119
drivers/ieee802154/**
117120
include/zephyr/net/ieee802154*
118121
122+
- name: Check if UART files changed
123+
uses: tj-actions/changed-files@v41
124+
id: check-uart-files
125+
with:
126+
files: |
127+
tests/bsim/drivers/uart/**
128+
drivers/serial/*nrfx*
129+
tests/drivers/uart/**
130+
119131
- name: Update BabbleSim to manifest revision
120132
if: >
121133
steps.check-bluetooth-files.outputs.any_changed == 'true'
122134
|| steps.check-networking-files.outputs.any_changed == 'true'
135+
|| steps.check-uart-files.outputs.any_changed == 'true'
123136
|| steps.check-common-files.outputs.any_changed == 'true'
124137
run: |
125138
export BSIM_VERSION=$( west list bsim -f {revision} )
@@ -163,6 +176,18 @@ jobs:
163176
RESULTS_FILE=${ZEPHYR_BASE}/${bsim_net_52_test_results_file} \
164177
SEARCH_PATH=tests/bsim/net/ tests/bsim/run_parallel.sh
165178
179+
- name: Run UART Tests with BSIM
180+
if: steps.check-uart-files.outputs.any_changed == 'true' || steps.check-common-files.outputs.any_changed == 'true'
181+
run: |
182+
echo "UART: Single device tests"
183+
./scripts/twister -T tests/drivers/uart/ --force-color --inline-logs -v -M -p nrf52_bsim \
184+
--fixture gpio_loopback -- -uart0_loopback
185+
echo "UART: Multi device tests"
186+
export ZEPHYR_BASE=${PWD}
187+
WORK_DIR=${ZEPHYR_BASE}/bsim_uart nice tests/bsim/drivers/uart/compile.sh
188+
RESULTS_FILE=${ZEPHYR_BASE}/${bsim_uart_test_results_file} \
189+
SEARCH_PATH=tests/bsim/drivers/uart/ tests/bsim/run_parallel.sh
190+
166191
- name: Upload Test Results
167192
if: always()
168193
uses: actions/upload-artifact@v3
@@ -173,6 +198,9 @@ jobs:
173198
./bsim_bt/53_bsim_results.xml
174199
./bsim_bt/53_bsim_split_results.xml
175200
./bsim_net/52_bsim_results.xml
201+
./bsim_uart/uart_bsim_results.xml
202+
./twister-out/twister.xml
203+
./twister-out/twister.json
176204
${{ github.event_path }}
177205
if-no-files-found: warn
178206

tests/bsim/drivers/uart/compile.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2023 Nordic Semiconductor ASA
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
# Compile all the applications needed by all bsim UART tests
6+
7+
#set -x #uncomment this line for debugging
8+
set -ue
9+
10+
: "${BSIM_OUT_PATH:?BSIM_OUT_PATH must be defined}"
11+
: "${BSIM_COMPONENTS_PATH:?BSIM_COMPONENTS_PATH must be defined}"
12+
: "${ZEPHYR_BASE:?ZEPHYR_BASE must be set to point to the zephyr root\
13+
directory}"
14+
15+
WORK_DIR="${WORK_DIR:-${ZEPHYR_BASE}/bsim_out}"
16+
BOARD="${BOARD:-nrf52_bsim}"
17+
BOARD_ROOT="${BOARD_ROOT:-${ZEPHYR_BASE}}"
18+
19+
mkdir -p ${WORK_DIR}
20+
21+
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
22+
23+
# Placeholder, nothing yet
24+
# Add apps needed for multidevice UART tests here
25+
26+
wait_for_background_jobs

0 commit comments

Comments
 (0)