tests/test01_pkgquality: check for libraries with undefined symbols after relocation

Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>
This commit is contained in:
Davide Madrisan 2012-05-08 22:50:53 +02:00
parent fc5e47711d
commit 1f2bd2cf03
3 changed files with 47 additions and 0 deletions

View File

@ -33,6 +33,10 @@ Changes in version 1.12.0
+ bugfix + bugfix
* templates/{library,standard,standard-daemon} - Davide Madrisan: * templates/{library,standard,standard-daemon} - Davide Madrisan:
Missing requirement: "Requires(preun): %{__install_info}" Missing requirement: "Requires(preun): %{__install_info}"
+ improvement
* tests/test01_pkgquality - Davide Madrisan:
New test: check for libraries with undefined symbols after relocation.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------

View File

@ -22,6 +22,9 @@ msgstr "questo script richiede bash versione 2 o superiore"
msgid "library not found" msgid "library not found"
msgstr "libreria non trovata" msgstr "libreria non trovata"
msgid "utility not found"
msgstr "programma non trovato"
msgid "performing quality checks" msgid "performing quality checks"
msgstr "esecuzione dei test di qualità" msgstr "esecuzione dei test di qualità"
@ -73,6 +76,9 @@ msgstr "file sospetto"
msgid "Hint" msgid "Hint"
msgstr "Suggerimento" msgstr "Suggerimento"
msgid "checking for libraries with undefined symbols after relocation"
msgstr "ricerca di librerie con simboli indefiniti dopo rilocazione"
msgid "checking for binary files installed in /etc (see FHS)" msgid "checking for binary files installed in /etc (see FHS)"
msgstr "ricerca di file binari installati in /etc (vedi FHS)" msgstr "ricerca di file binari installati in /etc (vedi FHS)"

View File

@ -17,6 +17,13 @@ if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then
fi fi
TEXTDOMAIN="test01_pkgquality"; export TEXTDOMAIN TEXTDOMAIN="test01_pkgquality"; export TEXTDOMAIN
# check if all the needed tools are available
for tool in cat chmod cpio date file find fold ftp getopt grep \
mktemp ldd objdump; do
[ "$(type -p $tool)" ] ||
notify.error $"utility not found"": \`$tool'"
done
function alltests() { function alltests() {
# FIXME: add to 'po' file # FIXME: add to 'po' file
notify.note " * ${NOTE}"$"performing quality checks""${NORM}""..." notify.note " * ${NOTE}"$"performing quality checks""${NORM}""..."
@ -217,6 +224,36 @@ ${NOTE}"$"Hint"":${NORM}
%attr(0755,root,root) %{_bindir}/<program> %attr(0755,root,root) %{_bindir}/<program>
-----------------------------" -----------------------------"
# check for libraries with undefined symbols
notify.note " * ${NOTE}"$"\
checking for libraries with undefined symbols after relocation""${NORM}..."
let "i = 0"
local undefsyms
for pck in ${rpmpkg_name[@]}; do
# skip debug packages
[[ "${pck##*/}" =~ -debug- ]] && { let "i += 1"; continue; }
pushd $tmpextractdir/$i >/dev/null
# find *.so.* files that are not symlinks to dynamic libraries
for f in `find -mindepth 1 -type f \
\( -name *\.so\.* -not -name *.debug \) -exec file {} \; | \
grep 'shared object' | sed -n 's/.\([^:]*\):.*/\1/p'`; do
undefsyms="\
$(LC_ALL=C ldd -d -r "$f" 2>/dev/null |& grep "undefined symbol")"
if [ "$undefsyms" ]; then
notify.warning "${NOTE}${pck##*/}${NORM}"
echo -n "${CRIT}"
LC_ALL=C ldd -d -r "$f" 2>/dev/null |& \
grep "undefined symbol" | sed "s,.*, - &,"
echo -n "${NORM}"
let "total_issues += 1"
fi
done
popd >/dev/null
let "i += 1"
done
# check for binary files in etc (see FHS-2.2) # check for binary files in etc (see FHS-2.2)
notify.note " * ${NOTE}"$"\ notify.note " * ${NOTE}"$"\
checking for binary files installed in /etc (see FHS)""${NORM}..." checking for binary files installed in /etc (see FHS)""${NORM}..."