| Andrew Jeffery | 1b1b728 | 2024-06-04 00:14:46 +0930 | [diff] [blame] | 1 | #!/usr/bin/sh | 
|  | 2 | set -eu | 
|  | 3 |  | 
|  | 4 | BUILD="$(mktemp --directory --tmpdir=.)" | 
|  | 5 | trap 'rm -rf "$BUILD"' EXIT | 
|  | 6 |  | 
| Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 7 | meson format --recursive --inplace || true | 
| Andrew Jeffery | 566f2fc | 2024-11-22 14:05:49 +1030 | [diff] [blame] | 8 | if ! git diff | 
| Andrew Jeffery | 07159f7 | 2024-11-22 14:04:17 +1030 | [diff] [blame] | 9 | then | 
|  | 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 | 
|  | 15 | fi | 
| Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame] | 16 |  | 
| Andrew Jeffery | 5a03473 | 2024-11-22 13:49:47 +1030 | [diff] [blame] | 17 | # Make sure if the change touches the public headers, it also updates the | 
|  | 18 | # changelog. | 
|  | 19 | if ! git show --format="" --name-only HEAD -- CHANGELOG.md include/libpldm | | 
|  | 20 | awk -f scripts/changelog.awk | 
|  | 21 | then | 
|  | 22 | echo You must document your changes under include/libpldm in CHANGELOG.md | 
|  | 23 | exit 1 | 
|  | 24 | fi | 
|  | 25 |  | 
| Andrew Jeffery | 1b1b728 | 2024-06-04 00:14:46 +0930 | [diff] [blame] | 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. | 
| Andrew Jeffery | 65c6409 | 2024-11-29 11:52:13 +1030 | [diff] [blame] | 29 | CFLAGS=-fanalyzer meson setup -Dabi-compliance-check=false "$BUILD" | 
| Andrew Jeffery | 1b1b728 | 2024-06-04 00:14:46 +0930 | [diff] [blame] | 30 | meson compile -C "$BUILD" | 
|  | 31 | meson 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. | 
|  | 38 | meson configure --buildtype=release "$BUILD" | 
|  | 39 | meson compile -C "$BUILD" | 
| Andrew Jeffery | 0129c53 | 2024-09-07 11:33:25 +0200 | [diff] [blame] | 40 | meson test -C "$BUILD" --timeout-multiplier 10 --wrapper 'valgrind --error-exitcode=1' | 
| Andrew Jeffery | 1b1b728 | 2024-06-04 00:14:46 +0930 | [diff] [blame] | 41 |  | 
|  | 42 | # Ensure the test suite links when testing symbols are removed from the ABI | 
|  | 43 | meson configure --buildtype=debug "$BUILD" | 
|  | 44 | meson configure -Dabi=deprecated,stable "$BUILD" | 
|  | 45 | meson compile -C "$BUILD" | 
|  | 46 | meson test -C "$BUILD" |