All of lore.kernel.org
 help / color / mirror / Atom feed
* [dm-devel] [PATCH 1/3] multipath-tools: support ABI testing with libabigail
@ 2021-11-12 21:05 mwilck
  2021-11-12 21:05 ` [dm-devel] [PATCH 2/3] multipath-tools: add github workflow to save and check ABI mwilck
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: mwilck @ 2021-11-12 21:05 UTC (permalink / raw)
  To: Christophe Varoqui, Benjamin Marzinski; +Cc: dm-devel, Martin Wilck

From: Martin Wilck <mwilck@suse.com>

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".

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 .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(-)

diff --git a/.gitignore b/.gitignore
index 087dffc..5dbac39 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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
diff --git a/Makefile b/Makefile
index 7f21db8..1cec777 100644
--- a/Makefile
+++ b/Makefile
@@ -2,33 +2,70 @@
 # Copyright (C) 2003 Christophe Varoqui, <christophe.varoqui@opensvc.com>
 #
 
-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)
 
diff --git a/Makefile.inc b/Makefile.inc
index d0ec9b4..17071ef 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -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 $< >$@
diff --git a/libdmmp/Makefile b/libdmmp/Makefile
index 79b92fb..c91f0c3 100644
--- a/libdmmp/Makefile
+++ b/libdmmp/Makefile
@@ -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
 
diff --git a/libmpathcmd/Makefile b/libmpathcmd/Makefile
index 2591019..5a7a6e9 100644
--- a/libmpathcmd/Makefile
+++ b/libmpathcmd/Makefile
@@ -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))
 
diff --git a/libmpathpersist/Makefile b/libmpathpersist/Makefile
index 57103e5..d76918f 100644
--- a/libmpathpersist/Makefile
+++ b/libmpathpersist/Makefile
@@ -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))
 
diff --git a/libmpathvalid/Makefile b/libmpathvalid/Makefile
index 6bea4bc..b579535 100644
--- a/libmpathvalid/Makefile
+++ b/libmpathvalid/Makefile
@@ -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))
 
diff --git a/libmultipath/Makefile b/libmultipath/Makefile
index 7f3921c..42692b3 100644
--- a/libmultipath/Makefile
+++ b/libmultipath/Makefile
@@ -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))
 
-- 
2.33.1


--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [dm-devel] [PATCH 2/3] multipath-tools: add github workflow to save and check ABI
  2021-11-12 21:05 [dm-devel] [PATCH 1/3] multipath-tools: support ABI testing with libabigail mwilck
@ 2021-11-12 21:05 ` mwilck
  2021-11-17 18:20   ` Benjamin Marzinski
  2021-11-12 21:05 ` [dm-devel] [PATCH 3/3] multipath-tools: support generating compile_commands.json mwilck
  2021-11-17 18:20 ` [dm-devel] [PATCH 1/3] multipath-tools: support ABI testing with libabigail Benjamin Marzinski
  2 siblings, 1 reply; 6+ messages in thread
From: mwilck @ 2021-11-12 21:05 UTC (permalink / raw)
  To: Christophe Varoqui, Benjamin Marzinski; +Cc: dm-devel, Martin Wilck

From: Martin Wilck <mwilck@suse.com>

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".

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 .github/workflows/abi.yaml | 54 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 .github/workflows/abi.yaml

diff --git a/.github/workflows/abi.yaml b/.github/workflows/abi.yaml
new file mode 100644
index 0000000..53f10d4
--- /dev/null
+++ b/.github/workflows/abi.yaml
@@ -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
-- 
2.33.1


--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [dm-devel] [PATCH 3/3] multipath-tools: support generating compile_commands.json
  2021-11-12 21:05 [dm-devel] [PATCH 1/3] multipath-tools: support ABI testing with libabigail mwilck
  2021-11-12 21:05 ` [dm-devel] [PATCH 2/3] multipath-tools: add github workflow to save and check ABI mwilck
@ 2021-11-12 21:05 ` mwilck
  2021-11-17 18:20   ` Benjamin Marzinski
  2021-11-17 18:20 ` [dm-devel] [PATCH 1/3] multipath-tools: support ABI testing with libabigail Benjamin Marzinski
  2 siblings, 1 reply; 6+ messages in thread
From: mwilck @ 2021-11-12 21:05 UTC (permalink / raw)
  To: Christophe Varoqui, Benjamin Marzinski; +Cc: dm-devel, Martin Wilck

From: Martin Wilck <mwilck@suse.com>

This file is necessary to run clangd as helper for an IDE, e.g.
with emacs lsp-mode.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 .gitignore | 1 +
 Makefile   | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/.gitignore b/.gitignore
index 5dbac39..8e09f95 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,6 +17,7 @@ mpathpersist/mpathpersist
 abi.tar.gz
 abi
 abi-test
+compile_commands.json
 .nfs*
 *.swp
 *.patch
diff --git a/Makefile b/Makefile
index 1cec777..82e0ea3 100644
--- a/Makefile
+++ b/Makefile
@@ -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
-- 
2.33.1


--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [dm-devel] [PATCH 1/3] multipath-tools: support ABI testing with libabigail
  2021-11-12 21:05 [dm-devel] [PATCH 1/3] multipath-tools: support ABI testing with libabigail mwilck
  2021-11-12 21:05 ` [dm-devel] [PATCH 2/3] multipath-tools: add github workflow to save and check ABI mwilck
  2021-11-12 21:05 ` [dm-devel] [PATCH 3/3] multipath-tools: support generating compile_commands.json mwilck
@ 2021-11-17 18:20 ` Benjamin Marzinski
  2 siblings, 0 replies; 6+ messages in thread
From: Benjamin Marzinski @ 2021-11-17 18:20 UTC (permalink / raw)
  To: mwilck; +Cc: dm-devel

On Fri, Nov 12, 2021 at 10:05:49PM +0100, mwilck@suse.com wrote:
> From: Martin Wilck <mwilck@suse.com>
> 
> 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".
> 
> Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
> ---
>  .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(-)
> 
> diff --git a/.gitignore b/.gitignore
> index 087dffc..5dbac39 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -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
> diff --git a/Makefile b/Makefile
> index 7f21db8..1cec777 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2,33 +2,70 @@
>  # Copyright (C) 2003 Christophe Varoqui, <christophe.varoqui@opensvc.com>
>  #
>  
> -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)
>  
> diff --git a/Makefile.inc b/Makefile.inc
> index d0ec9b4..17071ef 100644
> --- a/Makefile.inc
> +++ b/Makefile.inc
> @@ -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 $< >$@
> diff --git a/libdmmp/Makefile b/libdmmp/Makefile
> index 79b92fb..c91f0c3 100644
> --- a/libdmmp/Makefile
> +++ b/libdmmp/Makefile
> @@ -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
>  
> diff --git a/libmpathcmd/Makefile b/libmpathcmd/Makefile
> index 2591019..5a7a6e9 100644
> --- a/libmpathcmd/Makefile
> +++ b/libmpathcmd/Makefile
> @@ -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))
>  
> diff --git a/libmpathpersist/Makefile b/libmpathpersist/Makefile
> index 57103e5..d76918f 100644
> --- a/libmpathpersist/Makefile
> +++ b/libmpathpersist/Makefile
> @@ -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))
>  
> diff --git a/libmpathvalid/Makefile b/libmpathvalid/Makefile
> index 6bea4bc..b579535 100644
> --- a/libmpathvalid/Makefile
> +++ b/libmpathvalid/Makefile
> @@ -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))
>  
> diff --git a/libmultipath/Makefile b/libmultipath/Makefile
> index 7f3921c..42692b3 100644
> --- a/libmultipath/Makefile
> +++ b/libmultipath/Makefile
> @@ -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))
>  
> -- 
> 2.33.1

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dm-devel] [PATCH 2/3] multipath-tools: add github workflow to save and check ABI
  2021-11-12 21:05 ` [dm-devel] [PATCH 2/3] multipath-tools: add github workflow to save and check ABI mwilck
@ 2021-11-17 18:20   ` Benjamin Marzinski
  0 siblings, 0 replies; 6+ messages in thread
From: Benjamin Marzinski @ 2021-11-17 18:20 UTC (permalink / raw)
  To: mwilck; +Cc: dm-devel

On Fri, Nov 12, 2021 at 10:05:50PM +0100, mwilck@suse.com wrote:
> From: Martin Wilck <mwilck@suse.com>
> 
> 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".
> 
> Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
> ---
>  .github/workflows/abi.yaml | 54 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 54 insertions(+)
>  create mode 100644 .github/workflows/abi.yaml
> 
> diff --git a/.github/workflows/abi.yaml b/.github/workflows/abi.yaml
> new file mode 100644
> index 0000000..53f10d4
> --- /dev/null
> +++ b/.github/workflows/abi.yaml
> @@ -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
> -- 
> 2.33.1

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dm-devel] [PATCH 3/3] multipath-tools: support generating compile_commands.json
  2021-11-12 21:05 ` [dm-devel] [PATCH 3/3] multipath-tools: support generating compile_commands.json mwilck
@ 2021-11-17 18:20   ` Benjamin Marzinski
  0 siblings, 0 replies; 6+ messages in thread
From: Benjamin Marzinski @ 2021-11-17 18:20 UTC (permalink / raw)
  To: mwilck; +Cc: dm-devel

On Fri, Nov 12, 2021 at 10:05:51PM +0100, mwilck@suse.com wrote:
> From: Martin Wilck <mwilck@suse.com>
> 
> This file is necessary to run clangd as helper for an IDE, e.g.
> with emacs lsp-mode.
> 
> Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
> ---
>  .gitignore | 1 +
>  Makefile   | 6 ++++++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/.gitignore b/.gitignore
> index 5dbac39..8e09f95 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -17,6 +17,7 @@ mpathpersist/mpathpersist
>  abi.tar.gz
>  abi
>  abi-test
> +compile_commands.json
>  .nfs*
>  *.swp
>  *.patch
> diff --git a/Makefile b/Makefile
> index 1cec777..82e0ea3 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -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
> -- 
> 2.33.1

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-11-17 18:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-12 21:05 [dm-devel] [PATCH 1/3] multipath-tools: support ABI testing with libabigail mwilck
2021-11-12 21:05 ` [dm-devel] [PATCH 2/3] multipath-tools: add github workflow to save and check ABI mwilck
2021-11-17 18:20   ` Benjamin Marzinski
2021-11-12 21:05 ` [dm-devel] [PATCH 3/3] multipath-tools: support generating compile_commands.json mwilck
2021-11-17 18:20   ` Benjamin Marzinski
2021-11-17 18:20 ` [dm-devel] [PATCH 1/3] multipath-tools: support ABI testing with libabigail Benjamin Marzinski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.