Skip to content

Commit

Permalink
rust: add bindgen bindings check to make check
Browse files Browse the repository at this point in the history
If we have bindgen, and we're building in-tree, rebuild the bindings
and compare to the previous bindings and print a warning if there is a
difference.

Only a warning for now, as I'm not sure where this might fail, and I
don't want it to become a nuisance.
  • Loading branch information
jasonish committed Jan 22, 2025
1 parent 49ea2e1 commit 007870d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions rust/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,28 @@ clean-local:
distclean-local:
rm -rf vendor dist

check-bindgen-bindings:
if HAVE_BINDGEN
if test "$(top_srcdir)" = "$(top_builddir)"; then \
cp src/_sys.rs src/_sys.rs.orig; \
$(MAKE) update-bindings; \
if diff src/_sys.rs src/_sys.rs.orig > /dev/null 2>&1; then \
rm -f src/_sys.rs.orig; \
else \
echo "WARNING: bindgen bindings may be out of date"; \
fi \
else \
echo "Not checking bindings for out of tree build"; \
fi
else
@echo "Unable to check bindgen bindings: bindgen not found"
endif

check:
cd $(abs_top_srcdir)/rust && \
$(CARGO_ENV) \
$(CARGO) test --all $(RELEASE) --features "$(RUST_FEATURES)"
$(MAKE) check-bindgen-bindings

vendor:
$(CARGO_ENV) $(CARGO) vendor
Expand Down

0 comments on commit 007870d

Please sign in to comment.