2021-07-25 08:51:38 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2021-12-17 09:04:12 +08:00
|
|
|
# Absolute
|
2021-07-25 08:51:38 +08:00
|
|
|
SOFTOP=$(cd "$(dirname "$0")"/.. && pwd)
|
|
|
|
|
2021-12-17 09:04:12 +08:00
|
|
|
# Relative
|
2021-07-25 08:51:38 +08:00
|
|
|
BUILDTOP=build_ut_defs
|
|
|
|
|
|
|
|
rebuild_config()
|
|
|
|
{
|
|
|
|
local conf="$1"
|
|
|
|
mkdir -p "$BUILDTOP"
|
2021-12-17 09:08:30 +08:00
|
|
|
printf '\n ========= Building native cmocka tests for %s ======\n\n' "$conf"
|
|
|
|
|
2021-07-25 08:51:38 +08:00
|
|
|
( set -x
|
2021-12-17 09:04:12 +08:00
|
|
|
cmake -DINIT_CONFIG="$conf" -S "$SOFTOP" -B "$BUILDTOP"/"$conf" \
|
|
|
|
-DBUILD_UNIT_TESTS=ON \
|
|
|
|
-DBUILD_UNIT_TESTS_HOST=ON
|
2021-07-25 08:51:38 +08:00
|
|
|
|
|
|
|
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
|
2021-12-17 09:08:30 +08:00
|
|
|
printf '\n\n ========= Running native cmocka tests in %s ======\n\n' "$d"
|
2021-07-25 08:51:38 +08:00
|
|
|
( set -x
|
|
|
|
cmake --build "$d" -- test
|
|
|
|
)
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
main "$@"
|