From e77d5e88a3f01d631eb69801b2be8f9fd43db3b2 Mon Sep 17 00:00:00 2001 From: Davide Madrisan Date: Wed, 18 Jan 2012 00:09:22 +0100 Subject: [PATCH] test01_pkgquality: avoid use of pipes Signed-off-by: Davide Madrisan --- ChangeLog | 4 ++++ tests/test01_pkgquality.in | 34 +++++++++++++++++----------------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4f9237b..9c1dcf4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -65,6 +65,10 @@ Sun Jan 15 2012 Davide Madrisan * pck-update - Davide Madrisan: Print the list of packages before running the tests. ++ bugfix + * tests/test01_pkgquality - Davide Madrisan: + Avoid pipes otherwise the error counter will not display a correct value. + -------------------------------------------------------------------------------- Changes in version 1.8.2 diff --git a/tests/test01_pkgquality.in b/tests/test01_pkgquality.in index b9b1734..3c78c97 100644 --- a/tests/test01_pkgquality.in +++ b/tests/test01_pkgquality.in @@ -116,18 +116,18 @@ wrong symlink"": \`${NOTE}${f/./}${NORM}' --> \`${NOTE}$(readlink $f)${NORM}'" let "i = 0" for pck in ${rpmpkg_name[@]}; do - find $tmpextractdir/$i -type f \ - -exec grep -ls "$SPEC_BUILDROOT" {} \; | \ - while read filename; do + pushd $tmpextractdir/$i >/dev/null + for f in $(find -type f \ + -exec grep -ls "$SPEC_BUILDROOT" {} \;2>/dev/null); do notify.warning "${NOTE}${pck##*/}${NORM}" notify.note "\ - ${NOTE}$(\ -echo $filename | sed "s,$tmpextractdir/$i,," )${NORM}" + ${NOTE}$(echo $f | sed "s,$tmpextractdir/$i,," )${NORM}" notify.note "$(\ -strings -a $filename | grep "^$SPEC_BUILDROOT" | sort -bu | \ +strings -a $f | grep "^$SPEC_BUILDROOT" | sort -bu | \ sed "s,$SPEC_BUILDROOT\(.*\), - [%buildroot]\1,")" let "total_issues += 1" done + popd >/dev/null let "i += 1" done fi @@ -142,18 +142,18 @@ sed "s,$SPEC_BUILDROOT\(.*\), - [%buildroot]\1,")" let "i = 0" for pck in ${rpmpkg_name[@]}; do - find $tmpextractdir/$i -type f \ - -exec grep -ls "$BUILDDIR" {} \; | \ - while read filename; do - notify.warning "${NOTE}${pck##*/}${NORM}" - notify.note "\ - ${NOTE}$(\ -echo $filename | sed "s,$tmpextractdir/$i,," )${NORM}" - notify.note "$(\ -strings -a $filename | grep "$BUILDDIR" | sort -bu | \ + pushd $tmpextractdir/$i >/dev/null + for f in $(find -type f \ + -exec grep -ls "$BUILDDIR" {} \; 2>/dev/null); do + notify.warning "${NOTE}${pck##*/}${NORM}" + notify.note "\ + ${NOTE}$(echo $f | sed "s,$tmpextractdir/$i,," )${NORM}" + notify.note "$(\ +strings -a $f | grep "$BUILDDIR" | sort -bu | \ sed "s,$BUILDDIR,[%_builddir],g;s,.*, - &,")" - let "total_issues += 1" - done + let "total_issues += 1" + done + popd >/dev/null let "i += 1" done