#!/bin/bash # $HeadURL$ $LastChangedRevision$ PROGNAME=`basename $0` SANDPIT=`pwd` . $(ade-config ade_share_prefix)/include/adetestsupport.sh ############################################################################## # # Purpose of test: to verify that directives only accept the right number of # arguments # # Bug id: # ############################################################################## # Ensure dates are consistently formatted export LC_ALL=C # Start of support functions filter_variant_text() { UNAMEN=${UNAMEN:-$(uname -n)} # Note how the variable *width* of a hostname - and therefore of the padding # that follows it in column-aligned output - means that we can't change # just to VARIANT-HOSTNAME but *with* padding to # VARIANT-HOSTNAME with fixed width padding. eval "$@" | sed -e 's/[A-Z][a-z][a-z] [A-Z][a-z][a-z] [1-3 ][0-9] [0-2][0-9]:[0-5][0-9]:[0-5][0-9] [A-Z][A-Z]* [1-2][0-9][0-9][0-9]/Fri Dec 31 23:59:59 GMT 1999/g' \ -e 's/^\(pub\)\( *\)\([^ ]*\)\( *\)\([^ ]*\)$/\1\2VARIANT-KEY-ID\4VARIANT-DATE/' \ -e "s@$SANDPIT@VARIANT-SANDPIT@g" \ -e "s/$UNAMEN */VARIANT-HOSTNAME /g" \ -e "s/$UNAMEN\([^ \t]\)/VARIANT-HOSTNAME\1/g" \ -e "s/20[1-9][0-9][0-1][0-9][0-3][0-9][0-2][0-9][0-5][0-9][0-5][0-9]/VARIANT-TIMESTAMP/g" # return the passed command's return code, not sed's. return ${PIPESTATUS[0]} } # Start of support functions # End of support functions echo "setting up environment ..." # Ensure DB is created in sandpit export PAA_RCDIR=$SANDPIT/.paa # Force use of non-interactive editor mkdir $SANDPIT/bin echo -e '#!/bin/sh\n\ncat > $1' > $SANDPIT/bin/caton chmod 755 $SANDPIT/bin/caton export EDITOR=$SANDPIT/bin/caton # Ensure user's real shares are not deleted (even though this script doesn't create any) export PAA_STATE_PREFIX=$SANDPIT/var # Central control over paa's verbosity VERBOSE_OPTS="" # Create repo paa $VERBOSE_OPTS repo centos-6-i386 rpm mirrored true # Edit it with lots of different errors for DIRECTIVE in release port distro url mirror_dir freeze_dir indirect_dir mirror_cmd layout no_such_directive; do echo "setting up with bad '$DIRECTIVE' call ..." # Configure repo # If DIRECTIVE is a normal directive add extra args. If DIRECTIVE # is no_such_directive then just add it at the bottom of the file. { echo "release 6" echo "port 6 i386" echo "distro centos" echo "url \"http://install.pasta.net/./\"" echo "mirror_dir \"$SANDPIT/mirrors/\"" echo "freeze_dir \"$SANDPIT/$FREEZE_DIR_SUFFIX/.\"" echo "indirect_dir \"$SANDPIT/$INDIRECT_DIR_SUFFIX/.\"" echo "mirror_cmd \"date > date\"" echo "layout 6 \".\"" } | if [ $DIRECTIVE != no_such_directive ]; then sed "s/\($DIRECTIVE .*\)/\\1 extra_stuff/" else cat echo $DIRECTIVE fi | paa $VERBOSE_OPTS editrepo centos-6-i386 2>&1 | sed -e 's/^[^:]*: line 10:/BLANKED: line 10:/' || true echo done # Tidy up. paa $VERBOSE_OPTS unrepo centos-6-i386