mirror of
https://salsa.debian.org/ha-team/libqb
synced 2025-08-26 05:57:31 +00:00

* doc: qbarray.h: fix garbled Doxygen markup * build: follow-up for and fine-tuning of a rushed6d62b64
commit (It made a service as-was, but being afforded more time, this would have accompanied that commit right away, for better understanding, brevity and uniformity.) * build: prune superfluous Makefile declarations within tests directory There was a significant redundancy wrt. build flags and EXTRA_DIST assignment (the latter become redundant as off6e4042
at latest) spread all over the place (vivat copy&paste). Also, in one instance, CPPFLAGS (used) was confused with CFLAGS (meant). * maint: check abi: fix two issues with abi-compliance-checker/libstdc++ 1. ABICC >= 2 needs to be passed -cxx-incompatible switch because C is no longer a default for this tool (used to be vice versa), plus current version will stop choking on C vs. C++ (our C code with C++ compatibility wrapping being viewed from C++ perspective for the purpose of dumping the declared symbols, which somewhat conflicts with internal masking of the C++ keywords being used as valid C identifiers [yet some instances must not be masked here, see https://github.com/lvc/abi-compliance-checker/issues/64) only if _also_ something like this is applied: https://github.com/lvc/abi-compliance-checker/pull/70 2. since20246f5
, libqb.so no longer poses a symlink to the actual version-qualified shared library, but rather a standalone linker script, which confuses ABICC, so blacklist that file for the scanning purposes explicitly, together with referring to the library through it's basic version qualification (which alone, sadly, is not sufficient as ABICC proceeds to scan whole containing directory despite particular file is specified) * maint: check abi: switch to abi-dumper for creating "ABI dumps" Beside avoiding issues with abi-compliance-checker in the role of ABI dumps producer (see the preceding commit), it also seems to generate more accurate picture (maybe because it expressly requires compiling with debugging information requested). * Low: qblist.h: fix incompatibility with C++ & check it regularly * tests: check_list.c: start zeroing in on the gaps in tests' coverage * tests: print_ver: make preprocessor emit "note" rather than warning IIRC, Chrissie asked about this around inclusion of the test at hand, and it seemed there was no way but to emit a warning to get something output at all. Now it turns wrong, and moreover, we make the code not fixed on GCC specific pragmas, with a bit of luck, "#pragma message" approach is adopted more widely by compilers. Signed-off-by: Jan Pokorný <jpokorny@redhat.com> * Replace ck_assert_uint_eq() with ck_assert_int_eq() it's not available in check 0.9 * Proper check for C++ compiler (from Fabio) * add (c) to copyright dates
359 lines
7.4 KiB
Bash
Executable File
359 lines
7.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
export CFLAGS="$CFLAGS"
|
|
export MAKEFLAGS="$MAKEFLAGS --no-print-directory"
|
|
export BROWSER="firefox"
|
|
|
|
help_all() {
|
|
echo
|
|
echo "Usage: check <command>"
|
|
echo
|
|
echo "Commands:"
|
|
echo
|
|
echo " ansi Check using ansi compiler option"
|
|
echo " sysv Check using sys-v semaphores"
|
|
echo " nosection Check without gcc __attribute__(section)"
|
|
echo " noepoll Check using poll (not epoll)"
|
|
echo " nogettime Check without gettime()"
|
|
echo " bsd Check with a bsd-like config"
|
|
echo " mac Check with a mac/darwin-like config"
|
|
echo " dist do make distcheck"
|
|
echo " rpm Run rpmlint"
|
|
echo " mock Test doing a mock build"
|
|
echo " coverity Run coverity"
|
|
echo " clang Run clang-analyze"
|
|
echo " abi Check abi compatibility"
|
|
echo " api_sanity api sanity test"
|
|
echo
|
|
echo " help This help"
|
|
echo
|
|
exit 1
|
|
}
|
|
|
|
if [ $# -lt 1 ]
|
|
then
|
|
help_all
|
|
fi
|
|
|
|
command=$1
|
|
shift
|
|
args="$@"
|
|
|
|
if [ -n "$(git rev-parse)" ] ; then
|
|
perror "Must be inside a git repository to work"
|
|
exit 1
|
|
fi
|
|
|
|
up=$(git rev-parse --show-cdup)
|
|
if [ "x$up" == "x" ] ; then
|
|
up="."
|
|
fi
|
|
cd $up
|
|
|
|
set -e
|
|
if [ ! -e build-aux/install-sh ]
|
|
then
|
|
./autogen.sh
|
|
fi
|
|
if [ ! -e Makefile ]
|
|
then
|
|
./configure --quiet
|
|
fi
|
|
|
|
check() {
|
|
options="$1 --enable-debug --enable-slow-tests --enable-fatal-warnings --quiet"
|
|
echo "./configure $options"
|
|
echo "ENV CFLAGS=\"$CFLAGS\""
|
|
echo "ENV MAKEFLAGS=\"$MAKEFLAGS\""
|
|
( ./configure $options )
|
|
make check
|
|
if [ $? -ne 0 ]
|
|
then
|
|
echo "======================"
|
|
echo failed: $1
|
|
echo "======================"
|
|
if [ -f tests/test-suite.log ]
|
|
then
|
|
cat tests/test-suite.log
|
|
fi
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
check_ansi() {
|
|
echo "checking ansi"
|
|
echo "==============="
|
|
check "--enable-ansi"
|
|
}
|
|
|
|
check_nosection() {
|
|
echo "checking nosection"
|
|
echo "======================="
|
|
# no __attribute__((section))
|
|
# NOTE: alternatively CPPFLAGS=-DQB_KILL_ATTRIBUTE_SECTION, but
|
|
# that won't shortcut many initial/configure decisions
|
|
check "ac_cv_link_attribute_section=no"
|
|
}
|
|
|
|
check_sysv() {
|
|
# use sys-v semaphores
|
|
echo "checking sysv"
|
|
echo "======================="
|
|
ORIG_CFLAGS=$CFLAGS
|
|
export CFLAGS="$CFLAGS -DDISABLE_POSIX_THREAD_PROCESS_SHARED"
|
|
check
|
|
export CFLAGS=$ORIG_CFLAGS
|
|
}
|
|
|
|
check_nogettime() {
|
|
# no clock_gettime
|
|
echo "checking nogettime"
|
|
echo "======================="
|
|
check "ac_cv_func_clock_gettime=no"
|
|
}
|
|
|
|
check_noepoll() {
|
|
# no epoll
|
|
echo "checking noepoll"
|
|
echo "======================="
|
|
check "ac_cv_func_epoll_create1=no ac_cv_func_epoll_create=no"
|
|
}
|
|
|
|
check_bsd() {
|
|
# bsd-like
|
|
echo "checking bsd"
|
|
echo "======================="
|
|
ORIG_CFLAGS=$CFLAGS
|
|
check "ac_cv_func_sem_timedwait=no ac_cv_func_clock_gettime=no ac_cv_func_epoll_create1=no ac_cv_func_epoll_create=no"
|
|
export CFLAGS=$ORIG_CFLAGS
|
|
}
|
|
|
|
check_mac() {
|
|
# mac-like
|
|
echo "checking mac"
|
|
echo "======================="
|
|
ORIG_CFLAGS=$CFLAGS
|
|
export CFLAGS="$CFLAGS -DDISABLE_POSIX_THREAD_PROCESS_SHARED"
|
|
check "ac_cv_func_clock_gettime=no ac_cv_func_epoll_create1=no ac_cv_func_epoll_create=no ac_cv_link_attribute_section=no"
|
|
export CFLAGS=$ORIG_CFLAGS
|
|
}
|
|
|
|
check_dist() {
|
|
# normal configure with distcheck
|
|
echo "checking dist"
|
|
echo "======================"
|
|
set +e
|
|
./configure --quiet
|
|
make distcheck
|
|
set -e
|
|
}
|
|
|
|
check_rpm() {
|
|
echo "checking rpm building"
|
|
echo "======================"
|
|
set +e
|
|
make maintainer-clean
|
|
./autogen.sh
|
|
./configure --quiet
|
|
make rpm
|
|
echo
|
|
sudo rpm -Uvf --force libqb-*.rpm
|
|
echo rpmlint libqb
|
|
rpmlint libqb
|
|
echo rpmlint libqb-debuginfo
|
|
rpmlint libqb-debuginfo
|
|
echo rpmlint libqb-devel
|
|
rpmlint libqb-devel
|
|
set -e
|
|
}
|
|
|
|
|
|
check_mock() {
|
|
echo "checking mock building"
|
|
echo "======================"
|
|
set +e
|
|
make maintainer-clean
|
|
rm -f *.rpm
|
|
./autogen.sh
|
|
./configure --quiet
|
|
make srpm
|
|
mock --no-clean --rebuild *.src.rpm
|
|
}
|
|
|
|
check_coverity() {
|
|
echo "checking coverity"
|
|
echo "======================"
|
|
make clean
|
|
cov-build --dir=cov make
|
|
cov-analyze --dir cov \
|
|
--concurrency \
|
|
--all \
|
|
--aggressiveness-level high \
|
|
--security \
|
|
--wait-for-license
|
|
cov-format-errors --dir cov
|
|
}
|
|
|
|
check_clang() {
|
|
if [ ! -f /usr/libexec/clang-analyzer/scan-build/ccc-analyzer ]
|
|
then
|
|
echo try installing clang-analyze
|
|
exit 1
|
|
fi
|
|
echo "checking clang"
|
|
echo "===================="
|
|
make clean
|
|
|
|
./configure \
|
|
CC=/usr/libexec/clang-analyzer/scan-build/ccc-analyzer \
|
|
CXX=/usr/libexec/clang-analyzer/scan-build/c++-analyzer
|
|
make check
|
|
}
|
|
|
|
check_abi() {
|
|
# XXX abi-compliance-checker >= 2 will likely require equivalent of
|
|
# https://github.com/lvc/abi-compliance-checker/pull/70
|
|
ver1=$1
|
|
ver2=$2
|
|
if [ -z "$ver1" ] ; then
|
|
echo need two versions.
|
|
exit 1
|
|
fi
|
|
if [ -z "$ver2" ] ; then
|
|
echo need two versions.
|
|
exit 1
|
|
fi
|
|
|
|
TMPL=build-aux/abi-check-templ.xml
|
|
checker=abi-compliance-checker
|
|
if abi-compliance-checker -info | grep -Fqe '-cxx-incompatible'; then
|
|
checker="${checker} -cxx-incompatible"
|
|
fi
|
|
|
|
mkdir -p abi_dumps/libqb
|
|
# ABICC only: current script always accompanied with current template
|
|
#for v in $ver1 $ver2; do cp "${TMPL}" "abi_dumps/libqb/${v}.tmpl"; done
|
|
|
|
for v in $ver1 $ver2
|
|
do
|
|
p=$(pwd)_inst_${v}
|
|
t=v${v}
|
|
echo "== Version ${v} =="
|
|
if [ ! -f "abi_dumps/libqb/libqb_${v}.abi.tar.gz" ]
|
|
then
|
|
git checkout "${t}"
|
|
./autogen.sh
|
|
# XXX still complains about missing -Og (-O0 is used)
|
|
./configure --enable-debug
|
|
make
|
|
make install DESTDIR="${p}"
|
|
lib_suffix=$(cut -c 1-32 "${p}/usr/lib64/libqb.so" \
|
|
| sed -n 's/^INPUT(libqb\.so\([^)]*\).*$/\1/p;q')
|
|
# this is currently recommended way of using abi-dumper
|
|
# instead of relying on internal processing with ABICC
|
|
# itself (still kept around for reference below)
|
|
abi-dumper -loud -debug "${p}/usr/lib64/libqb.so${lib_suffix}" \
|
|
-vnum "${v}" -o "abi_dumps/libqb/libqb_${v}.abi.tar.gz"
|
|
|
|
# former approach of relying solely on ABICC (XXX -lang C)
|
|
#skiplib_cmt=
|
|
#[ -n "${lib_suffix}" ] || skiplib_cmt='#'
|
|
#sed -e "s|@PREFIX@|${p}|" \
|
|
# -e "s|@VERSION@|${v}|" \
|
|
# -e "s|@SKIPLIB_CMT@|${skiplib_cmt}|" \
|
|
# -e "s|@LIB_SUFFIX@|${lib_suffix}|" \
|
|
# "abi_dumps/libqb/${v}.tmpl" > "abi_dumps/libqb/${v}.xml"
|
|
#rm -f "abi_dumps/libqb/${v}.tmpl"
|
|
#${checker} -l libqb -dump_abi "abi_dumps/libqb/${v}.xml" \
|
|
# -dump-path "abi_dumps/libqb/libqb_${v}.abi.tar.gz"
|
|
fi
|
|
done
|
|
|
|
# Don't exit if there were incompatible ABI changes.
|
|
set +e
|
|
$checker -l libqb \
|
|
-d1 abi_dumps/libqb/libqb_$ver1.abi.tar.gz \
|
|
-d2 abi_dumps/libqb/libqb_$ver2.abi.tar.gz
|
|
set -e
|
|
|
|
$BROWSER file://`pwd`/compat_reports/libqb/$ver1\_to_$ver2/compat_report.html
|
|
|
|
git checkout master
|
|
}
|
|
|
|
check_api_sanity() {
|
|
make
|
|
export CFLAGS="-Wall -ggdb2"
|
|
api-sanity-checker -l libqb -d build-aux/api-auto-test.xml -gen -build -run
|
|
$BROWSER file://`pwd`/test_results/libqb/master/test_results.html
|
|
$BROWSER file://`pwd`/test_results/libqb/master/test_results.html
|
|
}
|
|
|
|
check_all() {
|
|
check_ansi
|
|
check_nosection
|
|
check_sysv
|
|
check_noepoll
|
|
check_nogettime
|
|
check_bsd
|
|
check_dist
|
|
check_rpm
|
|
}
|
|
|
|
|
|
case $command in
|
|
help)
|
|
help_all $args
|
|
;;
|
|
ansi)
|
|
check_ansi
|
|
;;
|
|
nosection)
|
|
check_nosection
|
|
;;
|
|
sysv)
|
|
check_sysv
|
|
;;
|
|
noepoll)
|
|
check_noepoll
|
|
;;
|
|
nogettime)
|
|
check_nogettime
|
|
;;
|
|
bsd)
|
|
check_bsd
|
|
;;
|
|
mac)
|
|
check_mac
|
|
;;
|
|
rpm)
|
|
check_rpm
|
|
;;
|
|
mock)
|
|
check_mock
|
|
;;
|
|
dist)
|
|
check_dist
|
|
;;
|
|
coverity)
|
|
check_coverity
|
|
;;
|
|
clang)
|
|
check_clang
|
|
;;
|
|
abi)
|
|
check_abi $args
|
|
;;
|
|
api_sanity)
|
|
check_api_sanity
|
|
;;
|
|
all)
|
|
check_all
|
|
;;
|
|
*)
|
|
help_all
|
|
;;
|
|
esac
|
|
cd -
|
|
exit 0
|