blob: b8f3fb98e745a4a262552f7623f338b74eb25e89 [file] [log] [blame]
Andrew Jeffery1b1b7282024-06-04 00:14:46 +09301#!/usr/bin/sh
2set -eu
3
4BUILD="$(mktemp --directory --tmpdir=.)"
5trap 'rm -rf "$BUILD"' EXIT
6
Andrew Jefferye984a462024-09-07 11:23:28 +02007meson format --recursive --inplace || true
Matt Johnstonfa2e2652025-01-09 16:35:51 +08008if ! git diff --exit-code
Andrew Jeffery07159f72024-11-22 14:04:17 +10309then
10 echo Your changes must meet the upstream meson style guide
11 echo
12 echo https://mesonbuild.com/Style-guide.html
13 echo https://mesonbuild.com/Commands.html#format
14 exit 1
15fi
Andrew Jefferye984a462024-09-07 11:23:28 +020016
Andrew Jefferycd02e9d2025-09-05 11:56:14 +093017# Make sure if the change touches the public headers or ABI dump, it also
18# updates the changelog.
19if ! git show --format="" --name-only HEAD -- CHANGELOG.md abi include/libpldm |
Andrew Jeffery5a034732024-11-22 13:49:47 +103020 awk -f scripts/changelog.awk
21then
Andrew Jefferycd02e9d2025-09-05 11:56:14 +093022 echo Add a CHANGELOG entry to document updates under abi/ and include/libpldm/
Andrew Jeffery5a034732024-11-22 13:49:47 +103023 exit 1
24fi
25
Andrew Jeffery1b1b7282024-06-04 00:14:46 +093026# Ensure the test suite passes in the default configuration. Note
27# that we don't specify -Dabi=... - the default is equivalent to
28# -Dabi=deprecated,stable,testing.
Andrew Jefferyeba16202025-03-12 20:57:15 +103029CC=gcc CXX=g++ CFLAGS=-fanalyzer meson setup -Dabi-compliance-check=false "$BUILD"
Andrew Jeffery1b1b7282024-06-04 00:14:46 +093030meson compile -C "$BUILD"
31meson test -C "$BUILD"
32
33# Ensure the test suite passes in release mode. libpldm specifies
34# -Db_ndebug=if-release by default, so building with --buildtype=release passes
35# -DNDEBUG to the compiler for the library implementation. This build
36# configuration will catch any unexpected changes in the library implementation
37# and incorrect test case implementations.
38meson configure --buildtype=release "$BUILD"
39meson compile -C "$BUILD"
Andrew Jeffery0129c532024-09-07 11:33:25 +020040meson test -C "$BUILD" --timeout-multiplier 10 --wrapper 'valgrind --error-exitcode=1'
Andrew Jeffery1b1b7282024-06-04 00:14:46 +093041
42# Ensure the test suite links when testing symbols are removed from the ABI
43meson configure --buildtype=debug "$BUILD"
44meson configure -Dabi=deprecated,stable "$BUILD"
45meson compile -C "$BUILD"
46meson test -C "$BUILD"
Andrew Jeffery0f520d12025-05-09 11:55:36 +093047
48# Ensure the build completes for maintenance purposes. Note that tests are
49# disabled as we don't yet guard them appropriately.
50meson configure -Dabi=stable,testing -Dtests=false "$BUILD"
51meson compile -C "$BUILD"