blob: 7fd3dd2009aaa5921157b97e34eaf1a9a78d152a [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.
Andrew Jefferyeba16202025-03-12 20:57:15 +103032CC=gcc CXX=g++ CFLAGS=-fanalyzer meson setup -Dabi-compliance-check=false "$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
45# Ensure the test suite links when testing symbols are removed from the ABI
46meson configure --buildtype=debug "$BUILD"
47meson configure -Dabi=deprecated,stable "$BUILD"
48meson compile -C "$BUILD"
49meson test -C "$BUILD"
Andrew Jeffery0f520d12025-05-09 11:55:36 +093050
51# Ensure the build completes for maintenance purposes. Note that tests are
52# disabled as we don't yet guard them appropriately.
53meson configure -Dabi=stable,testing -Dtests=false "$BUILD"
54meson compile -C "$BUILD"