blob: 388046f53c52c8fde11519fd15aa762c6abffbfa [file] [log] [blame]
Andrew Jeffery1b1b7282024-06-04 00:14:46 +09301#!/usr/bin/sh
2set -eu
3
Andrew Jefferya4cfba42025-09-16 12:28:29 +09304# For valgrind, value is arbitrarily low-ish
5ulimit -n 2048
6
Andrew Jeffery1b1b7282024-06-04 00:14:46 +09307BUILD="$(mktemp --directory --tmpdir=.)"
8trap 'rm -rf "$BUILD"' EXIT
9
Andrew Jefferye984a462024-09-07 11:23:28 +020010meson format --recursive --inplace || true
Matt Johnstonfa2e2652025-01-09 16:35:51 +080011if ! git diff --exit-code
Andrew Jeffery07159f72024-11-22 14:04:17 +103012then
13 echo Your changes must meet the upstream meson style guide
14 echo
15 echo https://mesonbuild.com/Style-guide.html
16 echo https://mesonbuild.com/Commands.html#format
17 exit 1
18fi
Andrew Jefferye984a462024-09-07 11:23:28 +020019
Andrew Jefferycd02e9d2025-09-05 11:56:14 +093020# Make sure if the change touches the public headers or ABI dump, it also
21# updates the changelog.
22if ! git show --format="" --name-only HEAD -- CHANGELOG.md abi include/libpldm |
Andrew Jeffery5a034732024-11-22 13:49:47 +103023 awk -f scripts/changelog.awk
24then
Andrew Jefferycd02e9d2025-09-05 11:56:14 +093025 echo Add a CHANGELOG entry to document updates under abi/ and include/libpldm/
Andrew Jeffery5a034732024-11-22 13:49:47 +103026 exit 1
27fi
28
Andrew Jeffery1b1b7282024-06-04 00:14:46 +093029# Ensure the test suite passes in the default configuration. Note
30# that we don't specify -Dabi=... - the default is equivalent to
31# -Dabi=deprecated,stable,testing.
Chau Lyaa0aeda2025-09-19 09:30:51 +093032CC=gcc CXX=g++ CFLAGS=-fanalyzer meson setup "$BUILD"
Andrew Jeffery1b1b7282024-06-04 00:14:46 +093033meson compile -C "$BUILD"
34meson test -C "$BUILD"
35
36# Ensure the test suite passes in release mode. libpldm specifies
37# -Db_ndebug=if-release by default, so building with --buildtype=release passes
38# -DNDEBUG to the compiler for the library implementation. This build
39# configuration will catch any unexpected changes in the library implementation
40# and incorrect test case implementations.
41meson configure --buildtype=release "$BUILD"
42meson compile -C "$BUILD"
Andrew Jeffery0129c532024-09-07 11:33:25 +020043meson test -C "$BUILD" --timeout-multiplier 10 --wrapper 'valgrind --error-exitcode=1'
Andrew Jeffery1b1b7282024-06-04 00:14:46 +093044
Chau Lyaa0aeda2025-09-19 09:30:51 +093045# Ensure that the test suite doesn't fail to link against the stable ABI, and
46# the stable ABI matches what's recorded
Andrew Jeffery1b1b7282024-06-04 00:14:46 +093047meson configure --buildtype=debug "$BUILD"
48meson configure -Dabi=deprecated,stable "$BUILD"
Chau Lyaa0aeda2025-09-19 09:30:51 +093049! command -v abi-compliance-checker > /dev/null ||
50 meson configure -Dabi-compliance-check=true "$BUILD"
Andrew Jeffery1b1b7282024-06-04 00:14:46 +093051meson compile -C "$BUILD"
52meson test -C "$BUILD"
Andrew Jeffery0f520d12025-05-09 11:55:36 +093053
54# Ensure the build completes for maintenance purposes. Note that tests are
55# disabled as we don't yet guard them appropriately.
Chau Lyaa0aeda2025-09-19 09:30:51 +093056meson configure -Dabi=stable,testing "$BUILD"
57meson configure -Dabi-compliance-check=false "$BUILD"
58meson configure -Dtests=false "$BUILD"
Andrew Jeffery0f520d12025-05-09 11:55:36 +093059meson compile -C "$BUILD"