| Andrew Jeffery | 1b1b728 | 2024-06-04 00:14:46 +0930 | [diff] [blame] | 1 | #!/usr/bin/sh | 
|  | 2 | set -eu | 
|  | 3 |  | 
| Andrew Jeffery | a4cfba4 | 2025-09-16 12:28:29 +0930 | [diff] [blame] | 4 | # For valgrind, value is arbitrarily low-ish | 
|  | 5 | ulimit -n 2048 | 
|  | 6 |  | 
| Andrew Jeffery | 1b1b728 | 2024-06-04 00:14:46 +0930 | [diff] [blame] | 7 | BUILD="$(mktemp --directory --tmpdir=.)" | 
|  | 8 | trap 'rm -rf "$BUILD"' EXIT | 
|  | 9 |  | 
| Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 10 | meson format --recursive --inplace || true | 
| Matt Johnston | fa2e265 | 2025-01-09 16:35:51 +0800 | [diff] [blame] | 11 | if ! git diff --exit-code | 
| Andrew Jeffery | 07159f7 | 2024-11-22 14:04:17 +1030 | [diff] [blame] | 12 | then | 
|  | 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 | 
|  | 18 | fi | 
| Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 19 |  | 
| Andrew Jeffery | cd02e9d | 2025-09-05 11:56:14 +0930 | [diff] [blame] | 20 | # Make sure if the change touches the public headers or ABI dump, it also | 
|  | 21 | # updates the changelog. | 
|  | 22 | if ! git show --format="" --name-only HEAD -- CHANGELOG.md abi include/libpldm | | 
| Andrew Jeffery | 5a03473 | 2024-11-22 13:49:47 +1030 | [diff] [blame] | 23 | awk -f scripts/changelog.awk | 
|  | 24 | then | 
| Andrew Jeffery | cd02e9d | 2025-09-05 11:56:14 +0930 | [diff] [blame] | 25 | echo Add a CHANGELOG entry to document updates under abi/ and include/libpldm/ | 
| Andrew Jeffery | 5a03473 | 2024-11-22 13:49:47 +1030 | [diff] [blame] | 26 | exit 1 | 
|  | 27 | fi | 
|  | 28 |  | 
| Andrew Jeffery | 1b1b728 | 2024-06-04 00:14:46 +0930 | [diff] [blame] | 29 | # 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. | 
| Chau Ly | aa0aeda | 2025-09-19 09:30:51 +0930 | [diff] [blame] | 32 | CC=gcc CXX=g++ CFLAGS=-fanalyzer meson setup "$BUILD" | 
| Andrew Jeffery | 1b1b728 | 2024-06-04 00:14:46 +0930 | [diff] [blame] | 33 | meson compile -C "$BUILD" | 
|  | 34 | meson 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. | 
|  | 41 | meson configure --buildtype=release "$BUILD" | 
|  | 42 | meson compile -C "$BUILD" | 
| Andrew Jeffery | 0129c53 | 2024-09-07 11:33:25 +0200 | [diff] [blame] | 43 | meson test -C "$BUILD" --timeout-multiplier 10 --wrapper 'valgrind --error-exitcode=1' | 
| Andrew Jeffery | 1b1b728 | 2024-06-04 00:14:46 +0930 | [diff] [blame] | 44 |  | 
| Chau Ly | aa0aeda | 2025-09-19 09:30:51 +0930 | [diff] [blame] | 45 | # Ensure that the test suite doesn't fail to link against the stable ABI, and | 
|  | 46 | # the stable ABI matches what's recorded | 
| Andrew Jeffery | 1b1b728 | 2024-06-04 00:14:46 +0930 | [diff] [blame] | 47 | meson configure --buildtype=debug "$BUILD" | 
|  | 48 | meson configure -Dabi=deprecated,stable "$BUILD" | 
| Chau Ly | aa0aeda | 2025-09-19 09:30:51 +0930 | [diff] [blame] | 49 | ! command -v abi-compliance-checker > /dev/null || | 
|  | 50 | meson configure -Dabi-compliance-check=true "$BUILD" | 
| Andrew Jeffery | 1b1b728 | 2024-06-04 00:14:46 +0930 | [diff] [blame] | 51 | meson compile -C "$BUILD" | 
|  | 52 | meson test -C "$BUILD" | 
| Andrew Jeffery | 0f520d1 | 2025-05-09 11:55:36 +0930 | [diff] [blame] | 53 |  | 
|  | 54 | # Ensure the build completes for maintenance purposes. Note that tests are | 
|  | 55 | # disabled as we don't yet guard them appropriately. | 
| Chau Ly | aa0aeda | 2025-09-19 09:30:51 +0930 | [diff] [blame] | 56 | meson configure -Dabi=stable,testing "$BUILD" | 
|  | 57 | meson configure -Dabi-compliance-check=false "$BUILD" | 
|  | 58 | meson configure -Dtests=false "$BUILD" | 
| Andrew Jeffery | 0f520d1 | 2025-05-09 11:55:36 +0930 | [diff] [blame] | 59 | meson compile -C "$BUILD" |