From 53c121381f1a26153002e133ab4dd656cec0e592 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Thu, 11 Jan 2024 11:34:40 +0100 Subject: [PATCH] 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 --- .github/workflows/bsim-tests.yaml | 28 ++++++++++++++++++++++++++++ tests/bsim/drivers/uart/compile.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100755 tests/bsim/drivers/uart/compile.sh diff --git a/.github/workflows/bsim-tests.yaml b/.github/workflows/bsim-tests.yaml index 75a6557797..c6abce7391 100644 --- a/.github/workflows/bsim-tests.yaml +++ b/.github/workflows/bsim-tests.yaml @@ -20,6 +20,8 @@ on: - "include/zephyr/net/openthread.h" - "drivers/ieee802154/**" - "include/zephyr/net/ieee802154*" + - "drivers/serial/*nrfx*" + - "tests/drivers/uart/**" concurrency: group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }} @@ -44,6 +46,7 @@ jobs: bsim_bt_53_test_results_file: ./bsim_bt/53_bsim_results.xml bsim_bt_53split_test_results_file: ./bsim_bt/53_bsim_split_results.xml bsim_net_52_test_results_file: ./bsim_net/52_bsim_results.xml + bsim_uart_test_results_file: ./bsim_uart/uart_bsim_results.xml steps: - name: Apply container owner mismatch workaround run: | @@ -116,10 +119,20 @@ jobs: drivers/ieee802154/** include/zephyr/net/ieee802154* + - name: Check if UART files changed + uses: tj-actions/changed-files@v41 + id: check-uart-files + with: + files: | + tests/bsim/drivers/uart/** + drivers/serial/*nrfx* + tests/drivers/uart/** + - name: Update BabbleSim to manifest revision if: > steps.check-bluetooth-files.outputs.any_changed == 'true' || steps.check-networking-files.outputs.any_changed == 'true' + || steps.check-uart-files.outputs.any_changed == 'true' || steps.check-common-files.outputs.any_changed == 'true' run: | export BSIM_VERSION=$( west list bsim -f {revision} ) @@ -163,6 +176,18 @@ jobs: RESULTS_FILE=${ZEPHYR_BASE}/${bsim_net_52_test_results_file} \ SEARCH_PATH=tests/bsim/net/ tests/bsim/run_parallel.sh + - name: Run UART Tests with BSIM + if: steps.check-uart-files.outputs.any_changed == 'true' || steps.check-common-files.outputs.any_changed == 'true' + run: | + echo "UART: Single device tests" + ./scripts/twister -T tests/drivers/uart/ --force-color --inline-logs -v -M -p nrf52_bsim \ + --fixture gpio_loopback -- -uart0_loopback + echo "UART: Multi device tests" + export ZEPHYR_BASE=${PWD} + WORK_DIR=${ZEPHYR_BASE}/bsim_uart nice tests/bsim/drivers/uart/compile.sh + RESULTS_FILE=${ZEPHYR_BASE}/${bsim_uart_test_results_file} \ + SEARCH_PATH=tests/bsim/drivers/uart/ tests/bsim/run_parallel.sh + - name: Upload Test Results if: always() uses: actions/upload-artifact@v3 @@ -173,6 +198,9 @@ jobs: ./bsim_bt/53_bsim_results.xml ./bsim_bt/53_bsim_split_results.xml ./bsim_net/52_bsim_results.xml + ./bsim_uart/uart_bsim_results.xml + ./twister-out/twister.xml + ./twister-out/twister.json ${{ github.event_path }} if-no-files-found: warn diff --git a/tests/bsim/drivers/uart/compile.sh b/tests/bsim/drivers/uart/compile.sh new file mode 100755 index 0000000000..5bd35772bb --- /dev/null +++ b/tests/bsim/drivers/uart/compile.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# Copyright 2023 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +# Compile all the applications needed by all bsim UART tests + +#set -x #uncomment this line for debugging +set -ue + +: "${BSIM_OUT_PATH:?BSIM_OUT_PATH must be defined}" +: "${BSIM_COMPONENTS_PATH:?BSIM_COMPONENTS_PATH must be defined}" +: "${ZEPHYR_BASE:?ZEPHYR_BASE must be set to point to the zephyr root\ + directory}" + +WORK_DIR="${WORK_DIR:-${ZEPHYR_BASE}/bsim_out}" +BOARD="${BOARD:-nrf52_bsim}" +BOARD_ROOT="${BOARD_ROOT:-${ZEPHYR_BASE}}" + +mkdir -p ${WORK_DIR} + +source ${ZEPHYR_BASE}/tests/bsim/sh_common.source + +# Placeholder, nothing yet +# Add apps needed for multidevice UART tests here + +wait_for_background_jobs