blob: dbf990de9bbe4a12048281489a8f325258780844 [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
Andrew Jeffery566f2fc2024-11-22 14:05:49 +10308if ! git diff
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 Jeffery5a034732024-11-22 13:49:47 +103017# Make sure if the change touches the public headers, it also updates the
18# changelog.
19if ! git show --format="" --name-only HEAD -- CHANGELOG.md include/libpldm |
20 awk -f scripts/changelog.awk
21then
22 echo You must document your changes under include/libpldm in CHANGELOG.md
23 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 Jeffery65c64092024-11-29 11:52:13 +103029CFLAGS=-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"