From d71412e9c251577abb85d719ad351c3b433326a6 Mon Sep 17 00:00:00 2001 From: "Anthony G. Basile" Date: Mon, 20 May 2013 14:13:23 -0400 Subject: tests/{paxmodule,revdeppaxtest}: fix to work with all combinations of --{en,dis}able-{pt,xt}pax --- src/paxctl-ng.c | 8 +++---- tests/paxmodule/paxmodtest.sh | 49 +++++++++++++++++++++++++-------------- tests/revdeppaxtest/revdeptest.sh | 4 ++-- 3 files changed, 37 insertions(+), 24 deletions(-) diff --git a/src/paxctl-ng.c b/src/paxctl-ng.c index a451aac..4d69ab4 100644 --- a/src/paxctl-ng.c +++ b/src/paxctl-ng.c @@ -473,24 +473,24 @@ print_flags(int fd, int verbose) #ifdef PTPAX flags = get_pt_flags(fd, verbose); if( flags == UINT16_MAX ) - printf("\tPT_PAX : not found\n"); + printf("\tPT_PAX : not found\n"); else { memset(buf, 0, FLAGS_SIZE); bin2string4print(flags, buf); - printf("\tPT_PAX : %s\n", buf); + printf("\tPT_PAX : %s\n", buf); } #endif #ifdef XTPAX flags = get_xt_flags(fd); if( flags == UINT16_MAX ) - printf("\tXATTR_PAX: not found\n"); + printf("\tXATTR_PAX : not found\n"); else { memset(buf, 0, FLAGS_SIZE); bin2string4print(flags, buf); - printf("\tXATTR_PAX: %s\n", buf); + printf("\tXATTR_PAX : %s\n", buf); } #endif } diff --git a/tests/paxmodule/paxmodtest.sh b/tests/paxmodule/paxmodtest.sh index 8e831bf..dc99a38 100755 --- a/tests/paxmodule/paxmodtest.sh +++ b/tests/paxmodule/paxmodtest.sh @@ -37,21 +37,22 @@ export PYTHONPATH="$(pwd)/../../scripts/build/lib.linux-${unamem}-${pythonversio #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 + [[ $f = "-UXTPAX" ]] && unset XTPAX + [[ $f = "-DXTPAX" ]] && XTPAX=1 + [[ $f = "-UPTPAX" ]] && unset PTPAX + [[ $f = "-DPTPAX" ]] && PTPAX=1 done export XTPAX export PTPAX -if [ -d ${PYTHONPATH} ]; then +if [[ -d ${PYTHONPATH} ]]; then rm -rf ${PYTHONPATH} - echo " (Re)building pax module" - ( cd ../../scripts; exec ./setup.py build ) >/dev/null fi +echo " Rebuilding pax module" +( cd ../../scripts; exec ./setup.py build ) >/dev/null count=0 +dots=0 for pf in "p" "P" "-"; do for ef in "e" "E" "-"; do @@ -60,7 +61,7 @@ for pf in "p" "P" "-"; do for sf in "s" "S" "-"; do pflags="${pf}${ef}${mf}${rf}${sf}" - if [ "${verbose}" != 0 ] ;then + if [[ "${verbose}" != 0 ]] ;then echo "SET TO :" ${pflags} fi @@ -69,21 +70,26 @@ for pf in "p" "P" "-"; do sflags=$(${PYPAXCTL} -g ${TESTFILE}) - if [ "${verbose}" != 0 ] ;then + if [[ "${verbose}" != 0 ]] ;then echo "GOT :" ${sflags} fi - if [ "${pflags}" != "${sflags}" ]; then + if [[ "${pflags}" != "${sflags}" ]]; then (( count = count + 1 )) - if [ "${verbose}" != 0 ] ;then + if [[ "${verbose}" != 0 ]] ;then echo "Mismatch: ${pflags} ${sflags}" fi fi - if [ "${verbose}" != 0 ] ;then + if [[ "${verbose}" != 0 ]] ;then echo else + (( dots = dots + 1 )) echo -n "." + if [[ "$dots" = "80" ]]; then + dots=0 + echo + fi fi done @@ -94,6 +100,8 @@ done echo +dots=0 + for pf in "p" "P" "-"; do for ef in "e" "E" "-"; do for mf in "m" "M" "-"; do @@ -101,7 +109,7 @@ for pf in "p" "P" "-"; do for sf in "s" "S" "-"; do pflags="${pf}${ef}${mf}${rf}${sf}" - if [ "${verbose}" != 0 ] ;then + if [[ "${verbose}" != 0 ]] ;then echo "SET TO :" ${pflags} fi @@ -111,21 +119,26 @@ for pf in "p" "P" "-"; do sflags=$(${PAXCTLNG} -v ${TESTFILE}) sflags=$(echo ${sflags} | awk '{print $4}') - if [ "${verbose}" != 0 ] ;then + if [[ "${verbose}" != 0 ]] ;then echo "GOT :" ${sflags} fi - if [ "${pflags}" != "${sflags}" ]; then + if [[ "${pflags}" != "${sflags}" ]]; then (( count = count + 1 )) - if [ "${verbose}" != 0 ] ;then + if [[ "${verbose}" != 0 ]] ;then echo "Mismatch: ${pflags} ${sflags}" fi fi - if [ "${verbose}" != 0 ] ;then + if [[ "${verbose}" != 0 ]] ;then echo else + (( dots = dots + 1 )) echo -n "." + if [[ "$dots" = "80" ]]; then + dots=0 + echo + fi fi done @@ -134,7 +147,7 @@ for pf in "p" "P" "-"; do done done -if [ "${verbose}" = 0 ] ;then +if [[ "${verbose}" = 0 ]] ;then echo echo fi diff --git a/tests/revdeppaxtest/revdeptest.sh b/tests/revdeppaxtest/revdeptest.sh index e8380e8..25d077b 100755 --- a/tests/revdeppaxtest/revdeptest.sh +++ b/tests/revdeppaxtest/revdeptest.sh @@ -79,9 +79,9 @@ export PTPAX if [ -d ${PYTHONPATH} ]; then rm -rf ${PYTHONPATH} - echo " (Re)building pax module" - ( cd ../../scripts; exec ./setup.py build ) >/dev/null fi +echo " Rebuilding pax module" +( cd ../../scripts; exec ./setup.py build ) >/dev/null count=0 -- cgit v1.2.3-65-gdbad