From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 7589B1381F3 for ; Thu, 13 Dec 2012 04:05:51 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 57ED421C007; Thu, 13 Dec 2012 04:05:41 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 4ED9521C002 for ; Thu, 13 Dec 2012 04:05:40 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5AF8533CEF2 for ; Thu, 13 Dec 2012 04:05:38 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id B0EA1E543C for ; Thu, 13 Dec 2012 04:05:34 +0000 (UTC) From: "Anthony G. Basile" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Anthony G. Basile" Message-ID: <1355371509.845ef1babaea9aa26aec68cb162b2693f79bbe5f.blueness@gentoo> Subject: [gentoo-commits] proj/elfix:master commit in: /, tests/gnustack/, tests/pxtpax/ X-VCS-Repository: proj/elfix X-VCS-Files: configure.ac tests/gnustack/Makefile.am tests/gnustack/gnustacktest.sh tests/pxtpax/Makefile.am tests/pxtpax/daemontest.sh tests/pxtpax/dotest.sh X-VCS-Directories: / tests/gnustack/ tests/pxtpax/ X-VCS-Committer: blueness X-VCS-Committer-Name: Anthony G. Basile X-VCS-Revision: 845ef1babaea9aa26aec68cb162b2693f79bbe5f X-VCS-Branch: master Date: Thu, 13 Dec 2012 04:05:34 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 4c8f274f-e711-48fd-b443-c7c0e3b06688 X-Archives-Hash: 8daf1dd6b428d340e6d00663d270f889 commit: 845ef1babaea9aa26aec68cb162b2693f79bbe5f Author: Anthony G. Basile gentoo org> AuthorDate: Thu Dec 13 04:04:40 2012 +0000 Commit: Anthony G. Basile gentoo org> CommitDate: Thu Dec 13 04:05:09 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=845ef1ba tests/{gnustack,pxtpax}: return success/failure, reduce vebosity --- configure.ac | 2 + tests/gnustack/Makefile.am | 16 ++----- tests/gnustack/gnustacktest.sh | 27 ++++++++++++ tests/pxtpax/Makefile.am | 11 ++++- tests/pxtpax/daemontest.sh | 89 ++++++++++++++++++++++++++++++++++++++++ tests/pxtpax/dotest.sh | 43 ------------------- 6 files changed, 130 insertions(+), 58 deletions(-) diff --git a/configure.ac b/configure.ac index 7c7e3f7..a06a23b 100644 --- a/configure.ac +++ b/configure.ac @@ -111,6 +111,8 @@ if [test "x$enable_ptpax" = "xno" -a "x$enable_xtpax" = "xno" ]; then AC_MSG_ERROR(["You must enable either ptpax or xtpax"]) fi +AM_CONDITIONAL([DUALTEST],[test "x$enable_ptpax" = "xyes" -a "x$enable_xtpax" = "xyes"]) + # Ready to configure our files AC_CONFIG_FILES([ Makefile diff --git a/tests/gnustack/Makefile.am b/tests/gnustack/Makefile.am index 6f5f569..783e956 100644 --- a/tests/gnustack/Makefile.am +++ b/tests/gnustack/Makefile.am @@ -7,18 +7,10 @@ bad-gnustack.s: bad-gnustack.c bad-gnustack: bad-gnustack.s $(CC) -o $@ $< -check_SCRIPTS = test.sh +check_SCRIPTS = gnustacktest TEST = $(check_SCRIPTS) -test.sh: - @echo "================================================================================" - @echo - @echo "Before GNU_STACK Elf: " - @../../src/fix-gnustack -f bad-gnustack - @echo - @echo "After GNU_STACK Elf: " - @../../src/fix-gnustack bad-gnustack - @echo - @echo "================================================================================" +gnustacktest: + ./gnustacktest.sh 0 -CLEANFILES = *.o *.s test.sh +CLEANFILES = *.o *.s diff --git a/tests/gnustack/gnustacktest.sh b/tests/gnustack/gnustacktest.sh new file mode 100755 index 0000000..518f4c5 --- /dev/null +++ b/tests/gnustack/gnustacktest.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +verbose=${1-0} + +echo "================================================================================" +echo +echo " RUNNING GNU_STACK TEST" +before=$(../../src/fix-gnustack -f bad-gnustack) +before=$(echo ${before} | awk '{ print $2 }') +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}" +fi +if [ "${before}" = "RWX" -a "${after}" = "RW" ]; then + echo " OK" + ret=0 +else + echo " NOT OKAY" + ret=1 +fi +echo +echo "================================================================================" + +exit $ret diff --git a/tests/pxtpax/Makefile.am b/tests/pxtpax/Makefile.am index 55f9957..1072252 100644 --- a/tests/pxtpax/Makefile.am +++ b/tests/pxtpax/Makefile.am @@ -3,10 +3,15 @@ daemon_SOURCES = daemon.c EXTRA_DIST = init.sh dotest.sh -check_SCRIPTS = test.sh +check_SCRIPTS = daemontest TEST = $(check_SCRIPTS) -test.sh: - ./dotest.sh +if DUALTEST +daemontest: + ./daemontest.sh 1 0 +else +daemontest: + ./daemontest.sh 0 0 +endif CLEANFILES = daemon.pid diff --git a/tests/pxtpax/daemontest.sh b/tests/pxtpax/daemontest.sh new file mode 100755 index 0000000..c5d079d --- /dev/null +++ b/tests/pxtpax/daemontest.sh @@ -0,0 +1,89 @@ +#!/bin/bash + +# dotest = 0 -> do only XT_PAX or PT_PAX test +# dotest = 1 -> do both +dotest=${1-0} +verbose=${2-0} + +PWD=$(pwd) +INITSH="${PWD}"/init.sh +DAEMON="${PWD}"/daemon +PIDFILE="${PWD}"/daemon.pid +PAXCTLNG="../../src/paxctl-ng" + +${PAXCTLNG} -cv ${DAEMON} 2>&1 1>/dev/null + +count=0 + +echo "================================================================================" +echo +echo " RUNNIG DAEMON TEST" + +for pf in "p" "P" "-"; do + for ef in "e" "E" "-"; do + for mf in "m" "M" "-"; do + for rf in "r" "R" "-"; do + for sf in "s" "S" "-"; do + + pflags="${pf}${ef}${mf}${rf}${sf}" + if [ "${verbose}" != 0 ] ;then + echo "SET TO :" ${pflags} + fi + + flags="${pf/-/Pp}${ef/-/Ee}${mf/-/Mm}${rf/-/Rr}${sf/-/Ss}" + ${PAXCTLNG} -"${flags}" ${DAEMON} >/dev/null 2>&1 + + if [ "${verbose}" != 0 ] ;then + sflags=$(${PAXCTLNG} -v ${DAEMON}) + if [ "${dotest}" = "0" ]; then + sflags=$(echo ${sflags} | awk '{print $3}') + echo "GOT :" ${sflags} + else + ptsflags=$(echo ${sflags} | awk '{print $3}') + xtsflags=$(echo ${sflags} | awk '{print $5}') + echo "PT_PAX :" ${ptsflags} + echo "XT_PAX :" ${xtsflags} + fi + fi + + ${INITSH} start + if [ -f "${PIDFILE}" ] + then + rflags=$(cat /proc/$(cat ${PIDFILE})/status | grep ^PaX | awk '{ print $2 }') + if [ "${verbose}" != 0 ] ;then + echo "RUNNING: "${rflags} + fi + ${INITSH} stop + else + if [ "${verbose}" != 0 ] ;then + echo "RUNNING: no daemon" + fi + rflags="-----" + fi + + # Skip i = 4 which is S which is not set + for i in 0 1 2 3; do + p=${pflags:$i:1} + r=${rflags:$i:1} + if [ $p != "-" ]; then + if [ $p != $r -a $r != "-" ]; then + (( count = count + 1 )) + echo "Mismatch: ${pflags} ${rflags}" + fi + fi + done + if [ "${verbose}" != 0 ] ;then + echo + fi + + done + done + done + done +done + +echo " Mismatches = ${count}" +echo +echo "================================================================================" + +exit $count diff --git a/tests/pxtpax/dotest.sh b/tests/pxtpax/dotest.sh deleted file mode 100755 index 4e7c371..0000000 --- a/tests/pxtpax/dotest.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -PWD=$(pwd) -INITSH="${PWD}"/init.sh -DAEMON="${PWD}"/daemon -PIDFILE="${PWD}"/daemon.pid -PAXCTLNG="../../src/paxctl-ng" - -${PAXCTLNG} -cv ${DAEMON} 2>&1 1>/dev/null - -for pf in "p" "P" "-"; do - for ef in "e" "E" "-"; do - for mf in "m" "M" "-"; do - for rf in "r" "R" "-"; do - for sf in "s" "S" "-"; do - - pflags="${pf}${ef}${mf}${rf}${sf}" - echo "SET TO :" ${pflags} - - flags="${pf/-/Pp}${ef/-/Ee}${mf/-/Mm}${rf/-/Rr}${sf/-/Ss}" - ${PAXCTLNG} -"${flags}" ${DAEMON} >/dev/null 2>&1 - - sflags=$(${PAXCTLNG} -v ${DAEMON}) - sflags=$(echo ${sflags} | awk '{print $3}') - echo "GOT :" ${sflags} - - ${INITSH} start - if [ -f "${PIDFILE}" ] - then - rflags=$(cat /proc/$(cat ${PIDFILE})/status | grep ^PaX | awk '{ print $2 }') - echo -n "RUNNING: "${rflags} - ${INITSH} stop - else - echo -n "RUNNING: no daemon" - fi - - echo - echo - done - done - done - done -done