Add a test to validate libclang's ABI compatibility on Fedora

This test uses abi-compliance-checker in order to compare the ABI of the
current libclang.so with previous versions that are stored in a separate
git-lfs repository.

This new test may take as long as 20 minutes to complete and consumes
far more RAM than previous tests (up to 8 GiB).
This commit is contained in:
Tulio Magno Quites Machado Filho 2023-09-15 18:14:44 -03:00
commit 3bfb6ae84e
3 changed files with 66 additions and 1 deletions

22
abi/main.fmf Normal file
View file

@ -0,0 +1,22 @@
summary: Test ABI compatibility.
test: ./test.sh
framework: shell
tier: 1
component:
- llvm-toolset
- clang
require:
- abi-compliance-checker
- binutils
- gzip
- clang-devel
- clang-libs
- clang-libs-debuginfo
- wget
- xz
duration: 40m
adjust:
# TODO: Test on rhel before enabling it
- enabled: false
when: distro == rhel or distro == centos

43
abi/test.sh Executable file
View file

@ -0,0 +1,43 @@
#!/usr/bin/sh -ex
# Test the compatibility of the current libclang with specific versions that
# have been previously generated.
# The artifacts used as input in this test are maintained in this git-lfs
# repo: https://gitlab.com/tuliom-rh/llvm-fedora-el-abi
is_fedora=`rpm -E %{fedora}`
arch=`rpm -E %{_arch}`
case $(rpm -E %dist) in
.fc*) dist_prefix=fc;;
.el*) dist_prefix=el;;
*) echo "Error: which distro is this ($(rpm -E %dist))?" >&2
esac
# Download ABI dumps from previous versions.
wget -q https://gitlab.com/tuliom-rh/llvm-fedora-el-abi/-/archive/main/llvm-fedora-el-abi-main.tar.gz
tar xzf llvm-fedora-el-abi-main.tar.gz --strip-components=1 '*/libclang.*.abi.xz'
for f in *.abi.xz; do
unxz $f
done
abi_files=$(ls libclang*.$dist_prefix*.$arch.abi)
abi_file=libclang.$(rpm -q clang-libs | sed 's/~//g').abi
version=$(rpm -q --qf "%{V}-%{R}.%{ARCH}\n" clang-libs)
library=$(rpm -ql clang-libs | grep -E 'libclang\.so\..*' | sort | head -n 1)
debuginfo=$(rpm -ql clang-libs-debuginfo | grep -E 'libclang\.so.*\.debug')
# Create the ABI dump from the current version. This takes a long time.
abi-dumper -quiet -lver $version \
-skip-cxx \
-public-headers /usr/include/clang-c \
--search-debuginfo=/usr/lib/debug \
-o $abi_file $library
sed -i 's/LLVM_[0-9]\+/LLVM_NOVERSION/' $abi_file
for old_abi_file in $abi_files; do
abi-compliance-checker -l libclang.so -old $old_abi_file -new $abi_file
done

View file

@ -64,4 +64,4 @@ execute:
how: tmt
provision:
hardware:
memory: ">= 4 GiB"
memory: ">= 8 GiB"