Skip to content

Commit

Permalink
scripts: Add pre-submit
Browse files Browse the repository at this point in the history
pre-submit runs through the pre-submission commands outlined in docs/
checklists/changes.md. This allows easy checking via:

```
$ git rebase -x ./scripts/pre-submit origin/main
```

Change-Id: Ib8b0f7725a31081cd70253032e107ed83aa22626
Signed-off-by: Andrew Jeffery <[email protected]>
  • Loading branch information
amboar committed Jun 6, 2024
1 parent 1111a97 commit 1b1b728
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/checklists/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,5 @@ Each of the following must succeed when executed in order. Note that to avoid
- [ ] `meson configure --buildtype=debug build`
- [ ] `meson configure -Dabi=deprecated,stable build`
- [ ] `meson compile -C build && meson test -C build`

This process is captured in `scripts/pre-submit` for automation.
27 changes: 27 additions & 0 deletions scripts/pre-submit
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/sh
set -eu

BUILD="$(mktemp --directory --tmpdir=.)"
trap 'rm -rf "$BUILD"' EXIT

# Ensure the test suite passes in the default configuration. Note
# that we don't specify -Dabi=... - the default is equivalent to
# -Dabi=deprecated,stable,testing.
meson setup -Dabi-compliance-check=disabled "$BUILD"
meson compile -C "$BUILD"
meson test -C "$BUILD"

# Ensure the test suite passes in release mode. libpldm specifies
# -Db_ndebug=if-release by default, so building with --buildtype=release passes
# -DNDEBUG to the compiler for the library implementation. This build
# configuration will catch any unexpected changes in the library implementation
# and incorrect test case implementations.
meson configure --buildtype=release "$BUILD"
meson compile -C "$BUILD"
meson test -C "$BUILD"

# Ensure the test suite links when testing symbols are removed from the ABI
meson configure --buildtype=debug "$BUILD"
meson configure -Dabi=deprecated,stable "$BUILD"
meson compile -C "$BUILD"
meson test -C "$BUILD"

0 comments on commit 1b1b728

Please sign in to comment.