From 3bfb6ae84eec473db0408eb2c558f68fe07bbf9d Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Fri, 15 Sep 2023 18:14:44 -0300 Subject: [PATCH] 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). --- abi/main.fmf | 22 ++++++++++++++++++++++ abi/test.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ build-gating.fmf | 2 +- 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 abi/main.fmf create mode 100755 abi/test.sh diff --git a/abi/main.fmf b/abi/main.fmf new file mode 100644 index 0000000..832e0d7 --- /dev/null +++ b/abi/main.fmf @@ -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 diff --git a/abi/test.sh b/abi/test.sh new file mode 100755 index 0000000..e569f50 --- /dev/null +++ b/abi/test.sh @@ -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 diff --git a/build-gating.fmf b/build-gating.fmf index 59192a1..030c4bf 100644 --- a/build-gating.fmf +++ b/build-gating.fmf @@ -64,4 +64,4 @@ execute: how: tmt provision: hardware: - memory: ">= 4 GiB" + memory: ">= 8 GiB"