multipath-tools: support ABI testing with libabigail
Subsystems (2)
PATCH 1/3 multipath-tools: support ABI testing with libabigail
From: Martin Wilck <[email protected]>
Use abidw and abidiff (https://sourceware.org/libabigail/) to generate a formal representation of our ABI, and check for changes. This will reduce the amount of attention required to detect and track library version changes.
To check for differences, run "make abi" on some branch, rename the "abi" directory to "reference-abi", checkout a different branch, and run "make abi-test".
--- .gitignore | 4 +++ Makefile | 55 ++++++++++++++++++++++++++++++++++------ Makefile.inc | 6 +++++ libdmmp/Makefile | 8 ++++-- libmpathcmd/Makefile | 4 ++- libmpathpersist/Makefile | 4 ++- libmpathvalid/Makefile | 4 ++- libmultipath/Makefile | 4 ++- 8 files changed, 75 insertions(+), 14 deletions(-)
.gitignore +4 -0
@@ -3,6 +3,7 @@ *~ *.so *.so.0 +*.abi *.a *.gz *.d
@@ -13,6 +14,9 @@ kpartx/kpartx multipath/multipath multipathd/multipathd mpathpersist/mpathpersist +abi.tar.gz +abi +abi-test .nfs* *.swp *.patch
Makefile +47 -8
86 lines not on this page · raw message
Makefile.inc +6 -0
@@ -140,3 +140,9 @@ check_file = $(shell \ %.o: %.c @echo building $@ because of $? $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + +%.abi: %.so.0 + abidw $< >$@ + +%.abi: %.so + abidw $< >$@
libdmmp/Makefile +6 -2
@@ -25,7 +25,11 @@ all: $(LIBS) doc $(LIBS): $(OBJS) $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ -o $@ $(OBJS) $(LIBDEPS) - $(LN) $@ $(DEVLIB) + +$(DEVLIB): $(LIBS) + $(LN) $(LIBS) $@ + +abi: $(DEVLIB:%.so=%.abi) install: doc.gz mkdir -p $(DESTDIR)$(usrlibdir)
@@ -54,7 +58,7 @@ uninstall: $(RM) $(DESTDIR)$(pkgconfdir)/$(PKGFILE) clean: dep_clean - $(RM) core *.a *.o *.gz *.so *.so.* + $(RM) core *.a *.o *.gz *.so *.so.* *.abi $(RM) docs/man/*.gz $(MAKE) -C test clean
libmpathcmd/Makefile +3 -1
@@ -15,6 +15,8 @@ $(LIBS): $(OBJS) $(VERSION_SCRIPT) $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \ -Wl,--version-script=$(VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS) +abi: $(LIBS:%.so.0=%.abi) + $(DEVLIB): $(LIBS) $(LN) $(LIBS) $@
@@ -31,7 +33,7 @@ uninstall: $(RM) $(DESTDIR)$(includedir)/mpath_cmd.h clean: dep_clean - $(RM) core *.a *.o *.so *.so.* *.gz + $(RM) core *.a *.o *.so *.so.* *.gz *.abi include $(wildcard $(OBJS:.o=.d))
libmpathpersist/Makefile +3 -1
@@ -18,6 +18,8 @@ $(LIBS): $(OBJS) $(VERSION_SCRIPT) $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \ -Wl,--version-script=$(VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS) +abi: $(LIBS:%.so.0=%.abi) + $(DEVLIB): $(LIBS) $(LN) $(LIBS) $@
@@ -44,7 +46,7 @@ uninstall: $(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB) clean: dep_clean - $(RM) core *.a *.o *.so *.so.* *.gz + $(RM) core *.a *.o *.so *.so.* *.gz *.abi include $(wildcard $(OBJS:.o=.d))
libmpathvalid/Makefile +3 -1
@@ -18,6 +18,8 @@ $(LIBS): $(OBJS) $(VERSION_SCRIPT) $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ -o $@ $(OBJS) $(LIBDEPS) -Wl,--version-script=libmpathvalid.version $(LN) $(LIBS) $(DEVLIB) +abi: $(LIBS:%.so.0=%.abi) + install: $(LIBS) $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(syslibdir) $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
@@ -31,7 +33,7 @@ uninstall: $(RM) $(DESTDIR)$(includedir)/mpath_valid.h clean: dep_clean - $(RM) core *.a *.o *.so *.so.* *.gz + $(RM) core *.a *.o *.so *.so.* *.gz *.abi include $(wildcard $(OBJS:.o=.d))
libmultipath/Makefile +3 -1
@@ -81,6 +81,8 @@ $(LIBS): $(OBJS) $(VERSION_SCRIPT) $(DEVLIB): $(LIBS) $(LN) $(LIBS) $@ +abi: $(LIBS:%.so.0=%.abi) + ../tests/$(LIBS): $(OBJS) $(VERSION_SCRIPT) $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=`basename $@` \ -o $@ $(OBJS) $(LIBDEPS)
@@ -99,7 +101,7 @@ uninstall: $(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB) clean: dep_clean - $(RM) core *.a *.o *.so *.so.* *.gz nvme-ioctl.c nvme-ioctl.h + $(RM) core *.a *.o *.so *.so.* *.gz *.abi nvme-ioctl.c nvme-ioctl.h include $(wildcard $(OBJS:.o=.d))
Signature · 7 lines
2.33.1 -- dm-devel mailing list [email protected] https://listman.redhat.com/mailman/listinfo/dm-devel
PATCH 2/3 multipath-tools: add github workflow to save and check ABI
From: Martin Wilck <[email protected]>
This adds a workflow that saves the ABI of libmultipath and the other libraries, and optionally tests it against a known-good state, which is taken from the configurable ABI_BRANCH. If the ABI differs, the workflow fails, and the abidiff output is saved in GH actions as artifact "abi-test".
To configure the reference branch, set the repository secret ABI_BRANCH to the name of the branch that contains the ABI reference. The default is "master".
--- .github/workflows/abi.yaml | 54 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/abi.yaml
.github/workflows/abi.yaml new file +54 -0
@@ -0,0 +1,54 @@ +name: check-abi +on: + - push + - pull_request +env: + ABI_BRANCH: ${{ secrets.ABI_BRANCH }} + +jobs: + save-and-test-ABI: + runs-on: ubuntu-20.04 + steps: + - name: set ABI branch + if: ${{ env.ABI_BRANCH == '' }} + run: echo "ABI_BRANCH=master" >> $GITHUB_ENV + - name: checkout + uses: actions/checkout@v2 + - name: get reference ABI + id: reference + continue-on-error: true + uses: dawidd6/action-download-artifact@v2 + with: + workflow: abi.yaml + branch: ${{ env.ABI_BRANCH }} + name: abi + path: reference-abi + - name: update + run: sudo apt-get update + - name: dependencies + run: > + sudo apt-get install --yes gcc + gcc make pkg-config abigail-tools + libdevmapper-dev libreadline-dev libaio-dev libsystemd-dev + libudev-dev libjson-c-dev liburcu-dev libcmocka-dev + - name: create ABI + run: make -O -j$(grep -c ^processor /proc/cpuinfo) abi.tar.gz + - name: save ABI + uses: actions/upload-artifact@v1 + with: + name: abi + path: abi + - name: compare ABI against reference + id: compare + continue-on-error: true + if: ${{ steps.reference.outcome == 'success' }} + run: make abi-test + - name: save differences + if: ${{ steps.compare.outcome == 'failure' }} + uses: actions/upload-artifact@v1 + with: + name: abi-test + path: abi-test + - name: fail + if: ${{ steps.compare.outcome == 'failure' }} + run: false
Signature · 7 lines
2.33.1 -- dm-devel mailing list [email protected] https://listman.redhat.com/mailman/listinfo/dm-devel
Re: [dm-devel] [PATCH 2/3] multipath-tools: add github workflow to save and check ABI
Quoted 8 lines · On Fri, Nov 12, 2021 at 10:05:50PM +0100, [email protected] wrote:
From: Martin Wilck <[email protected]>
This adds a workflow that saves the ABI of libmultipath and the other libraries, and optionally tests it against a known-good state, which is taken from the configurable
ABI_BRANCH. If the ABI differs, the workflow fails, and the abidiff output is saved in GH actions as artifact "abi-test".
Quoted 4 lines
To configure the reference branch, set the repository secret
ABI_BRANCHto the name of the branch that contains the ABI reference. The default is "master".Signed-off-by Martin Wilck <[email protected]>
Quoted 67 lines
--- .github/workflows/abi.yaml | 54 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/abi.yaml.github/workflows/abi.yaml new file +54
-0@@ -0,0 +1,54 @@ +name: check-abi +on: + - push + - pull_request +env: + ABI_BRANCH: ${{ secrets.ABI_BRANCH }} + +jobs: + save-and-test-ABI: + runs-on: ubuntu-20.04 + steps: + - name: set ABI branch + if: ${{ env.ABI_BRANCH == '' }} + run: echo "ABI_BRANCH=master" >> $GITHUB_ENV + - name: checkout + uses: actions/checkout@v2 + - name: get reference ABI + id: reference + continue-on-error: true + uses: dawidd6/action-download-artifact@v2 + with: + workflow: abi.yaml + branch: ${{ env.ABI_BRANCH }} + name: abi + path: reference-abi + - name: update + run: sudo apt-get update + - name: dependencies + run: > + sudo apt-get install --yes gcc + gcc make pkg-config abigail-tools + libdevmapper-dev libreadline-dev libaio-dev libsystemd-dev + libudev-dev libjson-c-dev liburcu-dev libcmocka-dev + - name: create ABI + run: make -O -j$(grep -c ^processor /proc/cpuinfo) abi.tar.gz + - name: save ABI + uses: actions/upload-artifact@v1 + with: + name: abi + path: abi + - name: compare ABI against reference + id: compare + continue-on-error: true + if: ${{ steps.reference.outcome == 'success' }} + run: make abi-test + - name: save differences + if: ${{ steps.compare.outcome == 'failure' }} + uses: actions/upload-artifact@v1 + with: + name: abi-test + path: abi-test + - name: fail + if: ${{ steps.compare.outcome == 'failure' }} + run: falseSignature · 1 line
2.33.1
--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
PATCH 3/3 multipath-tools: support generating compile_commands.json
In reply to [email protected]From: Martin Wilck <[email protected]>
This file is necessary to run clangd as helper for an IDE, e.g. with emacs lsp-mode.
--- .gitignore | 1 + Makefile | 6 ++++++ 2 files changed, 7 insertions(+)
.gitignore +1 -0
@@ -17,6 +17,7 @@ mpathpersist/mpathpersist abi.tar.gz abi abi-test +compile_commands.json .nfs* *.swp *.patch
Makefile +6 -0
@@ -66,6 +66,12 @@ abi-test: abi reference-abi $(wildcard abi/*.abi) fi; \ [ $$err -eq 0 ] +# Create compile_commands.json, useful for using clangd with an IDE +# Requires bear (https://github.com/rizsotto/Bear) +compile_commands.json: Makefile Makefile.inc $(BUILDDIRS:=/Makefile) + $(MAKE) clean + bear -- $(MAKE) + libmultipath libdmmp: libmpathcmd libmpathpersist libmpathvalid multipath multipathd: libmultipath libmultipath/prioritizers libmultipath/checkers libmultipath/foreign: libmultipath
Signature · 7 lines
2.33.1 -- dm-devel mailing list [email protected] https://listman.redhat.com/mailman/listinfo/dm-devel
Re: [dm-devel] [PATCH 3/3] multipath-tools: support generating compile_commands.json
Quoted 6 lines · On Fri, Nov 12, 2021 at 10:05:51PM +0100, [email protected] wrote:
From: Martin Wilck <[email protected]>
This file is necessary to run clangd as helper for an IDE, e.g. with emacs lsp-mode.
Signed-off-by Martin Wilck <[email protected]>
Quoted 36 lines
--- .gitignore | 1 + Makefile | 6 ++++++ 2 files changed, 7 insertions(+).gitignore +1
-0@@ -17,6 +17,7 @@ mpathpersist/mpathpersist abi.tar.gz abi abi-test +compile_commands.json .nfs* *.swp *.patchMakefile +6
-0@@ -66,6 +66,12 @@ abi-test: abi reference-abi $(wildcard abi/*.abi) fi; \ [ $$err -eq 0 ] +# Create compile_commands.json, useful for using clangd with an IDE +# Requires bear (https://github.com/rizsotto/Bear) +compile_commands.json: Makefile Makefile.inc $(BUILDDIRS:=/Makefile) + $(MAKE) clean + bear -- $(MAKE) + libmultipath libdmmp: libmpathcmd libmpathpersist libmpathvalid multipath multipathd: libmultipath libmultipath/prioritizers libmultipath/checkers libmultipath/foreign: libmultipathSignature · 1 line
2.33.1
--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
Quoted 7 lines · On Fri, Nov 12, 2021 at 10:05:49PM +0100, [email protected] wrote:
From: Martin Wilck <[email protected]>
Use abidw and abidiff (https://sourceware.org/libabigail/) to generate a formal representation of our ABI, and check for changes. This will reduce the amount of attention required to detect and track library version changes.
Quoted 5 lines
To check for differences, run "make abi" on some branch, rename the "abi" directory to "reference-abi", checkout a different branch, and run "make abi-test".
Signed-off-by Martin Wilck <[email protected]>
Quoted 255 lines
--- .gitignore | 4 +++ Makefile | 55 ++++++++++++++++++++++++++++++++++------ Makefile.inc | 6 +++++ libdmmp/Makefile | 8 ++++-- libmpathcmd/Makefile | 4 ++- libmpathpersist/Makefile | 4 ++- libmpathvalid/Makefile | 4 ++- libmultipath/Makefile | 4 ++- 8 files changed, 75 insertions(+), 14 deletions(-).gitignore +4
-0@@ -3,6 +3,7 @@ *~ *.so *.so.0 +*.abi *.a *.gz *.d@@ -13,6 +14,9 @@ kpartx/kpartx multipath/multipath multipathd/multipathd mpathpersist/mpathpersist +abi.tar.gz +abi +abi-test .nfs* *.swp *.patchMakefile +47
-8@@ -2,33 +2,70 @@ # Copyright (C) 2003 Christophe Varoqui, <[email protected]> # -BUILDDIRS := \ +LIB_BUILDDIRS := \ libmpathcmd \ libmultipath \ + libmpathpersist \ + libmpathvalid + +ifneq ($(ENABLE_LIBDMMP),0) +LIB_BUILDDIRS += \ + libdmmp +endif + +BUILDDIRS := $(LIB_BUILDDIRS) \ libmultipath/prioritizers \ libmultipath/checkers \ libmultipath/foreign \ - libmpathpersist \ - libmpathvalid \ multipath \ multipathd \ mpathpersist \ kpartx -ifneq ($(ENABLE_LIBDMMP),0) -BUILDDIRS += \ - libdmmp -endif BUILDDIRS.clean := $(BUILDDIRS:=.clean) tests.clean -.PHONY: $(BUILDDIRS) $(BUILDDIRS:=.uninstall) $(BUILDDIRS:=.install) $(BUILDDIRS.clean) +.PHONY: $(BUILDDIRS) $(BUILDDIRS:=.uninstall) $(BUILDDIRS:=.install) $(BUILDDIRS:=.clean) $(LIB_BUILDDIRS:=.abi) all: $(BUILDDIRS) $(BUILDDIRS): $(MAKE) -C $@ +$(LIB_BUILDDIRS:=.abi): $(LIB_BUILDDIRS) + $(MAKE) -C ${@:.abi=} abi + +# Create formal representation of the ABI +# Useful for verifying ABI compatibility +# Requires abidw from the abigail suite (https://sourceware.org/libabigail/) +.PHONY: abi +abi: $(LIB_BUILDDIRS:=.abi) + mkdir -p $@ + ln -ft $@ $(LIB_BUILDDIRS:=/*.abi) + +abi.tar.gz: abi + tar cfz $@ abi + +# Check the ABI against a reference. +# This requires the ABI from a previous run to be present +# in the directory "reference-abi" +# Requires abidiff from the abigail suite +abi-test: abi reference-abi $(wildcard abi/*.abi) + @err=0; \ + for lib in abi/*.abi; do \ + diff=$$(abidiff "reference-$$lib" "$$lib") || { \ + err=1; \ + echo "==== ABI differences in for $$lib ===="; \ + echo "$$diff"; \ + }; \ + done >$@; \ + if [ $$err -eq 0 ]; then \ + echo "*** OK, ABI unchanged ***"; \ + else \ + echo "*** WARNING: ABI has changed, see file $@ ***"; \ + fi; \ + [ $$err -eq 0 ] + libmultipath libdmmp: libmpathcmd libmpathpersist libmpathvalid multipath multipathd: libmultipath libmultipath/prioritizers libmultipath/checkers libmultipath/foreign: libmultipath@@ -48,6 +85,8 @@ $(BUILDDIRS:=.uninstall): $(MAKE) -C ${@:.uninstall=} uninstall clean: $(BUILDDIRS.clean) + rm -rf abi abi.tar.gz abi-test compile_commands.json + install: all $(BUILDDIRS:=.install) uninstall: $(BUILDDIRS:=.uninstall)Makefile.inc +6
-0@@ -140,3 +140,9 @@ check_file = $(shell \ %.o: %.c @echo building $@ because of $? $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + +%.abi: %.so.0 + abidw $< >$@ + +%.abi: %.so + abidw $< >$@libdmmp/Makefile +6
-2@@ -25,7 +25,11 @@ all: $(LIBS) doc $(LIBS): $(OBJS) $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ -o $@ $(OBJS) $(LIBDEPS) - $(LN) $@ $(DEVLIB) + +$(DEVLIB): $(LIBS) + $(LN) $(LIBS) $@ + +abi: $(DEVLIB:%.so=%.abi) install: doc.gz mkdir -p $(DESTDIR)$(usrlibdir)@@ -54,7 +58,7 @@ uninstall: $(RM) $(DESTDIR)$(pkgconfdir)/$(PKGFILE) clean: dep_clean - $(RM) core *.a *.o *.gz *.so *.so.* + $(RM) core *.a *.o *.gz *.so *.so.* *.abi $(RM) docs/man/*.gz $(MAKE) -C test cleanlibmpathcmd/Makefile +3
-1@@ -15,6 +15,8 @@ $(LIBS): $(OBJS) $(VERSION_SCRIPT) $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \ -Wl,--version-script=$(VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS) +abi: $(LIBS:%.so.0=%.abi) + $(DEVLIB): $(LIBS) $(LN) $(LIBS) $@@@ -31,7 +33,7 @@ uninstall: $(RM) $(DESTDIR)$(includedir)/mpath_cmd.h clean: dep_clean - $(RM) core *.a *.o *.so *.so.* *.gz + $(RM) core *.a *.o *.so *.so.* *.gz *.abi include $(wildcard $(OBJS:.o=.d))libmpathpersist/Makefile +3
-1@@ -18,6 +18,8 @@ $(LIBS): $(OBJS) $(VERSION_SCRIPT) $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \ -Wl,--version-script=$(VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS) +abi: $(LIBS:%.so.0=%.abi) + $(DEVLIB): $(LIBS) $(LN) $(LIBS) $@@@ -44,7 +46,7 @@ uninstall: $(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB) clean: dep_clean - $(RM) core *.a *.o *.so *.so.* *.gz + $(RM) core *.a *.o *.so *.so.* *.gz *.abi include $(wildcard $(OBJS:.o=.d))libmpathvalid/Makefile +3
-1@@ -18,6 +18,8 @@ $(LIBS): $(OBJS) $(VERSION_SCRIPT) $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ -o $@ $(OBJS) $(LIBDEPS) -Wl,--version-script=libmpathvalid.version $(LN) $(LIBS) $(DEVLIB) +abi: $(LIBS:%.so.0=%.abi) + install: $(LIBS) $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(syslibdir) $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)@@ -31,7 +33,7 @@ uninstall: $(RM) $(DESTDIR)$(includedir)/mpath_valid.h clean: dep_clean - $(RM) core *.a *.o *.so *.so.* *.gz + $(RM) core *.a *.o *.so *.so.* *.gz *.abi include $(wildcard $(OBJS:.o=.d))libmultipath/Makefile +3
-1@@ -81,6 +81,8 @@ $(LIBS): $(OBJS) $(VERSION_SCRIPT) $(DEVLIB): $(LIBS) $(LN) $(LIBS) $@ +abi: $(LIBS:%.so.0=%.abi) + ../tests/$(LIBS): $(OBJS) $(VERSION_SCRIPT) $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=`basename $@` \ -o $@ $(OBJS) $(LIBDEPS)@@ -99,7 +101,7 @@ uninstall: $(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB) clean: dep_clean - $(RM) core *.a *.o *.so *.so.* *.gz nvme-ioctl.c nvme-ioctl.h + $(RM) core *.a *.o *.so *.so.* *.gz *.abi nvme-ioctl.c nvme-ioctl.h include $(wildcard $(OBJS:.o=.d))Signature · 1 line
2.33.1
--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel