|
|
c9e5162 |
# runtest.sh - uppercase-operand
|
|
|
c9e5162 |
# Author: Petr Muller <pmuller@redhat.com>
|
|
|
c9e5162 |
# Location: /CoreOS/sed/Regression/uppercase-operand/runtest.sh
|
|
|
c9e5162 |
|
|
|
c9e5162 |
# Description: Verifiies that sed correctly processes an 'u' operand, which returns uppercase of matched character
|
|
|
c9e5162 |
|
|
|
c9e5162 |
# Copyright (c) 2008 Red Hat, Inc. All rights reserved. This copyrighted material
|
|
|
c9e5162 |
# is made available to anyone wishing to use, modify, copy, or
|
|
|
c9e5162 |
# redistribute it subject to the terms and conditions of the GNU General
|
|
|
c9e5162 |
# Public License v.2.
|
|
|
c9e5162 |
#
|
|
|
c9e5162 |
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
c9e5162 |
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
|
c9e5162 |
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
c9e5162 |
#
|
|
|
c9e5162 |
# You should have received a copy of the GNU General Public License
|
|
|
c9e5162 |
# along with this program; if not, write to the Free Software
|
|
|
c9e5162 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
c9e5162 |
|
|
|
c9e5162 |
|
|
|
c9e5162 |
PACKAGE=sed
|
|
|
c9e5162 |
|
|
|
c9e5162 |
RESULT=FAIL
|
|
|
c9e5162 |
SCORE=0
|
|
|
c9e5162 |
|
|
|
c9e5162 |
if rpm -q $PACKAGE &>/dev/null; then
|
|
|
c9e5162 |
PKG_VERS=$( rpm -q ${PACKAGE} --queryformat %{version} )
|
|
|
c9e5162 |
PKG_RELEASE=$( rpm -q ${PACKAGE} --queryformat %{release} )
|
|
|
c9e5162 |
fi
|
|
|
c9e5162 |
|
|
|
c9e5162 |
# Include rhts environment
|
|
|
c9e5162 |
. /usr/bin/rhts-environment.sh
|
|
|
c9e5162 |
|
|
|
c9e5162 |
function Log {
|
|
|
c9e5162 |
echo -e ":: [`date +%H:%M:%S`] :: $1" >> $OUTPUTFILE
|
|
|
c9e5162 |
}
|
|
|
c9e5162 |
|
|
|
c9e5162 |
function HeaderLog {
|
|
|
c9e5162 |
echo -e "\n::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::" >> $OUTPUTFILE
|
|
|
c9e5162 |
echo -e ":: [`date +%H:%M:%S`] :: $1" >> $OUTPUTFILE
|
|
|
c9e5162 |
echo -e "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\n" >>$OUTPUTFILE
|
|
|
c9e5162 |
}
|
|
|
c9e5162 |
|
|
|
c9e5162 |
HeaderLog "Starting $PACKAGE RHTS Test"
|
|
|
c9e5162 |
|
|
|
c9e5162 |
if rpm -q $PACKAGE &>/dev/null; then
|
|
|
c9e5162 |
Log "Running $PACKAGE-$PKG_VERS-$PKG_RELEASE"
|
|
|
c9e5162 |
else
|
|
|
c9e5162 |
Log "WARNING: Unable to locate $PACKAGE"
|
|
|
c9e5162 |
fi
|
|
|
c9e5162 |
|
|
|
c9e5162 |
####################
|
|
|
c9e5162 |
# Begin Test-Case
|
|
|
c9e5162 |
# Find result should be PASS or FAIL
|
|
|
c9e5162 |
####################
|
|
|
c9e5162 |
|
|
|
c9e5162 |
HeaderLog "Starting Test-Case"
|
|
|
c9e5162 |
|
|
|
c9e5162 |
testcase='i shouLD be In UpPeR CaSe, yeah, I should'
|
|
|
c9e5162 |
Log "Testcase: '$testcase'"
|
|
|
c9e5162 |
res=`echo $testcase | sed -e 's/[a-z]/\u&/g'`
|
|
|
c9e5162 |
Log "Result: $res"
|
|
|
c9e5162 |
|
|
|
c9e5162 |
####################
|
|
|
c9e5162 |
# Check Results
|
|
|
c9e5162 |
####################
|
|
|
c9e5162 |
|
|
|
c9e5162 |
HeaderLog "Checking Results"
|
|
|
c9e5162 |
if [ "$res" == "I SHOULD BE IN UPPER CASE, YEAH, I SHOULD" ]
|
|
|
c9e5162 |
then
|
|
|
c9e5162 |
RESULT=PASS
|
|
|
c9e5162 |
Log "Seems correct: PASS"
|
|
|
c9e5162 |
else
|
|
|
c9e5162 |
RESULT=FAIL
|
|
|
c9e5162 |
Log "Didn't get what we expected: FAIL"
|
|
|
c9e5162 |
fi
|
|
|
c9e5162 |
|
|
|
c9e5162 |
HeaderLog "Reporting Results"
|
|
|
c9e5162 |
|
|
|
c9e5162 |
Log "TEST: $TEST | RESULT: $RESULT\n"
|
|
|
c9e5162 |
report_result $TEST $RESULT
|
|
|
c9e5162 |
|
|
|
c9e5162 |
HeaderLog "End of $PACKAGE RHTS Test"
|