From acdf5b2e7a9b3074125bc95bfcf7e6abdc9704b4 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Mon, 14 Mar 2022 21:39:29 -0400 Subject: Update process for ABI testing --- abi-perf-test | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100755 abi-perf-test (limited to 'abi-perf-test') diff --git a/abi-perf-test b/abi-perf-test new file mode 100755 index 00000000..8393e283 --- /dev/null +++ b/abi-perf-test @@ -0,0 +1,123 @@ +#!/usr/bin/env bash +set -eo pipefail +cd $(dirname $0) +whoami=$(basename $0) + +if [[ $(git status -s | egrep -v abi-perf-test | wc -l) != 0 ]]; then + echo 1>&2 "${whoami}: git is not clean. (abi-perf-test changes ignored)" + git status -s + exit 2 +fi + +old_rev=${1-bad} +new_rev=${2-bad} + +if [ "$new_rev" = "bad" ]; then + echo 1>&2 "Usage: $whoami old-rev new-rev" + exit 2 +fi + +old_rev_hash=$(git rev-parse $old_rev) +new_rev_hash=$(git rev-parse $new_rev) + +cat <&2 "$work exists and is not ours" + exit 2 + else + rm -rf $work + fi +fi +mkdir -p $work/{old,new} +touch $work/.abi + +source=$PWD +repo=file://$source/.git +cd $work +git clone $repo qpdf +cd qpdf + +git tag abi-old $old_rev_hash +git tag abi-new $new_rev_hash + +echo "** building old version **" + +git checkout abi-old +cmake -S . -B build \ + -DMAINTAINER_MODE=1 -DBUILD_STATIC_LIBS=0 -DBUILD_DOC=0 \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo +cmake --build build -j$(nproc) + +echo "** saving old library and size information **" + +$source/check_abi check-sizes --lib build/libqpdf/libqpdf.so +./build/qpdf/sizes >| $work/old/sizes +cp build/libqpdf/libqpdf.so.*.* $work/old + +if [ "$SKIP_PERF" != "1" ]; then + echo "** writing performance details for old revision to $work/perf **" + $source/performance_check --dir $source/../performance-test-files | \ + tee -a $work/perf +fi + +echo "** building new version's library and sizes **" + +git checkout abi-new +cmake -S . -B build \ + -DMAINTAINER_MODE=1 -DBUILD_STATIC_LIBS=0 -DBUILD_DOC=0 \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo +cmake --build build -j$(nproc) --target sizes + +echo "** saving new library and size information **" + +$source/check_abi check-sizes --lib build/libqpdf/libqpdf.so +./build/qpdf/sizes >| $work/new/sizes +cp build/libqpdf/libqpdf.so.*.* $work/new + +echo "** running ABI comparison **" + +$source/check_abi compare --old-lib $work/old/libqpdf.so.*.* \ + --new-lib build/libqpdf/libqpdf.so \ + --old-sizes $work/old/sizes --new-sizes $work/new/sizes + +if [ "$SKIP_TESTS" != "1" ]; then + # Switch back to the previous release and run tests. There may be + # some failures based on functionality change. We are looking for + # ABI breakage. + git checkout abi-old + set +e + (cd build; ctest --verbose) + if [ $? != 0 ]; then + cat <