xref: /openbmc/libpldm/scripts/pre-submit (revision 5a034730)
1#!/usr/bin/sh
2set -eu
3
4BUILD="$(mktemp --directory --tmpdir=.)"
5trap 'rm -rf "$BUILD"' EXIT
6
7meson format --recursive --inplace || true
8git diff --quiet
9
10# Make sure if the change touches the public headers, it also updates the
11# changelog.
12if ! git show --format="" --name-only HEAD -- CHANGELOG.md include/libpldm |
13  awk -f scripts/changelog.awk
14then
15  echo You must document your changes under include/libpldm in CHANGELOG.md
16  exit 1
17fi
18
19# Ensure the test suite passes in the default configuration. Note
20# that we don't specify -Dabi=... - the default is equivalent to
21# -Dabi=deprecated,stable,testing.
22CFLAGS=-fanalyzer meson setup -Dabi-compliance-check=disabled "$BUILD"
23meson compile -C "$BUILD"
24meson test -C "$BUILD"
25
26# Ensure the test suite passes in release mode. libpldm specifies
27# -Db_ndebug=if-release by default, so building with --buildtype=release passes
28# -DNDEBUG to the compiler for the library implementation. This build
29# configuration will catch any unexpected changes in the library implementation
30# and incorrect test case implementations.
31meson configure --buildtype=release "$BUILD"
32meson compile -C "$BUILD"
33meson test -C "$BUILD" --timeout-multiplier 10 --wrapper 'valgrind --error-exitcode=1'
34
35# Ensure the test suite links when testing symbols are removed from the ABI
36meson configure --buildtype=debug "$BUILD"
37meson configure -Dabi=deprecated,stable "$BUILD"
38meson compile -C "$BUILD"
39meson test -C "$BUILD"
40