| 1 | ABI Compatibility test |
| 2 | ---------------------- |
| 3 | |
| 4 | abicheck.sh uses libabigail to check ABI stability. |
| 5 | It will abort if the current source |
| 6 | tree has a change that breaks binary compatibility. |
| 7 | |
| 8 | This protects against the common scenario where: |
| 9 | - an app is compiled against the current zlib-ng |
| 10 | - the system package manager updates the zlib-ng shared library |
| 11 | - the app now crashes because some symbol is |
| 12 | missing or some public structure or parameter |
| 13 | has changed type or size |
| 14 | |
| 15 | If run with --zlib-compat, it verifies that the |
| 16 | current source tree generates a library that |
| 17 | is ABI-compatible with the reference release |
| 18 | of classic zlib. This ensures that building |
| 19 | zlib-ng with --zlib-compat does what it says on the tin. |
| 20 | |
| 21 | abicheck.sh is not perfect, but it can catch |
| 22 | many common compatibility issues. |
| 23 | |
| 24 | Cached files test/abi/*.abi |
| 25 | --------------------------- |
| 26 | |
| 27 | Comparing to the old version of zlib (or zlib-ng) |
| 28 | means someone has to check out and build |
| 29 | the previous source tree and extract its .abi |
| 30 | using abidw. This can be slow. |
| 31 | |
| 32 | If you don't mind the slowness, run abicheck.sh --refresh-if, |
| 33 | and it will download and build the reference version |
| 34 | and extract the .abi on the spot if needed. |
| 35 | (FIXME: should this be the default?) |
| 36 | |
| 37 | On the next run, the reference .abi file will already be |
| 38 | present, and that step will be skipped. |
| 39 | It's stored in the tests/abi directory, |
| 40 | in a file with the architecture and git hash in the name. |
| 41 | |
| 42 | If you're running continuous integration |
| 43 | which clear out the source tree on each run, |
| 44 | and you don't want your build machines |
| 45 | constantly downloading and building the old |
| 46 | version, you can check the .abi file into git. |
| 47 | |
| 48 | To make this easier, a helper script could be written to automatically build |
| 49 | all the configurations tested by .github/workflows/abicheck.yml |
| 50 | Then they could be checked into git en masse by a maintainer |
| 51 | when a new platform is added or a new major version (which |
| 52 | intentionally breaks backwards compatibility) is being prepared. |
| 53 | |
| 54 | Further reading |
| 55 | --------------- |
| 56 | |
| 57 | - https://sourceware.org/libabigail/manual/ |
| 58 | - https://developers.redhat.com/blog/2014/10/23/comparing-abis-for-compatibility-with-libabigail-part-1/ |
| 59 | - https://developers.redhat.com/blog/2020/04/02/how-to-write-an-abi-compliance-checker-using-libabigail/ |