diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2012-12-29 00:49:33 -0500 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2012-12-29 00:57:29 -0500 |
commit | af46317f2601e6196820732b8e2232315a8f59d9 (patch) | |
tree | 3aa72e1b018fa6a5db77b54b9949d1c26d7626c4 /tests | |
parent | tests/revdeppaxtest/revdeptest.sh: update to work with new revdep-pax (diff) | |
download | elfix-af46317f2601e6196820732b8e2232315a8f59d9.tar.gz elfix-af46317f2601e6196820732b8e2232315a8f59d9.tar.bz2 elfix-af46317f2601e6196820732b8e2232315a8f59d9.zip |
tests/*: pretify the code and output
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/gnustack/gnustacktest.sh | 36 | ||||
-rwxr-xr-x | tests/paxmodule/paxmodtest.sh | 60 | ||||
-rwxr-xr-x | tests/pxtpax/daemontest.sh | 31 | ||||
-rwxr-xr-x | tests/pxtpax/init.sh | 68 | ||||
-rwxr-xr-x | tests/revdeppaxtest/revdeptest.sh | 192 |
5 files changed, 202 insertions, 185 deletions
diff --git a/tests/gnustack/gnustacktest.sh b/tests/gnustack/gnustacktest.sh index 8a4c6e7..84d8b69 100755 --- a/tests/gnustack/gnustacktest.sh +++ b/tests/gnustack/gnustacktest.sh @@ -1,20 +1,20 @@ #!/bin/bash # -# gnustacktest.sh: this file is part of the elfix package -# Copyright (C) 2011 Anthony G. Basile +# gnustacktest.sh: this file is part of the elfix package +# Copyright (C) 2011, 2012 Anthony G. Basile # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. # verbose=${1-0} @@ -28,15 +28,15 @@ after=$(../../src/fix-gnustack bad-gnustack) after=$(echo ${after} | awk '{ print $2 }') rm bad-gnustack if [ "${verbose}" != 0 ]; then - echo " BEFRE=${before}" - echo " AFTER=${after}" + echo " BEFRE=${before}" + echo " AFTER=${after}" fi if [ "${before}" = "RWX" -a "${after}" = "RW" ]; then - echo " OK" - ret=0 + echo " OK" + ret=0 else - echo " NOT OKAY" - ret=1 + echo " NOT OKAY" + ret=1 fi echo echo "================================================================================" diff --git a/tests/paxmodule/paxmodtest.sh b/tests/paxmodule/paxmodtest.sh index 9398f29..fb0b280 100755 --- a/tests/paxmodule/paxmodtest.sh +++ b/tests/paxmodule/paxmodtest.sh @@ -1,20 +1,20 @@ #!/bin/bash # -# paxmodtest.sh: this file is part of the elfix package -# Copyright (C) 2011 Anthony G. Basile +# paxmodtest.sh: this file is part of the elfix package +# Copyright (C) 2011, 2012 Anthony G. Basile # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. # echo "================================================================================" @@ -36,19 +36,19 @@ pythonversion=${pythonversion%\.*} PYTHONPATH="../../scripts/build/lib.linux-${unamem}-${pythonversion}" if [ ! -d ${PYTHONPATH} ]; then - echo " (Re)building pax module" - - #NOTE: the last -D or -U wins as it does for gcc $CFLAGS - for f in $@; do - [ $f = "-UXTPAX" ] && unset XTPAX - [ $f = "-DXTPAX" ] && XTPAX=1 - [ $f = "-UPTPAX" ] && unset PTPAX - [ $f = "-DPTPAX" ] && PTPAX=1 - done - export XTPAX - export PTPAX - - ( cd ../../scripts; exec ./setup.py build ) >/dev/null + echo " (Re)building pax module" + + #NOTE: the last -D or -U wins as it does for gcc $CFLAGS + for f in $@; do + [ $f = "-UXTPAX" ] && unset XTPAX + [ $f = "-DXTPAX" ] && XTPAX=1 + [ $f = "-UPTPAX" ] && unset PTPAX + [ $f = "-DPTPAX" ] && PTPAX=1 + done + export XTPAX + export PTPAX + + ( cd ../../scripts; exec ./setup.py build ) >/dev/null fi count=0 @@ -82,6 +82,8 @@ for pf in "p" "P" "-"; do if [ "${verbose}" != 0 ] ;then echo + else + echo -n "." fi done @@ -90,6 +92,8 @@ for pf in "p" "P" "-"; do done done +echo + for pf in "p" "P" "-"; do for ef in "e" "E" "-"; do for mf in "m" "M" "-"; do @@ -120,6 +124,8 @@ for pf in "p" "P" "-"; do if [ "${verbose}" != 0 ] ;then echo + else + echo -n "." fi done @@ -128,6 +134,10 @@ for pf in "p" "P" "-"; do done done +if [ "${verbose}" = 0 ] ;then + echo + echo +fi echo " Mismatches = ${count}" echo echo "================================================================================" diff --git a/tests/pxtpax/daemontest.sh b/tests/pxtpax/daemontest.sh index 7e19038..66ec946 100755 --- a/tests/pxtpax/daemontest.sh +++ b/tests/pxtpax/daemontest.sh @@ -1,20 +1,20 @@ #!/bin/bash # -# daemontest.sh: this file is part of the elfix package -# Copyright (C) 2011 Anthony G. Basile +# daemontest.sh: this file is part of the elfix package +# Copyright (C) 2011, 2012 Anthony G. Basile # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. # # dotest = 0 -> do only XATTR_PAX or PT_PAX test @@ -119,8 +119,11 @@ for pf in "p" "P" "-"; do fi fi done + if [ "${verbose}" != 0 ] ;then echo + else + echo -n "." fi done @@ -129,6 +132,10 @@ for pf in "p" "P" "-"; do done done +if [ "${verbose}" = 0 ] ;then + echo + echo +fi echo " Mismatches = ${count}" echo echo "================================================================================" diff --git a/tests/pxtpax/init.sh b/tests/pxtpax/init.sh index 3d41305..85f66ba 100755 --- a/tests/pxtpax/init.sh +++ b/tests/pxtpax/init.sh @@ -1,20 +1,20 @@ #!/bin/bash # -# init.sh: this file is part of the elfix package -# Copyright (C) 2011 Anthony G. Basile +# init.sh: this file is part of the elfix package +# Copyright (C) 2011, 2012 Anthony G. Basile # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. # PATH=/sbin:/bin @@ -25,33 +25,33 @@ PIDFILE="${PWD}"/daemon.pid start() { - rm -f ${PIDFILE} - if [ -e ${DAEMON} ] - then - PID=$(${DAEMON}) - if [ "x${PID}" != "x" ] - then - echo $PID >> ${PIDFILE} - fi - else - echo "No daemon" - fi + rm -f ${PIDFILE} + if [ -e ${DAEMON} ] + then + PID=$(${DAEMON}) + if [ "x${PID}" != "x" ] + then + echo $PID >> ${PIDFILE} + fi + else + echo "No daemon" + fi } stop() { - kill $(cat ${PIDFILE}) - rm -f ${PIDFILE} + kill $(cat ${PIDFILE}) + rm -f ${PIDFILE} } case "$1" in - start) - start - ;; - stop) - stop - ;; - *) - echo "Usage: $0 start | stop" - ;; + start) + start + ;; + stop) + stop + ;; + *) + echo "Usage: $0 start | stop" + ;; esac diff --git a/tests/revdeppaxtest/revdeptest.sh b/tests/revdeppaxtest/revdeptest.sh index 6512959..84e67b6 100755 --- a/tests/revdeppaxtest/revdeptest.sh +++ b/tests/revdeppaxtest/revdeptest.sh @@ -1,20 +1,20 @@ #!/bin/bash # -# revdeptest.sh: this file is part of the elfix package -# Copyright (C) 2011 Anthony G. Basile +# revdeptest.sh: this file is part of the elfix package +# Copyright (C) 2011 Anthony G. Basile # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. # echo "================================================================================" @@ -27,10 +27,10 @@ shift ID=$(id -u) if [ "$ID" != 0 ]; then - echo " MUST BE ROOT" - echo - echo "================================================================================" - exit 1 + echo " MUST BE ROOT" + echo + echo "================================================================================" + exit 1 fi PAXCTLNG="../../src/paxctl-ng" @@ -58,7 +58,7 @@ XYZ;${LIBSPATH}/${LIBRARY};${SONAME};; EOF if [ "${verbose}" = 0 ] ;then - echo -n " " + echo -n " " fi unamem=$(uname -m) @@ -70,89 +70,89 @@ PYTHONPATH="../../scripts/build/lib.linux-${unamem}-${pythonversion}" # Assume the pax.so module is built if the path exists # otherwise build it ourselves! if [ ! -d ${PYTHONPATH} ]; then - echo " (Re)building pax module" - - #NOTE: the last -D or -U wins as it does for gcc $CFLAGS - for f in $@; do - [ $f = "-UXTPAX" ] && unset XTPAX - [ $f = "-DXTPAX" ] && XTPAX=1 - [ $f = "-UPTPAX" ] && unset PTPAX - [ $f = "-DPTPAX" ] && PTPAX=1 - done - export XTPAX - export PTPAX - - ( cd ../../scripts; exec ./setup.py build ) >/dev/null + echo " (Re)building pax module" + + #NOTE: the last -D or -U wins as it does for gcc $CFLAGS + for f in $@; do + [ $f = "-UXTPAX" ] && unset XTPAX + [ $f = "-DXTPAX" ] && XTPAX=1 + [ $f = "-UPTPAX" ] && unset PTPAX + [ $f = "-DPTPAX" ] && PTPAX=1 + done + export XTPAX + export PTPAX + + ( cd ../../scripts; exec ./setup.py build ) >/dev/null fi count=0 for bf in "R" "r" "Rr" do - for lf in "R" "r" "Rr" - do - $PAXCTLNG -z "${LIBSPATH}/${BINARY}" - $PAXCTLNG -e${bf} "${LIBSPATH}/${BINARY}" - $PAXCTLNG -z "${LIBSPATH}/${LIBRARY}" - $PAXCTLNG -m${lf} "${LIBSPATH}/${LIBRARY}" - - p=$($PAXCTLNG -v ${LIBSPATH}/${BINARY}) - p=$(echo $p | awk '{ print $4 }') - if [ "${verbose}" != 0 ] ;then - echo " BEFORE: " - echo " Binary: $p" - fi - - p=$($PAXCTLNG -v ${LIBSPATH}/${LIBRARY}) - p=$(echo $p | awk '{ print $4 }') - if [ "${verbose}" != 0 ] ;then - echo " Library: $p" - fi - - $REVDEPPAX -m -y -s ${SONAME} >/dev/null 2>&1 - - ba=$($PAXCTLNG -v ${LIBSPATH}/${BINARY}) - ba=$(echo $ba | awk '{ print $4 }') - if [ "${verbose}" != 0 ] ;then - echo " AFTER: " - echo " Binary: $ba" - fi - - p=$($PAXCTLNG -v ${LIBSPATH}/${LIBRARY}) - p=$(echo $p | awk '{ print $4 }') - if [ "${verbose}" != 0 ] ;then - echo " Library: $p" - fi - - be="-em" - unset x - - if [ "$bf" != "$lf" -a "$bf" != "Rr" ]; then - x="$bf" - elif [ "$bf" = "$lf" ]; then - x="$bf" - elif [ "$lf" = "Rr" ]; then - x="$bf" - elif [ "$bf" = "Rr" ]; then - x="$lf" - fi - - be+="${x/Rr/-}-" - - if [ "$be" != "$ba" ]; then - (( count = count + 1 )) - if [ "${verbose}" != 0 ] ;then - echo " Mismatch: Expected Binary: ${be}" - fi - fi - - if [ "${verbose}" != 0 ] ;then - echo - echo - else - echo -n "." - fi - done + for lf in "R" "r" "Rr" + do + $PAXCTLNG -z "${LIBSPATH}/${BINARY}" + $PAXCTLNG -e${bf} "${LIBSPATH}/${BINARY}" + $PAXCTLNG -z "${LIBSPATH}/${LIBRARY}" + $PAXCTLNG -m${lf} "${LIBSPATH}/${LIBRARY}" + + p=$($PAXCTLNG -v ${LIBSPATH}/${BINARY}) + p=$(echo $p | awk '{ print $4 }') + if [ "${verbose}" != 0 ] ;then + echo " BEFORE: " + echo " Binary: $p" + fi + + p=$($PAXCTLNG -v ${LIBSPATH}/${LIBRARY}) + p=$(echo $p | awk '{ print $4 }') + if [ "${verbose}" != 0 ] ;then + echo " Library: $p" + fi + + $REVDEPPAX -m -y -s ${SONAME} >/dev/null 2>&1 + + ba=$($PAXCTLNG -v ${LIBSPATH}/${BINARY}) + ba=$(echo $ba | awk '{ print $4 }') + if [ "${verbose}" != 0 ] ;then + echo " AFTER: " + echo " Binary: $ba" + fi + + p=$($PAXCTLNG -v ${LIBSPATH}/${LIBRARY}) + p=$(echo $p | awk '{ print $4 }') + if [ "${verbose}" != 0 ] ;then + echo " Library: $p" + fi + + be="-em" + unset x + + if [ "$bf" != "$lf" -a "$bf" != "Rr" ]; then + x="$bf" + elif [ "$bf" = "$lf" ]; then + x="$bf" + elif [ "$lf" = "Rr" ]; then + x="$bf" + elif [ "$bf" = "Rr" ]; then + x="$lf" + fi + + be+="${x/Rr/-}-" + + if [ "$be" != "$ba" ]; then + (( count = count + 1 )) + if [ "${verbose}" != 0 ] ;then + echo " Mismatch: Expected Binary: ${be}" + fi + fi + + if [ "${verbose}" != 0 ] ;then + echo + echo + else + echo -n "." + fi + done done # # do test here @@ -164,8 +164,8 @@ ${RMDIR} ${VARDBPKG}/${CAT}/${PKG} ${RMDIR} ${VARDBPKG}/${CAT} if [ "${verbose}" = 0 ] ;then - echo - echo + echo + echo fi echo " Mismatches = ${count}" echo |