.github: run unit tests with -DBUILD_UNIT_TESTS_HOST=ON

Because we can.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This commit is contained in:
Marc Herbert 2021-07-25 00:51:38 +00:00 committed by Liam Girdwood
parent 3ac8906097
commit b63b8e992b
2 changed files with 60 additions and 0 deletions

21
.github/workflows/unit-tests.yml vendored Normal file
View File

@ -0,0 +1,21 @@
---
# https://thesofproject.github.io/latest/developer_guides/unit_tests.html
name: Unit tests
# 'workflow_dispatch' allows running this workflow manually from the
# 'Actions' tab
# yamllint disable-line rule:truthy
on: [pull_request, workflow_dispatch]
jobs:
cmocka_utests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with: {fetch-depth: 2}
- name: build and run all defconfigs
run: ./test/test-all-defconfigs.sh

39
test/test-all-defconfigs.sh Executable file
View File

@ -0,0 +1,39 @@
#!/bin/sh
set -e
SOFTOP=$(cd "$(dirname "$0")"/.. && pwd)
BUILDTOP=build_ut_defs
rebuild_config()
{
local conf="$1"
mkdir -p "$BUILDTOP"
( set -x
cmake -DINIT_CONFIG="$conf" -B "$BUILDTOP"/"$conf" -DBUILD_UNIT_TESTS=ON \
-DBUILD_UNIT_TESTS_HOST=ON
cmake --build "$BUILDTOP"/"$conf" -- -j"$(nproc)"
)
}
main()
{
local defconfig
# First make sure all configurations build
for d in "$SOFTOP"/src/arch/xtensa/configs/*_defconfig; do
defconfig=$(basename "$d")
rebuild_config "$defconfig"
done
# Now run all the tests
for d in "$BUILDTOP"/*_defconfig; do
( set -x
cmake --build "$d" -- test
)
done
}
main "$@"