From: Ben Pfaff Date: Sun, 3 Oct 2010 15:06:50 +0000 (-0700) Subject: PERMISSIONS: Convert test to Autotest framework. X-Git-Tag: v0.7.6~105 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a470efb8420fcb856bedeb9ef4804d874ced8b22;p=pspp-builds.git PERMISSIONS: Convert test to Autotest framework. --- diff --git a/tests/automake.mk b/tests/automake.mk index 95241108..14b1194c 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -10,7 +10,6 @@ TESTS_ENVIRONMENT += LC_ALL=C TESTS_ENVIRONMENT += EXEEXT=$(EXEEXT) dist_TESTS = \ - tests/command/permissions.sh \ tests/command/print.sh \ tests/command/print-strings.sh \ tests/command/rank.sh \ @@ -383,6 +382,7 @@ TESTSUITE_AT = \ tests/language/stats/npar.at \ tests/language/stats/oneway.at \ tests/language/utilities/insert.at \ + tests/language/utilities/permissions.at \ tests/language/utilities/set.at \ tests/language/utilities/title.at \ tests/language/xforms/compute.at \ diff --git a/tests/command/permissions.sh b/tests/command/permissions.sh deleted file mode 100755 index 7c4504a7..00000000 --- a/tests/command/permissions.sh +++ /dev/null @@ -1,98 +0,0 @@ -#!/bin/sh - -# This program tests the PERMISSIONS command - -TEMPDIR=/tmp/pspp-tst-$$ -TESTFILE=$TEMPDIR/`basename $0`.sps - -# ensure that top_builddir are absolute -if [ -z "$top_builddir" ] ; then top_builddir=. ; fi -if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi -top_builddir=`cd $top_builddir; pwd` -PSPP=$top_builddir/src/ui/terminal/pspp$EXEEXT - -# ensure that top_srcdir is absolute -top_srcdir=`cd $top_srcdir; pwd` - -STAT_CONFIG_PATH=$top_srcdir/config -export STAT_CONFIG_PATH - - -cleanup() -{ - if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then - echo "NOT cleaning $TEMPDIR" - return ; - fi - cd / - rm -rf $TEMPDIR -} - - -fail() -{ - echo $activity - echo FAILED - cleanup; - exit 1; -} - - -no_result() -{ - echo $activity - echo NO RESULT; - cleanup; - exit 2; -} - -pass() -{ - cleanup; - exit 0; -} - -mkdir -p $TEMPDIR - -cd $TEMPDIR - - -activity="Create file" -echo HEllo > foobar -chmod 777 foobar -if [ $? -ne 0 ] ; then no_result ; fi - -activity="Create program" -cat > per.sps < /dev/null -if [ $? -ne 0 ] ; then fail ; fi - - -activity="Create program" -cat > per.sps < /dev/null -if [ $? -ne 0 ] ; then fail ; fi - - - -pass; diff --git a/tests/language/utilities/permissions.at b/tests/language/utilities/permissions.at new file mode 100644 index 00000000..873057c8 --- /dev/null +++ b/tests/language/utilities/permissions.at @@ -0,0 +1,25 @@ +AT_BANNER([PERMISSIONS]) + +AT_SETUP([PERMISSIONS]) +AT_DATA([foobar], [Hello +]) + +chmod 666 foobar +AT_CHECK([ls -l foobar], [0], [stdout]) +AT_CHECK([sed 's/^\(..........\).*/\1/' stdout], [0], [-rw-rw-rw- +]) + +AT_DATA([permissions.sps], [PERMISSIONS /FILE='foobar' PERMISSIONS=READONLY. +]) +AT_CHECK([pspp -O format=csv permissions.sps]) +AT_CHECK([ls -l foobar], [0], [stdout]) +AT_CHECK([sed 's/^\(..........\).*/\1/' stdout], [0], [-r--r--r-- +]) + +AT_DATA([permissions.sps], [PERMISSIONS /FILE='foobar' PERMISSIONS=WRITEABLE. +]) +AT_CHECK([pspp -O format=csv permissions.sps]) +AT_CHECK([ls -l foobar], [0], [stdout]) +AT_CHECK([sed 's/^\(..........\).*/\1/' stdout], [0], [-rw-r--r-- +]) +AT_CLEANUP