1#!/usr/bin/sh 2set -eu 3 4BUILD="$(mktemp --directory --tmpdir=.)" 5trap 'rm -rf "$BUILD"' EXIT 6 7meson format --recursive --inplace || true 8if ! git diff 9then 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 16 17# 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 26# 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. 29CFLAGS=-fanalyzer meson setup -Dabi-compliance-check=false "$BUILD" 30meson 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" 40meson test -C "$BUILD" --timeout-multiplier 10 --wrapper 'valgrind --error-exitcode=1' 41 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" 47