Skip to content

Commit d2ebe9c

Browse files
LukaszMrugalakartben
authored andcommitted
ci: Expand BBox tests with Twister runs
Blackbox tests now shall include smoke tests, that is Twister calls in the environment. Additionally, those smoke tests will run on multiple platforms. Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
1 parent 97855af commit d2ebe9c

File tree

1 file changed

+129
-8
lines changed

1 file changed

+129
-8
lines changed

.github/workflows/twister_tests_blackbox.yml

Lines changed: 129 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,18 @@ on:
1818
permissions:
1919
contents: read
2020

21+
env:
22+
PYTHONIOENCODING: utf-8
23+
2124
jobs:
2225
twister-tests:
2326
name: Twister Black Box Tests
24-
runs-on: ubuntu-24.04
2527
strategy:
2628
matrix:
2729
python-version: ['3.10', '3.11', '3.12', '3.13']
30+
os: [ubuntu-24.04, macos-14, windows-2022]
31+
fail-fast: false
32+
runs-on: ${{ matrix.os }}
2833
steps:
2934
- name: Checkout
3035
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -39,20 +44,14 @@ jobs:
3944
cache: pip
4045
cache-dependency-path: scripts/requirements-actions.txt
4146

42-
- name: install-packages
43-
working-directory: zephyr
44-
run: |
45-
pip install -r scripts/requirements-actions.txt --require-hashes
46-
sudo apt-get update -y
47-
sudo apt-get install -y lcov
48-
4947
- name: Setup Zephyr project
5048
uses: zephyrproject-rtos/action-zephyr-setup@f7b70269a8eb01f70c8e710891e4c94972a2f6b4 # v1.0.6
5149
with:
5250
app-path: zephyr
5351
toolchains: all
5452

5553
- name: Run Pytest For Twister Black Box Tests
54+
if: ${{ startsWith(runner.os, 'ubuntu') }}
5655
working-directory: zephyr
5756
shell: bash
5857
env:
@@ -63,3 +62,125 @@ jobs:
6362
echo "Run twister tests"
6463
source zephyr-env.sh
6564
PYTHONPATH="./scripts/tests" pytest ./scripts/tests/twister_blackbox/
65+
66+
- name: Build firmware No. 1 - basic
67+
working-directory: zephyr
68+
shell: bash
69+
run: |
70+
if [ "${{ runner.os }}" = "macOS" ]; then
71+
EXTRA_TWISTER_FLAGS="-P native_sim --build-only"
72+
elif [ "${{ runner.os }}" = "Windows" ]; then
73+
EXTRA_TWISTER_FLAGS="-P native_sim --short-build-path -O /tmp/twister-out"
74+
fi
75+
./scripts/twister --runtime-artifact-cleanup --force-color --inline-logs -T samples/hello_world -T samples/cpp/hello_world -v $EXTRA_TWISTER_FLAGS
76+
77+
- name: Build firmware No. 2 - save and load with emulation only
78+
working-directory: zephyr
79+
shell: bash
80+
run: |
81+
if [ "${{ runner.os }}" = "macOS" ]; then
82+
EXTRA_TWISTER_FLAGS="-P native_sim --build-only"
83+
elif [ "${{ runner.os }}" = "Windows" ]; then
84+
EXTRA_TWISTER_FLAGS="-P native_sim --short-build-path -O /tmp/twister-out"
85+
fi
86+
BASIC_FLAGS="--runtime-artifact-cleanup --force-color --inline-logs -T samples/hello_world -T samples/cpp/hello_world -v $EXTRA_TWISTER_FLAGS"
87+
./scripts/twister --save-tests tests.file $BASIC_FLAGS
88+
./scripts/twister --load-tests tests.file --emulation-only $BASIC_FLAGS
89+
rm tests.file
90+
91+
- name: Build firmware No. 3 - print out test plan
92+
working-directory: zephyr
93+
shell: bash
94+
run: |
95+
if [ "${{ runner.os }}" = "macOS" ]; then
96+
EXTRA_TWISTER_FLAGS="-P native_sim --build-only"
97+
elif [ "${{ runner.os }}" = "Windows" ]; then
98+
EXTRA_TWISTER_FLAGS="-P native_sim --short-build-path -O /tmp/twister-out"
99+
fi
100+
BASIC_FLAGS="--runtime-artifact-cleanup --force-color --inline-logs -v $EXTRA_TWISTER_FLAGS"
101+
./scripts/twister --test-tree -T tests/kernel/spinlock $BASIC_FLAGS
102+
103+
- name: Build firmware No. 4 - integration, exclude tag, filter, shuffle, dry run
104+
working-directory: zephyr
105+
shell: bash
106+
run: |
107+
if [ "${{ runner.os }}" = "macOS" ]; then
108+
EXTRA_TWISTER_FLAGS="-P native_sim --build-only"
109+
elif [ "${{ runner.os }}" = "Windows" ]; then
110+
EXTRA_TWISTER_FLAGS="-P native_sim --short-build-path -O /tmp/twister-out"
111+
fi
112+
BASIC_FLAGS="--runtime-artifact-cleanup --force-color --inline-logs -v $EXTRA_TWISTER_FLAGS"
113+
./scripts/twister --dry-run --integration --subset 1/3 --shuffle-tests --shuffle-tests-seed 1 --filter runnable --exclude-tag audio --exclude-tag driver $BASIC_FLAGS
114+
115+
- name: Build firmware No. 5 - test, arch, vendor, exclude-platform, platform-reports
116+
working-directory: zephyr
117+
shell: bash
118+
run: |
119+
if [ "${{ runner.os }}" = "macOS" ]; then
120+
EXTRA_TWISTER_FLAGS="-P native_sim --build-only"
121+
elif [ "${{ runner.os }}" = "Windows" ]; then
122+
EXTRA_TWISTER_FLAGS="-P native_sim --short-build-path -O /tmp/twister-out"
123+
fi
124+
BASIC_FLAGS="--runtime-artifact-cleanup --force-color --inline-logs -v $EXTRA_TWISTER_FLAGS"
125+
./scripts/twister --test kernel.multiprocessing.spinlock --arch x86 --exclude-platform qemu_x86_64 --vendor qemu --platform-reports $BASIC_FLAGS
126+
127+
- name: Build firmware No. 6 - subtest, platform, rom-ram report, ROM footprint report from buildlog, size report
128+
working-directory: zephyr
129+
shell: bash
130+
run: |
131+
if [ "${{ runner.os }}" = "macOS" ]; then
132+
EXTRA_TWISTER_FLAGS="-P native_sim --build-only"
133+
elif [ "${{ runner.os }}" = "Windows" ]; then
134+
EXTRA_TWISTER_FLAGS="-P native_sim --short-build-path -O /tmp/twister-out"
135+
fi
136+
BASIC_FLAGS="--runtime-artifact-cleanup --force-color --inline-logs -v $EXTRA_TWISTER_FLAGS"
137+
./scripts/twister --sub-test kernel.multiprocessing.spinlock.minimallibc.spinlock.spinlock_basic --platform qemu_x86 --create-rom-ram-report --footprint-report ROM --enable-size-report --footprint-from-buildlog $BASIC_FLAGS
138+
139+
- name: Build firmware No. 7 - list tags
140+
working-directory: zephyr
141+
shell: bash
142+
run: |
143+
if [ "${{ runner.os }}" = "macOS" ]; then
144+
EXTRA_TWISTER_FLAGS="-P native_sim --build-only"
145+
elif [ "${{ runner.os }}" = "Windows" ]; then
146+
EXTRA_TWISTER_FLAGS="-P native_sim --short-build-path -O /tmp/twister-out"
147+
fi
148+
BASIC_FLAGS="--runtime-artifact-cleanup --force-color --inline-logs -v $EXTRA_TWISTER_FLAGS"
149+
./scripts/twister --sub-test kernel.multiprocessing.spinlock.minimallibc.spinlock.spinlock_basic --list-tags $BASIC_FLAGS
150+
151+
- name: Build firmware No. 8 - list tests
152+
working-directory: zephyr
153+
shell: bash
154+
run: |
155+
if [ "${{ runner.os }}" = "macOS" ]; then
156+
EXTRA_TWISTER_FLAGS="-P native_sim --build-only"
157+
elif [ "${{ runner.os }}" = "Windows" ]; then
158+
EXTRA_TWISTER_FLAGS="-P native_sim --short-build-path -O /tmp/twister-out"
159+
fi
160+
BASIC_FLAGS="--runtime-artifact-cleanup --force-color --inline-logs -v $EXTRA_TWISTER_FLAGS"
161+
./scripts/twister -T tests/posix/common --list-tests $BASIC_FLAGS
162+
163+
- name: Build firmware No. 9 - report flags - dir, name, suffix, summary, all-options, filtered
164+
working-directory: zephyr
165+
shell: bash
166+
run: |
167+
if [ "${{ runner.os }}" = "macOS" ]; then
168+
EXTRA_TWISTER_FLAGS="-P native_sim --build-only"
169+
elif [ "${{ runner.os }}" = "Windows" ]; then
170+
EXTRA_TWISTER_FLAGS="-P native_sim --short-build-path -O /tmp/twister-out"
171+
fi
172+
BASIC_FLAGS="--runtime-artifact-cleanup --force-color --inline-logs -v $EXTRA_TWISTER_FLAGS"
173+
./scripts/twister --sub-test kernel.multiprocessing.spinlock.minimallibc.spinlock.spinlock_basic --platform qemu_x86 --report-dir . --report-name test_name --report-suffix suffix --report-summary 0 --report-all-options --report-filtered $BASIC_FLAGS
174+
175+
- name: Build firmware No. 10 - force platform and toolchain, log level, timestamps, logfile
176+
working-directory: zephyr
177+
shell: bash
178+
run: |
179+
if [ "${{ runner.os }}" = "macOS" ]; then
180+
EXTRA_TWISTER_FLAGS="-P native_sim --build-only"
181+
elif [ "${{ runner.os }}" = "Windows" ]; then
182+
EXTRA_TWISTER_FLAGS="-P native_sim --short-build-path -O /tmp/twister-out"
183+
fi
184+
BASIC_FLAGS="--runtime-artifact-cleanup --force-color --inline-logs -v $EXTRA_TWISTER_FLAGS"
185+
./scripts/twister --sub-test kernel.multiprocessing.spinlock.minimallibc.spinlock.spinlock_basic --force-platform --platform qemu_x86 --force-toolchain --log-level WARNING --log-file log.file $BASIC_FLAGS
186+
rm log.file

0 commit comments

Comments
 (0)